EnergyOffsetBackgroundModel¶
-
class
gammapy.background.
EnergyOffsetBackgroundModel
(energy, offset, counts=None, livetime=None, bg_rate=None, counts_err=None, bg_rate_err=None)[source]¶ Bases:
object
EnergyOffsetArray background model.
Container class for
EnergyOffsetArray
background model (energy, offset). This class defines 3EnergyOffsetArray
of typeEnergyOffsetArray
Parameters: energy :
EnergyBounds
energy bin vector
offset :
Angle
offset bin vector
counts :
ndarray
, optionaldata array (2D): store counts.
livetime :
ndarray
, optionaldata array (2D): store livetime correction
bg_rate :
ndarray
, optionaldata array (2D): store background model
counts_err :
ndarray
, optionaldata array (2D): store errors on the counts.
bg_rate_err :
ndarray
, optionaldata array (2D): store errors on the background model
Methods Summary
compute_rate
()Compute background rate cube from count_cube and livetime_cube. fill_obs
(obs_ids, data_store[, ...])Fill events and compute corresponding livetime. from_table
(table)Create from Table
.read
(filename)Create from FITS file. smooth
()Smooth the bkg rate with a gaussian 1D kernel. to_table
()Convert to Table
.write
(filename, **kwargs)Write to FITS file. Methods Documentation
-
fill_obs
(obs_ids, data_store, excluded_sources=None, fov_radius=<Angle 2.5 deg>)[source]¶ Fill events and compute corresponding livetime.
Get data files corresponding to the observation list, histogram the counts and the livetime and fill the corresponding cube containers.
Parameters: obs_ids : list
List of observation IDs
data_store :
DataStore
Data store
excluded_sources :
Table
Table of excluded sources. Required columns: RA, DEC, Radius
fov_radius :
Angle
Field of view radius
-
smooth
()[source]¶ Smooth the bkg rate with a gaussian 1D kernel.
Calling this method modifies the
bg_rate
data member, replacing it with a smoothed version.This method uses an adaptive Poisson method to compute the smoothing Kernel width from the available counts (see code and inline comments for details).
-
to_table
()[source]¶ Convert to
Table
.Returns: table :
Table
Table containing the
EnergyOffsetBackgroundModel
: counts, livetime and bg_rate
-