FluxPointsEstimator

class gammapy.spectrum.FluxPointsEstimator(datasets, e_edges, source='', norm_min=0.2, norm_max=5, norm_n_values=11, norm_values=None, sigma=1, sigma_ul=2, reoptimize=False)[source]

Bases: object

Flux points estimator.

Estimates flux points for a given list of spectral datasets, energies 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:
datasets : list of SpectrumDatatset

Spectrum datasets.

e_edges : Quantity

Energy edges of the flux point bins.

source : str

For which source in the model to compute the flux points.

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.

reoptimize : bool

Re-optimize other free model parameters.

Attributes Summary

e_groups Energy grouping table Table
ref_model

Methods Summary

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

Attributes Documentation

e_groups

Energy grouping table Table

ref_model

Methods Documentation

estimate_counts(self)[source]

Estimate counts for the flux point.

Returns:
result : dict

Dict with an array with one entry per dataset with counts for the flux point.

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

Estimate flux point for a single energy group.

Parameters:
e_group : Row

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(self)[source]

Fit norm of the flux point.

Returns:
result : dict

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

estimate_norm_err(self)[source]

Estimate covariance errors for a flux point.

Returns:
result : dict

Dict with symmetric error for the flux point norm.

estimate_norm_errn_errp(self)[source]

Estimate asymmetric errors for a flux point.

Returns:
result : dict

Dict with asymmetric errors for the flux point norm.

estimate_norm_scan(self)[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(self)[source]

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

Returns:
result : dict

Dict with ts and sqrt(ts) for the flux point.

estimate_norm_ul(self)[source]

Estimate upper limit for a flux point.

Returns:
result : dict

Dict with upper limit for the flux point norm.

run(self, 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.