SpectrumFitResult¶
-
class
gammapy.spectrum.
SpectrumFitResult
(model, fit_range=None, statname=None, statval=None, stat_per_bin=None, npred=None, obs=None)[source]¶ Bases:
object
Result of a
SpectrumFit
.All fit results should be accessed via this class.
Parameters: model :
SpectralModel
Best-fit model
fit_range :
Quantity
Energy range of the spectral fit
statname : str, optional
Statistic used for the fit
statval : float, optional
Final fit statistic
stat_per_bin : float, optional
Fit statistic value per bin
npred : array-like, optional
Counts predicted by the fit
obs :
SpectrumObservation
Input data used for the fit
Attributes Summary
expected_source_counts
Predicted source counts ( CountsSpectrum
).fit_range
model
npred
obs
residuals
Residuals (predicted source - excess). stat_per_bin
statname
statval
Methods Summary
butterfly
([energy, flux_unit])Compute butterfly table. from_dict
(val)Create from dict. from_yaml
(filename)Create from YAML file. plot
(**kwargs)Plot counts and residuals in two panels. plot_counts
(ax)Plot predicted and detected counts. plot_residuals
(ax)Plot residuals. to_dict
()Convert to dict. to_table
([energy_unit, flux_unit])Convert to Table
.to_yaml
(filename[, mode])Write to YAML file. Attributes Documentation
-
expected_source_counts
¶ Predicted source counts (
CountsSpectrum
).
-
fit_range
¶
-
model
¶
-
npred
¶
-
obs
¶
-
residuals
¶ Residuals (predicted source - excess).
-
stat_per_bin
¶
-
statname
¶
-
statval
¶
Methods Documentation
-
butterfly
(energy=None, flux_unit='TeV-1 cm-2 s-1')[source]¶ Compute butterfly table.
Parameters: energy :
Quantity
, optionalEnergies at which to evaluate the butterfly.
flux_unit : str
Flux unit for the butterfly.
Returns: table :
Table
Butterfly info in table (cols: ‘energy’, ‘flux’, ‘flux_lo’, ‘flux_hi’)
-
classmethod
from_yaml
(filename)[source]¶ Create from YAML file.
Parameters: filename : str, Path
File to read
-
plot
(**kwargs)[source]¶ Plot counts and residuals in two panels.
Calls
plot_counts
andplot_residuals
.
-