FluxPointEstimator

class gammapy.spectrum.FluxPointEstimator(obs, groups, model, norm_min=0.2, norm_max=5, norm_n_values=11, norm_values=None, sigma=1, sigma_ul=2)[source]

Bases: object

Flux point estimator.

Estimates flux points for a given spectrum observation dataset, energy groups and spectral model.

To estimate the flux point the amplitude of the reference spectral model is fitted within the energy range defined by the energy group. This is done for each group independently. The amplitude is re-normalized using the “norm” parameter, which specifies the deviation of the flux from the reference model in this energy group. See https://gamma-astro-data-formats.readthedocs.io/en/latest/spectra/binned_likelihoods/index.html for details.

The method is also described in the FERMI-LAT catalog paper https://ui.adsabs.harvard.edu/#abs/2015ApJS..218…23A or the HESS Galactic Plane Survey paper https://ui.adsabs.harvard.edu/#abs/2018A%26A…612A…1H

Parameters:

obs : SpectrumObservation or SpectrumObservationList

Spectrum observation(s)

groups : SpectrumEnergyGroups

Energy groups (usually output of SpectrumEnergyGroupMaker)

model : SpectralModel

Global model (usually output of SpectrumFit)

norm_min : float

Minimum value for the norm used for the likelihood profile evaluation.

norm_max : float

Maximum value for the norm used for the likelihood profile evaluation.

norm_n_values : int

Number of norm values used for the likelihood profile.

norm_values : numpy.ndarray

Array of norm values to be used for the likelihood profile.

sigma : int

Sigma to use for asymmetric error computation.

sigma_ul : int

Sigma to use for upper limit computation.

Attributes Summary

ref_model

Methods Summary

estimate_flux_point(e_group[, steps]) Estimate flux point for a single energy group.
estimate_norm() Fit norm of the flux point.
estimate_norm_err() Estimate covariance errors for a flux point.
estimate_norm_errn_errp() Estimate asymmetric errors for a flux point.
estimate_norm_scan(flux_point) Estimate likelihood profile for the norm parameter
estimate_norm_ts() Estimate ts and sqrt(ts) for the flux point.
estimate_norm_ul() Estimate upper limit for a flux point.
run([steps]) Run the flux point estimator for all energy groups.

Attributes Documentation

ref_model

Methods Documentation

estimate_flux_point(e_group, steps='all')[source]

Estimate flux point for a single energy group.

Parameters:

e_group : SpectrumEnergyGroup

Energy group to compute the flux point for.

steps : list of str

Which steps to execute. Available options are:

  • “err”: estimate symmetric error.
  • “errn-errp”: estimate asymmetric errors.
  • “ul”: estimate upper limits.
  • “ts”: estimate ts and sqrt(ts) values.
  • “norm-scan”: estimate likelihood profiles.

By default all steps are executed.

Returns:

result : dict

Dict with results for the flux point.

estimate_norm()[source]

Fit norm of the flux point.

Returns:

result : dict

Dict with “norm” and “loglike” for the flux point.

estimate_norm_err()[source]

Estimate covariance errors for a flux point.

Returns:

result : dict

Dict with symmetric error for the flux point norm.

estimate_norm_errn_errp()[source]

Estimate asymmetric errors for a flux point.

Returns:

result : dict

Dict with asymmetric errors for the flux point norm.

estimate_norm_scan(flux_point)[source]

Estimate likelihood profile for the norm parameter

Returns:

result : dict

Dict with norm_scan and dloglike_scan for the flux point.

estimate_norm_ts()[source]

Estimate ts and sqrt(ts) for the flux point.

Returns:

result : dict

Dict with ts and srtq_ts for the flux point.

estimate_norm_ul()[source]

Estimate upper limit for a flux point.

Returns:

result : dict

Dict with upper limit for the flux point norm.

run(steps='all')[source]

Run the flux point estimator for all energy groups.

Returns:

flux_points : FluxPoints

Estimated flux points.

steps : list of str

Which steps to execute. See estimate_flux_point for details and available options.