Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Update of post_DL3_analysis notebook #1262

wants to merge 2 commits into from

Conversation

moralejo
Copy link
Collaborator

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.

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.
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link

codecov bot commented Jun 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.05%. Comparing base (e097079) to head (3e27215).

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.
📢 Have feedback on the report? Share it here.

@moralejo
Copy link
Collaborator Author

This has been tested with the 2024 LST analysis school Crab data under /fefs/aswg/workspace/analysis-school-2024/DL3/Crab_Dec_2023

@moralejo moralejo marked this pull request as ready for review June 11, 2024 15:09
notebooks/post_DL3_analysis.ipynb Show resolved Hide resolved
notebooks/post_DL3_analysis.ipynb Show resolved Hide resolved
notebooks/post_DL3_analysis.ipynb Show resolved Hide resolved
@@ -1,36 +1,58 @@
{
Copy link
Member

@morcuended morcuended Jun 12, 2024

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 @@
{
Copy link
Member

@morcuended morcuended Jun 12, 2024

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 @@
{
Copy link
Member

@morcuended morcuended Jun 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove


Reply via ReviewNB

@@ -1,36 +1,58 @@
{
Copy link
Member

@morcuended morcuended Jun 12, 2024

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 @@
{
Copy link
Member

@morcuended morcuended Jun 12, 2024

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 @@
{
Copy link
Member

@morcuended morcuended Jun 12, 2024

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 @@
{
Copy link
Member

@morcuended morcuended Jun 12, 2024

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

@morcuended
Copy link
Member

I'll implement the comments

@moralejo
Copy link
Collaborator Author

@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)

@morcuended
Copy link
Member

morcuended commented Jul 30, 2024

I have to go through it again. I will probably do the changes in another PR to not keep this pending forever

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants