-
Notifications
You must be signed in to change notification settings - Fork 9
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
Update MAGIC-LST scripts to ctapipe v0.12.0 #6
Conversation
Replace get_key_if_exists with dict.get
…tory/magic-cta-pipe into dev-yoshiki Conflicts: lst1_magic/magic_data_cal_to_dl1.py magicctapipe/scripts/lst1_magic_real/check_coincidence_overview.py magicctapipe/scripts/lst1_magic_real/check_pointing_directions.py magicctapipe/scripts/lst1_magic_real/get_common_obs_info.py magicctapipe/scripts/lst1_magic_real/lst1_magic_dl1_to_dl2.py magicctapipe/scripts/lst1_magic_real/lst1_magic_event_coincidence.py magicctapipe/scripts/lst1_magic_real/lst1_magic_mc_dl0_to_dl1.py magicctapipe/scripts/lst1_magic_real/lst1_magic_stereo_reco.py magicctapipe/scripts/lst1_magic_real/lst1_magic_train_rfs.py magicctapipe/scripts/lst1_magic_real/notebooks/check_data_quality.ipynb magicctapipe/scripts/lst1_magic_real/notebooks/check_sensitivity_from_data.ipynb magicctapipe/scripts/lst1_magic_real/notebooks/check_spectrum.ipynb magicctapipe/utils/merge_hdf_files.py magicctapipe/utils/my_functions.py utils/__init__.py
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
@@ -43,41 +73,82 @@ event_coincidence: | |||
|
|||
|
|||
stereo_reco: | |||
subarray: '/fefs/home/yoshiki.ohtani/software/magic-cta-pipe/lst1_magic/data/subarray_lst1_magic.pkl' | |||
quality_cuts: (intensity > 50) & (width > 0) | |||
subarray: '/home/yoshiki.ohtani/software/magic-cta-pipe/magicctapipe/scripts/lst1_magic_real/data/subarray_lst1_magic.pickle' |
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.
I think that is better to save the subarray information together with the DL1 file(s) produced by the event coincidence script. If you have the SubarrayDescription object (as saved in the pickle file), you can define it in the event coincidence script and use the SubarrayDescription.to_hdf method to write it into the HDF5 file (if I understood correctly, saving the subarray in the HDF5 file should be done before saving anything else).
This would avoid having to specify the path to the pickle file, and instead reading everything from the file at once.
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.
Hm, OK, I think I can define the subarray object inside the stereo reconstruction script. I'm implementing this solution now.
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.
By the way saving the subarray after saving others, for example event dl1 parameters works without any problems. Probably it was updated?
magic_stereo = Field(-1, 'True if M1 and M2 are triggered') | ||
|
||
|
||
class SimInfoContainer(Container): |
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.
Why not using the SimulationConfigContainer from ctapipe instead of defining a new one? SimulationConfigContainer has more members, so you will not use them all, but I think we should try to use already defined things (especially if already in ctapipe)
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.
Ok, now I see that you extract source.simulation_config
, which indeed is a SimulationConfigContainer
, and then fill the custom container. Since the simulation configuration is not a big container (anyway just one per run), I would write directly source.simulation_config
into the HDF5 file.
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.
Thanks for your comment, and indeed I agree with you, I will change it.
if stereo_params.az < 0: | ||
stereo_params.az = stereo_params.az + u.Quantity(2*np.pi, u.rad) | ||
stereo_params.az += u.Quantity(360, u.deg) |
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.
here the indentation is wrong, should be one tab less
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.
thanks I modified it
setup.py
Outdated
@@ -22,11 +22,11 @@ | |||
install_requires=[ | |||
'astropy>=4.0.5,<5', | |||
'ctapipe~=0.12.0', | |||
'ctapipe_io_magic~=0.3.0', | |||
'ctapipe_io_magic', |
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.
Was this an issue for you? Anyway this will be changed when we will merge into master and I will make a new version of ctapipe_io_magic (v0.4.0, which I will create from the current master branch, the one working with ctapipe v0.12)
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.
Yes there was an issue for some reason, anyway the version 0.3.0 is for ctapipe v0.8.0 and so I modified it. Would be great if you create v0.4.0, and then I will modify it again.
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.
Ok, I can do it now. I will check if I need to update a bit the README.md and then create tag and release.
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.
Ok, it took a bit, but now ctapipe_io_magic was tagged with version 0.4.0. Also, it can be installed with pip without cloning the repo, since now I uploaded the module in PyPI.
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.
Thanks! Ah so it means now one doesn't need to clone both ctapipe and ctapipe_io_magic, and instead just need to create an environment, clone only magic-cta-pipe and type pip install .
?
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.
To have everything working as you say, indeed we would need to create an environment.yml file, which will install ctapipe 0.12 (and dependencies), ctapipe_io_magic 0.4.0 (and dependencies) and finally magic-cta-pipe
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.
I see, is it possible for you to create an environment.yml file? I think it would be better and easy way for the students to install the pipeline if they need to do it by themself (in the local machine, another computer, etc)
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.
Sure, I can do it. I will do a commit in the update-ctapipe-v0.12 branch.
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.
Thanks a lot!
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.
Done!
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.
Ok, I think I checked everything, and put my comments, and some you already replied. So at that point I will check them again. Thanks for updating the scripts!
OK so I think I updated all the points that Alessio mentioned and pushed the commits, but have not yet tested them. I will test them tomorrow (already today in Japan :)) and will let you know once it is done. Then if there are not any further comments I think we can merge it. |
…-pipe into dev-yoshiki Conflicts: magicctapipe/utils/__init__.py
Sorry for taking time but I found some mistakes in the scripts about the subarray descriptions, and so I modified them. I also updated the script for merging HDF files. I tested the script and confirmed that now it works fine. |
@aleberti, if it is fine for you, could you merge this branch to update-ctapipe-v0.12, and merge update-ctapipe-v0.12 to master, please? And probably create a new tag (v0.1.0 ?) for the current version? |
Sure, give me some time and I do it :) |
Thanks a lot! I will delete my branch then… |
Sure, in any case I have to do a second tag, because I need to add some files to build the package to upload it to PyPI. |
Here the combined analysis scripts are updated to be used in the ctapipe v0.12.0 environment.