SpectrumDataset

class gammapy.spectrum.SpectrumDataset(model, counts=None, livetime=None, mask=None, aeff=None, edisp=None, background=None)[source]

Bases: gammapy.utils.fitting.Dataset

Compute spectral model fit statistic on a CountsSpectrum.

Parameters:
model : SpectralModel

Fit model

counts : CountsSpectrum

Counts spectrum

livetime : float

Livetime

mask : ndarray

Mask to apply to the likelihood.

aeff : EffectiveAreaTable

Effective area

edisp : EnergyDispersion

Energy dispersion

background : CountsSpectrum

Background to use for the fit.

Attributes Summary

data_shape Shape of the counts data

Methods Summary

fake([random_state]) Simulate a fake CountsSpectrum.
likelihood(parameters[, mask]) Total likelihood given the current model parameters.
likelihood_per_bin() Likelihood per bin given the current model parameters
npred() Returns npred map (model + background)

Attributes Documentation

data_shape

Shape of the counts data

Methods Documentation

fake(random_state='random-seed')[source]

Simulate a fake CountsSpectrum.

Parameters:
random_state : {int, ‘random-seed’, ‘global-rng’, RandomState}

Defines random number generator initialisation. Passed to get_random_state.

Returns:
spectrum : CountsSpectrum

the fake count spectrum

likelihood(parameters, mask=None)[source]

Total likelihood given the current model parameters.

Parameters:
mask : ndarray

Mask to be combined with the dataset mask.

likelihood_per_bin()[source]

Likelihood per bin given the current model parameters

npred()[source]

Returns npred map (model + background)