Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new file geometry_v2.py #22

Merged
merged 3 commits into from
Jun 26, 2024
Merged

new file geometry_v2.py #22

merged 3 commits into from
Jun 26, 2024

Conversation

LuKupari
Copy link
Contributor

fortran to python conversion for geometry module in propagate.f90

@LuKupari LuKupari requested a review from dikgarg April 24, 2024 20:06
@dikgarg dikgarg added the enhancement New feature or request label May 1, 2024
Comment on lines 13 to 25
import nupyprop.data as Data
#from nupyprop.propagate import geometry as Geometry
import nupyprop.constants as const

from collections import OrderedDict
import numpy as np
from scipy import integrate
import sympy as sp
from astropy.table import Table
#import multiprocessing as mp
#from multiprocessing import Pool
import warnings
warnings.filterwarnings('ignore')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are all these packages being used? Can you remove the ones not being used?

Comment on lines 57 to 58
#sets the last layer as water layer
Rlay[9] = 6368.0 + (3.0 - float(idepth))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idepth should be kept as type 'int'.

Comment on lines 62 to 85
if Rin <= Rlay[0]:
edens = 13.0885-8.8381*y**2
elif Rin <= Rlay[1]:
edens = 12.5815-1.2638*y-3.6426*y**2-5.5281*y**3
elif Rin <= Rlay[2]:
edens = 7.9565-6.4761*y+5.5283*y**2-3.0807*y**3
elif Rin <= Rlay[3]:
edens = edens = 5.3197-1.4836*y
elif Rin <= Rlay[4]:
edens = 11.2494-8.0298*y
elif Rin <= Rlay[5]:
edens = 7.1089-3.8045*y
elif Rin <= Rlay[6]:
edens = 2.6910+0.6924*y
elif Rin <= Rlay[7]:
edens = 2.900
elif Rin <= Rlay[8]:
edens = 2.600
elif Rin <= Rlay[9]:
edens = 1.020
elif Rin <=Rlay[9]*1.001:
edens = 1.020
else:
edens=0.0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks very verbose, you can maybe define all these conditions in a tuple and then use a loop to match for the corresponding Rin. Hint: Try using ChatGPT :)

@dikgarg
Copy link
Collaborator

dikgarg commented May 1, 2024

Overall it looks good, but we should create an issue that mentions this file has to serve as the main geometry.py file and we should remove the old one. Also we should remove all the commented out code too.

Copy link
Collaborator

@dikgarg dikgarg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@dikgarg dikgarg merged commit fba53aa into main Jun 26, 2024
1 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants