FluxPoints¶
-
class
gammapy.spectrum.
FluxPoints
(table)[source]¶ Bases:
object
Flux point object.
For a complete documentation see SED, for an usage example see Flux point computation.
Parameters: table :
Table
Input data table, with the following minimal required columns:
- Format
'dnde'
:'dnde'
and'e_ref'
- Format
'flux'
:'flux'
,'e_min'
,'e_max'
- Format
'eflux'
:'eflux'
,'e_min'
,'e_max'
Examples
>>> from gammapy.spectrum import FluxPoints >>> filename = '$GAMMAPY_EXTRA/test_datasets/spectrum/flux_points/flux_points.fits' >>> flux_points = FluxPoints.read(filename) >>> flux_points.show()
Attributes Summary
e_max
Upper bound of energy bin. e_min
Lower bound of energy bin. e_ref
Reference energy. sed_type
Flux points sed type. Methods Summary
drop_ul
()Drop upper limit flux points. get_energy_err
([sed_type])Compute energy error for given sed type get_flux_err
([sed_type])Compute flux error for given sed type info
()Print flux points info. peek
([figsize])Show flux points. plot
([ax, sed_type, energy_unit, flux_unit, ...])Plot flux points read
(filename, **kwargs)Read flux points. stack
(flux_points)Create a new FluxPoints
object by stacking a list of existing flux points.write
(filename, **kwargs)Write flux points. Attributes Documentation
-
e_max
¶ Upper bound of energy bin.
Defined by
e_max
column inFluxPoints.table
.Returns: e_max :
Quantity
Upper bound of energy bin.
-
e_min
¶ Lower bound of energy bin.
Defined by
e_min
column inFluxPoints.table
.Returns: e_min :
Quantity
Lower bound of energy bin.
-
e_ref
¶ Reference energy.
Defined by
e_ref
column inFluxPoints.table
or computed as log center, ife_min
ande_max
columns are present inFluxPoints.table
.Returns: e_ref :
Quantity
Reference energy.
-
sed_type
¶ Flux points sed type.
Returns: sed_type : str
Can be either ‘dnde’, ‘e2dnde’, ‘flux’ or ‘eflux’.
Methods Documentation
-
drop_ul
()[source]¶ Drop upper limit flux points.
Returns: flux_points :
FluxPoints
Flux points with upper limit points removed.
Examples
from gammapy.spectrum import FluxPoints
filename = ‘$GAMMAPY_EXTRA/test_datasets/spectrum/flux_points/flux_points.fits’ flux_points = FluxPoints.read(filename)
print(flux_points) print(flux_points.drop_ul())
-
peek
(figsize=(8, 5), **kwargs)[source]¶ Show flux points.
Parameters: figsize : tuple
Figure size
kwargs : dict
Keyword arguments passed to
FluxPoints.plot()
.Returns: ax :
Axes
Plotting axes object.
-
plot
(ax=None, sed_type=None, energy_unit='TeV', flux_unit=None, energy_power=0, **kwargs)[source]¶ Plot flux points
Parameters: ax :
Axes
Axis object to plot on.
sed_type : [‘dnde’, ‘flux’, ‘eflux’]
Which sed type to plot.
energy_unit : str,
Unit
, optionalUnit of the energy axis
flux_unit : str,
Unit
, optionalUnit of the flux axis
energy_power : int
Power of energy to multiply y axis with
kwargs : dict
Keyword arguments passed to
errorbar()
Returns: ax :
Axes
Axis object
-
classmethod
read
(filename, **kwargs)[source]¶ Read flux points.
Parameters: filename : str
Filename
kwargs : dict
Keyword arguments passed to
read
.
-
classmethod
stack
(flux_points)[source]¶ Create a new
FluxPoints
object by stacking a list of existing flux points.The first
FluxPoints
object in the list is taken as a reference to infer column names and units for the stacked object.Parameters: flux_points : list of
FluxPoints
objectsList of flux points to stack.
Returns: flux_points :
FluxPoints
Flux points without upper limit points.
- Format