-
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
Random updates and refactoring of the combined analysis pipeline #91
Conversation
… and reconstruct_arrival_directions
…f exiting the program
Thank you very much @jsitarek for your checks and comments. We already talked via emails, but just in case let me write also here. I implemented all his comments in this pull request and resolved them. I would like to push a few more commits about refactoring with which I came up during implementing his comments, and also about the implementation of a functionality to create the full-enclosure IRFs. I will let you know once I'm done, and then it will be finally ready to be merged to the master branch. @aleberti if you have any comments or suggestions to this branch please let me know. |
Thinking more about this I think it is best if the remaining refactoring
goes into this PR and the full enclosure IRF, as new development go into a
separate PR.
Cheers,
Julian
śr., 28 wrz 2022, 17:03 użytkownik Yoshiki Ohtani ***@***.***>
napisał:
… Thank you very much @jsitarek <https://github.com/jsitarek> for your
checks and comments. We already talked via emails, but just in case let me
write also here. I implemented all his comments in this pull request and
resolved them. I would like to push a few more commits about refactoring
with which I came up during implementing his comments, and also about the
implementation of a functionality to create the full-enclosure IRFs. I will
let you know once I'm done, and then it will be finally ready to be merged
to the master branch. @aleberti <https://github.com/aleberti> if you have
any comments or suggestions to this branch please let me know.
—
Reply to this email directly, view it on GitHub
<#91 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AH36DYLW5TW3J4UKIWLYQ63WART4PANCNFSM567IJAAA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Hi @jsitarek, OK thanks, actually I was also thinking about that, so I will create another pull request later. |
OK so I have done. There are really minor changes so I don't think they need to be reviewed thoroughly. If there is no objection, let me merge it to the master branch. |
Hi @YoshikiOhtani, yes, please go ahead and merge. |
OK, I will merge it now. |
This pull request includes some random updates and refactoring of the combined analysis pipeline. I tested running the updated pipeline with a few data samples and it worked. However, I will keep this pull request open until I confirm that the pipeline produces the consistent results with the whole Crab samples that I usually analyze. Meanwhile, it would be very much appreciated if you could give me some comments or feedbacks. Let me assign @aleberti and @jsitarek as reviewers.
Here let me summarize the changes as follows:
General changes
max-line-length = 88
setting (72 for docstrings as following PEP8). Constant variables are now defined in capital letters. Please note that the most updated version of black consider the magic trailing comma by default, but in this pull request I removed this functionality with the option-C
(or--skip-magic-trailing-comma
) to reduce the user flexibility as much as possible.magicctapipe/io
directory and the modulescontainer.py
,gadf.py
andio.py
, and moved some functions to them frommagicctapipe/scripts/lst1_magic/*.py
andmagicctapipe/utils/functions.py
.Important changes for users
Quantity
can read the unit directly from the string. See the following example:magic-cta-pipe/magicctapipe/scripts/lst1_magic/config.yaml
Line 79 in 95f311e
--train-direction
to--train-disp
, and also the name of the output RF file fromdirection_regressors_*.joblib
todisp_regressors_*.joblib
.dist_sum
todisp_diff_sum
, which is the sum of the angular distances of DISP candidates.software_with_any2
tosoftware
, andsoftware
tosoftware_only_3tel
, since the analysis with any2 events would be more standard for the software coincidence.disp_diff_mean
which is the mean of the angular distances of DISP candidates.lst1_magic_train_rfs.py
from--input-file-gamma
,--input-file-bkg
to--input-dir-gamma
,--input-dir-proton
so that multiple input MC files produced by different pointing directions can be read.From here let me describe the other noticeable changes for each script or module:
functions.py
calculate_angular_distance
tocalculate_off_coordinates
and simplify the functionality to return only OFF coordinates. Please note that the needed arguments are also changed.check_tel_combination
toget_stereo_events
, and changed the functionality to apply quality cuts and return a new data frame of stereo events with thecombo_type
andmultiplicity
parameters.save_pandas_to_table
tosave_pandas_data_in_table
.get_stereo_events
,get_dl2_mean
andsave_pandas_data_in_table
tomagicctapipe/io/io.py
.create_gh_cuts_hdu
tomagicctapipe/io/gadf.py
.lst1_magic_mc_dl0_to_dl1.py
magicctapipe/io/containers.py
and adapted the script to import them from the module.magic_calib_to_dl1.py
lst1_magic_mc_dl0_to_dl1.py
.lst1_magic_event_coincidence.py
load_lst_data_file
andload_magic_data_file
toload_lst_dl1_data_file
andload_magic_dl1_data_files
, moved them tomagicctapipe/io/io.py
, and adapted the script to import them from the module.type_lst_time
totimestamp_type_lst
, which is the type of the LST timestamp.window_width (= 600 ns)
towindow_half_width (= 300 ns)
, which is the coincidence window half width.time_lst
,time_magic
,time_offsets
,window_half_width
) in nanoseconds and use theint64bit
format, instead of subtracting the UNIX time of an observation day and using float64bit type. I think this is a safer way in terms of a rounding issue, and now we don't need to round the parameters which happened everywhere in the script. Also I believe it improves the readability of the code.lst1_magic_stereo_reco.py
loc
method instead ofquery
to extract a shower event, since it speeds up the process around 20%.core_uncert
,h_max_uncert
,is_valid
. See the definition of the reconstructor.lst1_magic_train_rfs.py
load_train_data_file
tomagicctapipe/io/io.py
and adapted the script to import it from the module.check_feature_importance
and added the functionality to the training functions.get_events_at_random
and added the functionality directly insidetrain_event_classifier
.train_direction_regressor
totrain_disp_regressor
as following the change of the regressor module fromDirectionRegressor
toDispRegressor
.load_train_data_file
toload_train_data_files
and the argument frominput_file
toinput_dir
so that multiple MC files can be read.lst1_magic_dl1_stereo_to_dl2.py
DirectionRegressor.predict
toDispRegressor.predict
andreconstruct_arrival_direction
functions to make it clear thatDispRegressor
only trains and predicts the DISP parameter, and the reconstruction of the arrival direction is done separately with the DISP method. Also,DirectionRegressor
assumed that the input data is already separated per telescope combination type, but nowDispRegressor
does not assume it. So we can easily test training/applying RFs with thecombo_type
parameter without separating the RFs per telescope combination types.lst1_magic_create_irf.py
load_dl2_data_file
toload_mc_dl2_data_file
, moved it tomagicctapipe/io/io.py
, and adapted the script to import it from the module.apply_dynamic_gammaness_cut
andapply_dynamic_theta_cut
, and added the functionality tocreate_irf
.lst1_magic_dl2_to_dl3.py
calculate_deadc
and added the functionality insideload_dl2_data_file
.load_dl2_data_file
,load_irf_files
tomagicctapipe/io/io.py
, and adapted the script to import them from the modulecreate_event_list
,create_gti_table
andcreate_pointing_table
tocreate_event_hdu
,create_gti_hdu
andcreate_pointing_hdu
, changed the functionality to return the HDUs, moved them tomagicctapipe/io/gadf.py
, and adapted the script to import them from the module.