Closed steven-murray closed 4 years ago
Yes, as many input files will be provided by the user it is normal to have hard-coded paths in the input files. However, the sail_example2.txt, sail_example5.txt, sail_example6.txt and sail_example7.txt should work without any edits.
OK, I think I see. Perhaps it would be better to have an example on the README that worked out of the box without user input, or at least say that the file needs to be changed before running the example.
I also get a similar issue when trying to run the suggested example in the README:
>>> from exotethys import trip
>>> trip.trip_calculate('examples/trip_example.txt')
WARNING: /Users/pepe/Desktop/aux_files/ld_Teff6100.0_logg4.5_MH0.0_TESS.txt file not found.
ERROR: invalid format for input_limb_file /Users/pepe/Desktop/aux_files/ld_Teff6100.0_logg4.5_MH0.0_TESS.txt . It must have 2 columns.
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-2-3c574cbd2807> in <module>
----> 1 trip.trip_calculate('examples/trip_example.txt')
~/Projects/forks/ExoTETHyS/venv/lib/python3.8/site-packages/exotethys/trip.py in trip_calculate(configuration_file)
952 [check, input_dict] = check_configuration(input_dict1) #Checking configuration file and dictionary update
953 if check:
--> 954 process_configuration(input_dict) #Computing and saving
955 else:
956 print('Something went wrong with the input.')
~/Projects/forks/ExoTETHyS/venv/lib/python3.8/site-packages/exotethys/trip.py in process_configuration(input_dict)
807 input_limb_path = input_dict_local['input_limb_path'][0]
808 input_limb_file = input_dict_local['input_limb_file'][0]
--> 809 [mu_model_orig, radi_model_orig, intensity_model_orig] = get_input_limb_model(input_limb_type,input_limb_path,input_limb_file)
810
811 cutting_limb = input_dict_local['cutting_limb'][0]
~/Projects/forks/ExoTETHyS/venv/lib/python3.8/site-packages/exotethys/trip.py in get_input_limb_model(input_limb_type, input_limb_path, input_limb_file)
711 if not check_2Darray(limb_model, n_col=2):
712 print('ERROR: invalid format for input_limb_file', input_limb_path+input_limb_file, '. It must have 2 columns.')
--> 713 exit()
714 intensity_model = copy.deepcopy(limb_model[:,1])
715 if np.min(intensity_model)<0.0:
NameError: name 'exit' is not defined
It looks my previous answer got lost: now all the examples should run without errors if following the instructions of the README.
I currently get the error
>>> from exotethys import trip
>>> trip.trip_calculate('examples/trip_example.txt')
WARNING: ExoTETHyS-master/aux_files/ld_Teff6100.0_logg4.5_MH0.0_TESS.txt file not found.
ERROR: invalid format for input_limb_file ExoTETHyS-master/aux_files/ld_Teff6100.0_logg4.5_MH0.0_TESS.txt . It must have 2 columns.
However, if I rename the repository as ExoTETHyS-master, and then run the command from one directory above then it does run. Do you think it's possible to make the directories relative?
This command also seems to consume a lot of memory >10GB. Is this usual?
About the error it depends on the name of the folder as @williamjameshandley noted. The way I download the repository it is automatically named ExoTETHyS-master, but apparently it is not always the case. This problem would not exist if I suggest running the code from the root directory. I proposed running it from one level above to actually test the installation, otherwise python would import the local directory called exotethys. However, given that the user is not expected to modify the source code, this is probably an unnecessary precaution. Would you prefer that I propose running the examples from the root directory?
TRIP does consume a lot of memory as by default it uses 10^5 interpolated points for calculating integrals. (We are working on some optimization, but it will take some time because the optimal sampling is case-dependent).
TRIP does consume a lot of memory as by default it uses 10^5 interpolated points for calculating integrals. (We are working on some optimization, but it will take some time because the optimal sampling is case-dependent).
It might be worth putting a warning in the README, or finding an example which consumes a fraction of that amount of memory
About the error it depends on the name of the folder as @williamjameshandley noted. The way I download the repository it is automatically named ExoTETHyS-master, but apparently it is not always the case. This problem would not exist if I suggest running the code from the root directory. I proposed running it from one level above to actually test the installation, otherwise python would import the local directory called exotethys. However, given that the user is not expected to modify the source code, this is probably an unnecessary precaution. Would you prefer that I propose running the examples from the root directory?
I reckon it's probably more intuitive to run from within the directory, although I do acknowledge that this can cause import clashes.
Ok, I modified the examples to be run from the root folder. Also changed the README and including the note about memory for the TRIP example. Does it work now?
Does it work now?
Yes : )
Also changed the README and including the note about memory for the TRIP example.
This note should be directly below/above the second example in the list of subpackages section
Once that's done I'm happy for this issue to be closed.
I strongly feel that the examples should be runnable from wherever you are, as long as you pass in the path to the example file. It should not be dependent on being in any given folder.
I strongly feel that the examples should be runnable from wherever you are, as long as you pass in the path to the example file. It should not be dependent on being in any given folder.
Yes, but the correct path must be written in the example file.
Or maybe I did not fully get it. The examples are simple text files, I do not want anything more complicated than that. As they may contain the path to read other files, either the absolute path or the relative path from where you are running the code must be specified in the example file.
Three things:
os.path
module. @steven-murray Thanks for your new comments.
Last comment: the AJ paper was accepted 1 week ago, and they are only waiting for the link to the static version on Zenodo to publish it. I do not feel it is the case to futher delay the publication for this issue.
@gmorello : you're right that it currently works for the example on the README. I was confused because of all the absolute paths in the sail_example1.txt
file, but it seems that they're all commented out anyway. This could perhaps be cleaned up a bit -- users don't need to know your directory structure ;-).
I'm OK with this going forward and not being a hindrance to publication. However, I'd strongly suggest considering my suggestions further in the near future.
Examples cleaned, thanks. I am leaving the commented keywords anyway even if they are not used, just for convenience. I will consider the most recent suggestions for version 2 (this is going to be 1.0.2).
Soon I will re-check one last time that all the examples work as expected, then proceed with uploading to Pypi and Zenodo.
Part of JOSS review:
I am trying to follow the examples on the README. The
sail
example gave me an error:It seems that there is a hard-coded filepath in there?