SpectrumResult

class gammapy.spectrum.SpectrumResult(model, points)[source]

Bases: object

Class holding all results of a spectral analysis

Best fit model, flux points

Parameters:

model : SpectralModel

Best Fit model

points : FluxPoints, optional

Flux points

Attributes Summary

flux_point_residuals Residuals

Methods Summary

plot(energy_range[, energy_unit, flux_unit, ...]) Plot spectrum

Attributes Documentation

flux_point_residuals

Residuals

Defined as (points - model) / model

Returns:

residuals : np.array

Residuals

residuals_err : np.array

Residuals error

Methods Documentation

plot(energy_range, energy_unit='TeV', flux_unit='cm-2 s-1 TeV-1', energy_power=0, fit_kwargs={}, butterfly_kwargs={}, point_kwargs={}, fig_kwargs={})[source]

Plot spectrum

Plot best fit model, flux points and residuals

Parameters:

energy_range : Quantity

Energy range for the plot

energy_unit : str, Unit, optional

Unit of the energy axis

flux_unit : str, Unit, optional

Unit of the flux axis

energy_power : int

Power of energy to multiply flux axis with

fit_kwargs : dict, optional

butterfly_kwargs : dict, optional

forwarded to gammapy.spectrum.SpectralModel.plot_error()

point_kwargs : dict, optional

fig_kwargs : dict, optional

Returns:

ax0 : Axes

Spectrum plot axis

ax1 : Axes

Residuals plot axis