-
Notifications
You must be signed in to change notification settings - Fork 2
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
Conversation
…f geometry module
src/nupyprop/geometry_v2.py
Outdated
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') |
There was a problem hiding this comment.
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?
src/nupyprop/geometry_v2.py
Outdated
#sets the last layer as water layer | ||
Rlay[9] = 6368.0 + (3.0 - float(idepth)) |
There was a problem hiding this comment.
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'.
src/nupyprop/geometry_v2.py
Outdated
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 |
There was a problem hiding this comment.
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 :)
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
fortran to python conversion for geometry module in propagate.f90