LabelMapAxis#
- class gammapy.maps.LabelMapAxis(labels, name='')[source]#
Bases:
object
Map axis using labels
- Parameters
- labelslist of str
Labels to be used for the axis nodes.
- namestr
Name of the axis.
Attributes Summary
Deprecated since version 1.1.
Plot labels
Plot labels
Plot labels
Plot labels
Bin width is unity
Center of the label axis
Edges of the label axis
Edges of the label axis
Edges of the label axis
Name of the axis
Number of bins
Unit
Methods Summary
assert_name
(required_name)Assert axis name if a specific one is required.
concatenate
(axis)Concatenate another
LabelMapAxis
to thisLabelMapAxis
into a newLabelMapAxis
object.coord_to_idx
(coord, **kwargs)Transform labels to indices
coord_to_pix
(coord)Transform from axis labels to pixel coordinates.
copy
()Copy axis
downsample
(*args, **kwargs)Downsample axis
Format plot axis.
from_stack
(axes)Create a label map axis by merging a list of axis.
from_table
(table[, format, idx])Create time map axis from table
is_allclose
(other, **kwargs)Check if other map axis is all close.
pad
(*args, **kwargs)Resample axis
pix_to_coord
(pix)Transform from pixel to axis coordinates.
pix_to_idx
(pix[, clip])Convert pix to idx
resample
(*args, **kwargs)Resample axis
slice
(idx)Create a new axis object by extracting a slice from this axis.
squash
()Create a new axis object by squashing the axis into one bin.
to_header
([format, idx])Create FITS header
upsample
(*args, **kwargs)Upsample axis
Attributes Documentation
- append#
Deprecated since version 1.1: The append attribute is deprecated and may be removed in a future version. Use concatenate instead.
- as_plot_center#
Plot labels
- as_plot_edges#
Plot labels
- as_plot_labels#
Plot labels
- as_plot_xerr#
Plot labels
- bin_width#
Bin width is unity
- center#
Center of the label axis
- edges#
Edges of the label axis
- edges_max#
Edges of the label axis
- edges_min#
Edges of the label axis
- name#
Name of the axis
- nbin#
Number of bins
- node_type = 'label'#
- unit#
Unit
Methods Documentation
- assert_name(required_name)[source]#
Assert axis name if a specific one is required.
- Parameters
- required_namestr
Required
- concatenate(axis)[source]#
Concatenate another
LabelMapAxis
to thisLabelMapAxis
into a newLabelMapAxis
object.Names must agree between the axes. labels must be unique.
- Parameters
- axis
LabelMapAxis
Axis to concatenate with.
- axis
- Returns
- axis
LabelMapAxis
Concatenation of the two axis.
- axis
- coord_to_idx(coord, **kwargs)[source]#
Transform labels to indices
If the label is not present an error is raised.
- format_plot_xaxis(ax)[source]#
Format plot axis.
- Parameters
- ax
Axis
Plot axis to format.
- ax
- Returns
- ax
Axis
Formatted plot axis.
- ax
- classmethod from_stack(axes)[source]#
Create a label map axis by merging a list of axis.
- Returns
- axis
LabelMapAxis
Merged axis.
- axis
- classmethod from_table(table, format='gadf', idx=0)[source]#
Create time map axis from table
- Parameters
- table
Table
Bin table HDU
- format{“gadf”}
Format to use.
- table
- Returns
- axis
TimeMapAxis
Time map axis.
- axis
- is_allclose(other, **kwargs)[source]#
Check if other map axis is all close.
- Parameters
- other
LabelMapAxis
Other map axis
- other
- Returns
- is_allclosebool
Whether other axis is allclose
- slice(idx)[source]#
Create a new axis object by extracting a slice from this axis.
- Parameters
- idxslice
Slice object selecting a subselection of the axis.
- Returns
- axis
LabelMapAxis
Sliced axis object.
- axis
- squash()[source]#
Create a new axis object by squashing the axis into one bin.
The label of the new axis is given as “first-label…last-label”.
- Returns
- axis
MapAxis
Sliced axis object.
- axis