SpectrumExtraction¶
-
class
gammapy.spectrum.
SpectrumExtraction
(obs_list, bkg_estimate, e_reco=None, e_true=None, containment_correction=False, max_alpha=1)[source]¶ Bases:
object
Creating input data to 1D spectrum fitting
This class is responsible for extracting a
SpectrumObservation
from aDataStoreObservation
. The background estimation is done beforehand, using e.g. theReflectedRegionsBackgroundEstimator
. For point sources analyzed with ‘full containment’ IRFs, a correction for PSF leakage out of the circular ON region can be applied. For more info see Spectral Fitting. For a usage example see spectrum_analysis.ipynbParameters: obs_list :
ObservationList
Observations to process
bkg_estimate :
BackgroundEstimate
Background estimate, e.g. of
ReflectedRegionsBackgroundEstimator
e_reco :
Quantity
, optionalReconstructed energy binning
e_true :
Quantity
, optionalTrue energy binning
containment_correction : bool
Apply containment correction for point sources and circular on regions.
max_alpha : float
Maximum alpha value to accept, if the background was estimated using reflected regions this is 1 / minimum number of regions.
Attributes Summary
DEFAULT_RECO_ENERGY
Reconstruced energy axis to be used if not specified otherwise DEFAULT_TRUE_ENERGY
True energy axis to be used if not specified otherwise Methods Summary
apply_containment_correction
(obs, bkg)Apply containment correction define_energy_threshold
([method_lo_threshold])Set energy threshold extract_counts
(bkg)Fill on and off vector for one observation extract_irfs
(obs)Extract IRFs make_empty_vectors
(obs, bkg)Create empty vectors process
(obs, bkg)Process one observation run
([outdir, use_sherpa])Run all steps write
(outdir[, ogipdir, use_sherpa])Write results to disk Attributes Documentation
-
DEFAULT_RECO_ENERGY
= <Quantity [ 1.00000000e-02, 1.13646367e-02, 1.29154967e-02, 1.46779927e-02, 1.66810054e-02, 1.89573565e-02, 2.15443469e-02, 2.44843675e-02, 2.78255940e-02, 3.16227766e-02, 3.59381366e-02, 4.08423865e-02, 4.64158883e-02, 5.27499706e-02, 5.99484250e-02, 6.81292069e-02, 7.74263683e-02, 8.79922544e-02, 1.00000000e-01, 1.13646367e-01, 1.29154967e-01, 1.46779927e-01, 1.66810054e-01, 1.89573565e-01, 2.15443469e-01, 2.44843675e-01, 2.78255940e-01, 3.16227766e-01, 3.59381366e-01, 4.08423865e-01, 4.64158883e-01, 5.27499706e-01, 5.99484250e-01, 6.81292069e-01, 7.74263683e-01, 8.79922544e-01, 1.00000000e+00, 1.13646367e+00, 1.29154967e+00, 1.46779927e+00, 1.66810054e+00, 1.89573565e+00, 2.15443469e+00, 2.44843675e+00, 2.78255940e+00, 3.16227766e+00, 3.59381366e+00, 4.08423865e+00, 4.64158883e+00, 5.27499706e+00, 5.99484250e+00, 6.81292069e+00, 7.74263683e+00, 8.79922544e+00, 1.00000000e+01, 1.13646367e+01, 1.29154967e+01, 1.46779927e+01, 1.66810054e+01, 1.89573565e+01, 2.15443469e+01, 2.44843675e+01, 2.78255940e+01, 3.16227766e+01, 3.59381366e+01, 4.08423865e+01, 4.64158883e+01, 5.27499706e+01, 5.99484250e+01, 6.81292069e+01, 7.74263683e+01, 8.79922544e+01, 1.00000000e+02] TeV>¶ Reconstruced energy axis to be used if not specified otherwise
-
DEFAULT_TRUE_ENERGY
= <Quantity [ 1.00000000e-02, 1.10069417e-02, 1.21152766e-02, 1.33352143e-02, 1.46779927e-02, 1.61559810e-02, 1.77827941e-02, 1.95734178e-02, 2.15443469e-02, 2.37137371e-02, 2.61015722e-02, 2.87298483e-02, 3.16227766e-02, 3.48070059e-02, 3.83118685e-02, 4.21696503e-02, 4.64158883e-02, 5.10896977e-02, 5.62341325e-02, 6.18965819e-02, 6.81292069e-02, 7.49894209e-02, 8.25404185e-02, 9.08517576e-02, 1.00000000e-01, 1.10069417e-01, 1.21152766e-01, 1.33352143e-01, 1.46779927e-01, 1.61559810e-01, 1.77827941e-01, 1.95734178e-01, 2.15443469e-01, 2.37137371e-01, 2.61015722e-01, 2.87298483e-01, 3.16227766e-01, 3.48070059e-01, 3.83118685e-01, 4.21696503e-01, 4.64158883e-01, 5.10896977e-01, 5.62341325e-01, 6.18965819e-01, 6.81292069e-01, 7.49894209e-01, 8.25404185e-01, 9.08517576e-01, 1.00000000e+00, 1.10069417e+00, 1.21152766e+00, 1.33352143e+00, 1.46779927e+00, 1.61559810e+00, 1.77827941e+00, 1.95734178e+00, 2.15443469e+00, 2.37137371e+00, 2.61015722e+00, 2.87298483e+00, 3.16227766e+00, 3.48070059e+00, 3.83118685e+00, 4.21696503e+00, 4.64158883e+00, 5.10896977e+00, 5.62341325e+00, 6.18965819e+00, 6.81292069e+00, 7.49894209e+00, 8.25404185e+00, 9.08517576e+00, 1.00000000e+01, 1.10069417e+01, 1.21152766e+01, 1.33352143e+01, 1.46779927e+01, 1.61559810e+01, 1.77827941e+01, 1.95734178e+01, 2.15443469e+01, 2.37137371e+01, 2.61015722e+01, 2.87298483e+01, 3.16227766e+01, 3.48070059e+01, 3.83118685e+01, 4.21696503e+01, 4.64158883e+01, 5.10896977e+01, 5.62341325e+01, 6.18965819e+01, 6.81292069e+01, 7.49894209e+01, 8.25404185e+01, 9.08517576e+01, 1.00000000e+02, 1.10069417e+02, 1.21152766e+02, 1.33352143e+02, 1.46779927e+02, 1.61559810e+02, 1.77827941e+02, 1.95734178e+02, 2.15443469e+02, 2.37137371e+02, 2.61015722e+02, 2.87298483e+02, 3.16227766e+02] TeV>¶ True energy axis to be used if not specified otherwise
Methods Documentation
-
apply_containment_correction
(obs, bkg)[source]¶ Apply containment correction
Parameters: obs :
DataStoreObservation
observation
bkg :
BackgroundEstimate
background esimate
-
define_energy_threshold
(method_lo_threshold='area_max', **kwargs)[source]¶ Set energy threshold
Set the high and low energy threshold for each observation based on a chosen method.
Available methods for setting the low energy threshold
- area_max : Set energy threshold at x percent of the maximum effective area (x given as kwargs[‘percent’])
Available methods for setting the high energy threshold
- TBD
Parameters: method_lo_threshold : {‘area_max’}
method for defining the low energy threshold
-
extract_counts
(bkg)[source]¶ Fill on and off vector for one observation
Parameters: bkg :
BackgroundEstimate
background esimate
-
extract_irfs
(obs)[source]¶ Extract IRFs
Parameters: obs :
DataStoreObservation
observation
-
make_empty_vectors
(obs, bkg)[source]¶ Create empty vectors
This method copies over all meta info and sets up the energy binning
Parameters: obs :
DataStoreObservation
observation
bkg :
BackgroundEstimate
background esimate
-