FluxPoints¶
-
class
gammapy.spectrum.FluxPoints(table)[source]¶ Bases:
objectFlux point object.
For a complete documentation see SED, for an usage example see Flux point computation.
Parameters: table :
TableInput 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_maxUpper bound of energy bin. e_minLower bound of energy bin. e_refReference energy. sed_typeFlux 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 FluxPointsobject 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_maxcolumn inFluxPoints.table.Returns: e_max :
QuantityUpper bound of energy bin.
-
e_min¶ Lower bound of energy bin.
Defined by
e_mincolumn inFluxPoints.table.Returns: e_min :
QuantityLower bound of energy bin.
-
e_ref¶ Reference energy.
Defined by
e_refcolumn inFluxPoints.tableor computed as log center, ife_minande_maxcolumns are present inFluxPoints.table.Returns: e_ref :
QuantityReference 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 :
FluxPointsFlux 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 :
AxesPlotting axes object.
-
plot(ax=None, sed_type=None, energy_unit='TeV', flux_unit=None, energy_power=0, **kwargs)[source]¶ Plot flux points
Parameters: ax :
AxesAxis 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 :
AxesAxis 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
FluxPointsobject by stacking a list of existing flux points.The first
FluxPointsobject in the list is taken as a reference to infer column names and units for the stacked object.Parameters: flux_points : list of
FluxPointsobjectsList of flux points to stack.
Returns: flux_points :
FluxPointsFlux points without upper limit points.
- Format