Modify sensitivity
@@ -16,8 +16,12 @@ class SensitivityEstimator(object):
Parameters
----------
- irf : `~gammapy.scripts.CTAPerf`
- IRF object
+ arf : `~gammapy.irf.EffectiveAreaTable`
+ 1D effective area
+ rmf : `~gammapy.irf.EnergyDispersion`
+ energy dispersion table
+ bkg : `~gammapy.utils.NDDataArray`
+ the background array
livetime : `~astropy.units.Quantity`
Livetime (object with the units of time), e.g. 5*u.h
slope : float, optional
@@ -35,7 +39,6 @@ class SensitivityEstimator(object):
--------
Compute and plot a sensitivity curve for CTA::
- from gammapy.irf import CTAPerf
from gammapy.spectrum import SensitivityEstimator
filename = '$GAMMAPY_DATA/cta/perf_prod2/point_like_non_smoothed/South_5h.fits.gz'
@@ -56,7 +59,9 @@ class SensitivityEstimator(object):
def __init__(
self,
- irf,
+ arf,
+ rmf,
+ bkg,
livetime,
slope=2.0,
alpha=0.2,
@@ -64,7 +69,9 @@ class SensitivityEstimator(object):
gamma_min=10.0,
bkg_sys=0.05,
):
- self.irf = irf
+ self.arf = arf
+ self.rmf = rmf
+ self.bkg = bkg
self.livetime = u.Quantity(livetime).to("s")
self.slope = slope
self.alpha = alpha
@@ -84,9 +91,9 @@ class SensitivityEstimator(object):
# TODO: let the user decide on energy binning
# then integrate bkg model and gamma over those energy bins.
- energy = self.irf.bkg.energy.log_center()
+ energy = self.rmf.e_reco.log_center()
- bkg_counts = (self.irf.bkg.data.data * self.livetime).value
+ bkg_counts = (self.bkg.data * self.livetime).value
excess_counts = excess_matching_significance_on_off(
n_off=bkg_counts / self.alpha, alpha=self.alpha, significance=self.sigma
@@ -100,7 +107,7 @@ class SensitivityEstimator(object):
# TODO: simplify the following computation
predictor = CountsPredictor(
- model, aeff=self.irf.aeff, edisp=self.irf.rmf, livetime=self.livetime
+ model, aeff=self.arf, edisp=self.rmf, livetime=self.livetime
)
predictor.run()
counts = predictor.npred.data.data.value
