-
Notifications
You must be signed in to change notification settings - Fork 77
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 of post_DL3_analysis notebook #1262
base: main
Are you sure you want to change the base?
Conversation
Made the Content Summary consistent with the actual contents. Changed excess vs. sqrt(t) to excess vs. t (which is what is meaningful for a steady flux). Moved all the light curve calculations after the SED ones. It is not needed to re-do everything just to change the light curve energy range.
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1262 +/- ##
=======================================
Coverage 73.05% 73.05%
=======================================
Files 134 134
Lines 14039 14039
=======================================
Hits 10256 10256
Misses 3783 3783 ☔ View full report in Codecov by Sentry. |
This has been tested with the 2024 LST analysis school Crab data under |
@@ -1,36 +1,58 @@ | |||
{ |
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.
Line #10. region_finder = WobbleRegionsFinder(n_off_regions=1)
I would add a comment on the usage of more off regions. Depending on the maximum value allowed for RAD_MAX_2D, Gammapy will not allow using more off regions since at low energy they will overlap. One way to overcome this problem is to restrict the value if theta angular cut up to a maximum value (e.g. 0.2 deg)
Reply via ReviewNB
@@ -1,36 +1,58 @@ | |||
{ |
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.
Line #1. # Maker for safe energy range for the events.
Add that can be based on the effective area, energy bias, etc
Reply via ReviewNB
@@ -1,36 +1,58 @@ | |||
{ |
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.
@@ -1,36 +1,58 @@ | |||
{ |
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.
Line #2. # NOTE: you need to have write permission in the directory of the DL3 files!
or rather use a different location for storing the output files
Reply via ReviewNB
@@ -1,36 +1,58 @@ | |||
{ |
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.
Line #6. This method is further explained in doi:10.1088/0004-637X/707/2/1310
Add comment: In Gammapy 1.2 it is possible to calculate the pivot energy for any spectral model not just for the power law.
Reply via ReviewNB
@@ -1,36 +1,58 @@ | |||
{ |
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.
As of Gammapy 1.1 models can be stored serialized in YAML format, no need to longer rely on pickle to write read the models.
stacked_dataset.models.write("sed_model.yml")
which will also produce the "sed_model_covariance.yml" file at the same time.
To read it back:
from gammapy.modeling.models import Models # Read back stored best-fit model best_model = Models.read("sed_model.yml")
Reply via ReviewNB
@@ -1,36 +1,58 @@ | |||
{ |
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.
Line #5. fits.BinTableHDU(flux_points.to_table(), name="SED"),
One can also do directly:
flux_points.write("filename_flux_points.fits", sed_type="e2dnde", format="gadf-sed", overwrite=True) lc_1d.write("filename_lightcurve.fits", sed_type="flux", format="lightcurve")
to store the SED and LC flux points separatelly.
Reply via ReviewNB
I'll implement the comments |
@morcuended did you do those changes? Were they related to the changes I introduced, or just general improvements of the notebook? (if the latter they should be in another PR for clarity) |
I have to go through it again. I will probably do the changes in another PR to not keep this pending forever |
A bit of clean-up.
Made the Content Summary consistent with the actual contents.
Changed excess vs. sqrt(t) to excess vs. t (which is what is meaningful for a steady flux).
Moved all the light curve calculations after the SED ones. It is not needed to re-do everything just to change the light curve energy range.