Skip to content

Commit

Permalink
adding support for latex output
Browse files Browse the repository at this point in the history
  • Loading branch information
seVenVo1d committed Jan 25, 2023
1 parent dd732fa commit 5c5433b
Show file tree
Hide file tree
Showing 9 changed files with 191 additions and 43 deletions.
14 changes: 7 additions & 7 deletions gtrpy/screen/grtensorsGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ def grtensors_gui(metric_tensor, coord_sys, tensor_object):
window_tensor_type.Element('-TENSOR-').Update(r'logs/tensor.png')
window_tensor_type.Element('-TENSOR-COMP-').Update(r'logs/tensor_component.png')
if event == 'Get LaTeX':
latex_output(tensor_object, tensor_eqn)
latex_output_grtensor(tensor_object, tensor_eqn)

elif tensor_object == 'Inverse Metric Tensor':
layout_tensor_type = [
[sg.Frame(layout=[
[sg.Image(r'logs/tensor.png')]],
[sg.Image(r'logs/tensor.png')]],
title='Inverse Metric Tensor', font=('Verdana', 14), expand_x=True,
element_justification='center', title_location='n')],

Expand All @@ -113,7 +113,7 @@ def grtensors_gui(metric_tensor, coord_sys, tensor_object):
resize_tensor_component_image()
window_tensor_type.Element('-TENSOR-COMP-').Update(r'logs/tensor_component.png')
if event == 'Get LaTeX':
latex_output(tensor_object, tensor_eqn)
latex_output_grtensor(tensor_object, tensor_eqn)

elif tensor_object == 'Christoffel Symbol':
layout_tensor_type = [
Expand Down Expand Up @@ -154,7 +154,7 @@ def grtensors_gui(metric_tensor, coord_sys, tensor_object):
window_tensor_type.Element('-TENSOR-').Update(r'logs/tensor.png')
window_tensor_type.Element('-TENSOR-COMP-').Update(r'logs/tensor_component.png')
if event == 'Get LaTeX':
latex_output(tensor_object, tensor_eqn)
latex_output_grtensor(tensor_object, tensor_eqn)

elif tensor_object == 'Riemann Tensor':
layout_tensor_type = [
Expand Down Expand Up @@ -196,7 +196,7 @@ def grtensors_gui(metric_tensor, coord_sys, tensor_object):
window_tensor_type.Element('-TENSOR-').Update(r'logs/tensor.png')
window_tensor_type.Element('-TENSOR-COMP-').Update(r'logs/tensor_component.png')
if event == 'Get LaTeX':
latex_output(tensor_object, tensor_eqn)
latex_output_grtensor(tensor_object, tensor_eqn)

elif tensor_object == 'Weyl Tensor':
layout_tensor_type = [
Expand Down Expand Up @@ -238,7 +238,7 @@ def grtensors_gui(metric_tensor, coord_sys, tensor_object):
window_tensor_type.Element('-TENSOR-').Update(r'logs/tensor.png')
window_tensor_type.Element('-TENSOR-COMP-').Update(r'logs/tensor_component.png')
if event == 'Get LaTeX':
latex_output(tensor_object, tensor_eqn)
latex_output_grtensor(tensor_object, tensor_eqn)

elif tensor_object in scalar_objects:
layout_tensor_type = [
Expand All @@ -254,4 +254,4 @@ def grtensors_gui(metric_tensor, coord_sys, tensor_object):
if event == sg.WIN_CLOSED:
break
if event == 'Get LaTeX':
latex_output(tensor_object, tensor_eqn)
latex_output_grtensor(tensor_object, tensor_eqn)
13 changes: 11 additions & 2 deletions gtrpy/screen/screen3D/scalarfieldGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from gtrpy.equations.scalarfieldEP import *
from gtrpy.tools.image_resizer_fields3D import *
from gtrpy.tools.latex_output import *


# Image Path
Expand All @@ -29,7 +30,8 @@ def scalarfield_gui3d(coord_sys):
sg.Text('for', font=('Verdana', 11)),
sg.Image(resPATH + r'/images3D/e.png'),
sg.InputCombo(coord_sys, default_value=coord_sys[0])]],
title='Covariant Derivative', font=('Verdana', 12), expand_x=True, element_justification='center', title_location='n')],
title='Covariant Derivative', font=('Verdana', 12), expand_x=True,
element_justification='center', title_location='n')],

[sg.Frame(layout=[
[sg.Image(resPATH + r'/images3D/LX0.png'),
Expand All @@ -40,7 +42,8 @@ def scalarfield_gui3d(coord_sys):
sg.InputText(default_text='0', font=('Tahoma', 11))],
[sg.Button('Calculate', button_color='purple'),
sg.Image(resPATH + r'/images3D/LX_scalarfield.png')]],
title='Lie Derivative', font=('Verdana', 12), expand_x=True, element_justification='center', title_location='n')]
title='Lie Derivative', font=('Verdana', 12), expand_x=True,
element_justification='center', title_location='n')]
]
windows_scalar_field = sg.Window('Scalar Field', scalar_field_layout)
while True:
Expand All @@ -59,12 +62,15 @@ def scalarfield_gui3d(coord_sys):
resize_cd_image3d ('Scalar Field')
layout_cd_scalar_field_result = [
[sg.Image(r'logs/cd_scalar_field.png')],
[sg.Button('Get LaTeX', button_color='orange')]
]
window_cd_scalar_field_result = sg.Window('Scalar Field', layout_cd_scalar_field_result)
while True:
event, values = window_cd_scalar_field_result.read()
if event == sg.WIN_CLOSED:
break
if event == 'Get LaTeX':
latex_output_scalar_field(cd_scalar_field_eqn)

# Calculation of the Lie derivative
if event == 'Calculate0':
Expand All @@ -75,9 +81,12 @@ def scalarfield_gui3d(coord_sys):
resize_ld_image3d('Scalar Field')
layout_ld_scalar_field_result = [
[sg.Image(r'logs/ld_scalar_field.png')],
[sg.Button('Get LaTeX', button_color='orange')]
]
window_ld_scalar_field_result = sg.Window('Scalar Field', layout_ld_scalar_field_result)
while True:
event, values = window_ld_scalar_field_result.read()
if event == sg.WIN_CLOSED:
break
if event == 'Get LaTeX':
latex_output_scalar_field(ld_scalar_field_eqn)
38 changes: 31 additions & 7 deletions gtrpy/screen/screen3D/tensorfieldGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from gtrpy.equations.tensorfieldEP import *
from gtrpy.tools.image_resizer_fields3D import *
from gtrpy.tools.latex_output import *


# Image Path
Expand Down Expand Up @@ -42,7 +43,8 @@ def tensorfield_gui3d(event, metric_tensor, coord_sys):
sg.Text('for', font=('Verdana', 11)),
sg.Image(resPATH + r'/images3D/e.png'),
sg.InputCombo(coord_sys, default_value=coord_sys[0])]],
title='Covariant Derivative', font=('Verdana', 12), expand_x=True, element_justification='center', title_location='n')],
title='Covariant Derivative', font=('Verdana', 12), expand_x=True,
element_justification='center', title_location='n')],

[sg.Frame(layout=[
[sg.Image(resPATH + r'/images3D/LX0.png'),
Expand All @@ -53,7 +55,8 @@ def tensorfield_gui3d(event, metric_tensor, coord_sys):
sg.InputText(default_text='0', font=('Tahoma', 11))],
[sg.Button('Calculate', button_color='purple'),
sg.Image(resPATH + r'/images3D/LX_tensorfield_20.png')]],
title='Lie Derivative', font=('Verdana', 12), expand_x=True, element_justification='center', title_location='n')]
title='Lie Derivative', font=('Verdana', 12), expand_x=True,
element_justification='center', title_location='n')]
]
windows_tensor_field = sg.Window('Tensor Field', tensor_field_20_layout)
while True:
Expand All @@ -72,12 +75,15 @@ def tensorfield_gui3d(event, metric_tensor, coord_sys):
resize_cd_image3d('Type (2,0) Tensor Field')
layout_cd_tensor_field_result = [
[sg.Image(r'logs/cd_tensor_field_20.png')],
[sg.Button('Get LaTeX', button_color='orange')]
]
window_cd_tensor_field_result = sg.Window('Tensor Field', layout_cd_tensor_field_result)
while True:
event, values = window_cd_tensor_field_result.read()
if event == sg.WIN_CLOSED:
break
if event == 'Get LaTeX':
latex_output_tensor_field(cd_tensor_field_eqn)

# Calculation of the Lie derivative
elif event == 'Calculate0':
Expand All @@ -88,13 +94,15 @@ def tensorfield_gui3d(event, metric_tensor, coord_sys):
resize_ld_image3d('Type (2,0) Tensor Field')
layout_ld_tensor_field_result = [
[sg.Image(r'logs/ld_tensor_field_20.png')],
[sg.Button('Get LaTeX', button_color='orange')]
]
window_ld_tensor_field_result = sg.Window('Tensor Field', layout_ld_tensor_field_result)
while True:
event, values = window_ld_tensor_field_result.read()
if event == sg.WIN_CLOSED:
break

if event == 'Get LaTeX':
latex_output_tensor_field(ld_tensor_field_eqn)
elif event == 'Type (1,1) Tensor Field':
tensor_field_11_layout = [
[sg.Image(resPATH + r'/images3D/tensorfield_11_0.png'),
Expand All @@ -116,7 +124,8 @@ def tensorfield_gui3d(event, metric_tensor, coord_sys):
sg.Text('for', font=('Verdana', 11)),
sg.Image(resPATH + r'/images3D/e.png'),
sg.InputCombo(coord_sys, default_value=coord_sys[0])]],
title='Covariant Derivative', font=('Verdana', 12), expand_x=True, element_justification='center', title_location='n')],
title='Covariant Derivative', font=('Verdana', 12), expand_x=True,
element_justification='center', title_location='n')],

[sg.Frame(layout=[
[sg.Image(resPATH + r'/images3D/LX0.png'),
Expand All @@ -127,7 +136,8 @@ def tensorfield_gui3d(event, metric_tensor, coord_sys):
sg.InputText(default_text='0', font=('Tahoma', 11))],
[sg.Button('Calculate', button_color='purple'),
sg.Image(resPATH + r'/images3D/LX_tensorfield_11.png')]],
title='Lie Derivative', font=('Verdana', 12), expand_x=True, element_justification='center', title_location='n')]
title='Lie Derivative', font=('Verdana', 12), expand_x=True,
element_justification='center', title_location='n')]
]
windows_tensor_field = sg.Window('Tensor Field', tensor_field_11_layout)
while True:
Expand All @@ -146,12 +156,15 @@ def tensorfield_gui3d(event, metric_tensor, coord_sys):
resize_cd_image3d('Type (1,1) Tensor Field')
layout_cd_tensor_field_result = [
[sg.Image(r'logs/cd_tensor_field_11.png')],
[sg.Button('Get LaTeX', button_color='orange')]
]
window_cd_tensor_field_result = sg.Window('Tensor Field', layout_cd_tensor_field_result)
while True:
event, values = window_cd_tensor_field_result.read()
if event == sg.WIN_CLOSED:
break
if event == 'Get LaTeX':
latex_output_tensor_field(cd_tensor_field_eqn)

# Calculation of the Lie derivative
elif event == 'Calculate0':
Expand All @@ -162,12 +175,15 @@ def tensorfield_gui3d(event, metric_tensor, coord_sys):
resize_ld_image3d('Type (1,1) Tensor Field')
layout_ld_tensor_field_result = [
[sg.Image(r'logs/ld_tensor_field_11.png')],
[sg.Button('Get LaTeX', button_color='orange')]
]
window_ld_tensor_field_result = sg.Window('Tensor Field', layout_ld_tensor_field_result)
while True:
event, values = window_ld_tensor_field_result.read()
if event == sg.WIN_CLOSED:
break
if event == 'Get LaTeX':
latex_output_tensor_field(ld_tensor_field_eqn)
else:
tensor_field_02_layout = [
[sg.Image(resPATH + r'/images3D/tensorfield_02_0.png'),
Expand All @@ -189,7 +205,8 @@ def tensorfield_gui3d(event, metric_tensor, coord_sys):
sg.Text('for', font=('Verdana', 11)),
sg.Image(resPATH + r'/images3D/e.png'),
sg.InputCombo(coord_sys, default_value=coord_sys[0])]],
title='Covariant Derivative', font=('Verdana', 12), expand_x=True, element_justification='center', title_location='n')],
title='Covariant Derivative', font=('Verdana', 12), expand_x=True,
element_justification='center', title_location='n')],

[sg.Frame(layout=[
[sg.Image(resPATH + r'/images3D/LX0.png'),
Expand All @@ -200,7 +217,8 @@ def tensorfield_gui3d(event, metric_tensor, coord_sys):
sg.InputText(default_text='0', font=('Tahoma', 11))],
[sg.Button('Calculate', button_color='purple'),
sg.Image(resPATH + r'/images3D/LX_tensorfield_02.png')]],
title='Lie Derivative', font=('Verdana', 12), expand_x=True, element_justification='center', title_location='n')]
title='Lie Derivative', font=('Verdana', 12), expand_x=True,
element_justification='center', title_location='n')]
]
windows_tensor_field = sg.Window('Tensor Field', tensor_field_02_layout)
while True:
Expand All @@ -219,12 +237,15 @@ def tensorfield_gui3d(event, metric_tensor, coord_sys):
resize_cd_image3d('Type (0,2) Tensor Field')
layout_cd_tensor_field_result = [
[sg.Image(r'logs/cd_tensor_field_02.png')],
[sg.Button('Get LaTeX', button_color='orange')]
]
window_cd_tensor_field_result = sg.Window('Tensor Field', layout_cd_tensor_field_result)
while True:
event, values = window_cd_tensor_field_result.read()
if event == sg.WIN_CLOSED:
break
if event == 'Get LaTeX':
latex_output_tensor_field(cd_tensor_field_eqn)

# Calculation of the Lie derivative
elif event == 'Calculate0':
Expand All @@ -235,9 +256,12 @@ def tensorfield_gui3d(event, metric_tensor, coord_sys):
resize_ld_image3d('Type (0,2) Tensor Field')
layout_ld_tensor_field_result = [
[sg.Image(r'logs/ld_tensor_field_02.png')],
[sg.Button('Get LaTeX', button_color='orange')]
]
window_ld_tensor_field_result = sg.Window('Tensor Field', layout_ld_tensor_field_result)
while True:
event, values = window_ld_tensor_field_result.read()
if event == sg.WIN_CLOSED:
break
if event == 'Get LaTeX':
latex_output_tensor_field(ld_tensor_field_eqn)
Loading

0 comments on commit 5c5433b

Please sign in to comment.