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

Fix SensitivityEstimator after IRF API change #1998

Merged
merged 10 commits into from Jan 23, 2019

Conversation

@registerrier
Copy link
Contributor

@registerrier registerrier commented Jan 22, 2019

This PR is replacing the dependency of SensitivityEstimator on the old CTAPerf object. The EffectiveAreaTable (e.g. arf), the EnergyDispersion (e.g. rmf) are explicitly passed. The background model is passed as a CountsSpectrum for now. In the future, a SpectralBackgroundModel should be used instead once it is correctly implemented in the Datasets framework.
This should solve #1517 .

The modified cta_sensitivity notebook will come in another PR (to solve issue #1943 and #1824 ).

@registerrier registerrier added this to the 0.10 milestone Jan 22, 2019
@registerrier registerrier self-assigned this Jan 22, 2019
@registerrier registerrier requested a review from adonath Jan 22, 2019
Copy link
Member

@adonath adonath left a comment

Thanks @registerrier for fixing this class, I've left a few in-line comments. API wise I'd prefer if the .run() just returned the table. There is no advantage in storing the result on the class, if it's not needed anymore. It also requires an extra line of code to get the result...

@@ -35,7 +39,6 @@ class SensitivityEstimator(object):
--------
Compute and plot a sensitivity curve for CTA::
from gammapy.irf import CTAPerf
Copy link
Member

@adonath adonath Jan 23, 2019

You removed the import statement here, but the rest of the example still uses CTAPerf. Either fix the example or remove it completely and link to the notebook instead? Both options are fine by me...

Copy link
Contributor Author

@registerrier registerrier Jan 23, 2019

I removed the example. You can't show how this works in only 4 lines of code now.

rmf : `~gammapy.irf.EnergyDispersion`
energy dispersion table
bkg : `~gammapy.spectrum.CountsSpectrum`
the background array
livetime : `~astropy.units.Quantity`
Livetime (object with the units of time), e.g. 5*u.h
slope : float, optional
Copy link
Member

@adonath adonath Jan 23, 2019

Maybe take and instance of SpectrumModel instead? Or at least call it index? I think slope is nowhere used in Gammapy.

Copy link
Contributor Author

@registerrier registerrier Jan 23, 2019

Well, only power laws are meaningful and the choice of normalisation units has an impact on the unit of the result. Since index is the only free parameter I just changed slope to index

@cdeil cdeil changed the title Modify spectum.sensitivity to use a CountsSpectrum as input background model Fix SensitivityEstimator after IRF API change Jan 23, 2019
@registerrier registerrier merged commit ad9ff3e into gammapy:master Jan 23, 2019
4 checks passed
@registerrier registerrier deleted the sensitivity branch Dec 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants