MapAxes¶
-
class
gammapy.maps.
MapAxes
(axes)[source]¶ Bases:
collections.abc.Sequence
MapAxis container class.
- Parameters
- axeslist of
MapAxis
List of map axis objects.
- axeslist of
Attributes Summary
Names of the axes
Shape of the axes
Methods Summary
coord_to_idx
(coord[, clip])Transform from axis to pixel indices.
coord_to_pix
(coord)Transform from axis to pixel coordinates.
count
(value)downsample
(factor, axis_name)Downsample axis by a given factor
drop
(axis_name)Drop an axis.
from_default
(axes)Make a sequence of
MapAxis
objects.from_table_hdu
(hdu[, format])Create MapAxes from BinTableHDU
index
(axis_name)Get index in list
index_data
(axis_name)Get data index of the axes
pix_to_coord
(pix)Convert pixel coordinates to map coordinates.
resample
(axis)Resample axis binning.
slice_by_idx
(slices)Create a new geometry by slicing the non-spatial axes.
squash
(axis_name)Squash axis.
to_header
([header])Convert axes to FITS header
to_table
([format])Convert axes to table
to_table_hdu
([format, prefix])Make FITS table columns for map axes.
upsample
(factor, axis_name)Upsample axis by a given factor
Attributes Documentation
-
names
¶ Names of the axes
-
shape
¶ Shape of the axes
Methods Documentation
-
count
(value) → integer -- return number of occurrences of value¶
-
downsample
(factor, axis_name)[source]¶ Downsample axis by a given factor
- Parameters
- factorint
Upsampling factor.
- axis_namestr
Axis to upsample.
- Returns
- axes
MapAxes
Map axes
- axes
-
drop
(axis_name)[source]¶ Drop an axis.
- Parameters
- axis_namestr
Name of the axis to remove.
- Returns
- axes
MapAxes
Axes with squashed axis.
- axes
-
index_data
(axis_name)[source]¶ Get data index of the axes
- Parameters
- axis_namestr
Name of the axis.
- Returns
- idxint
Data index
-
pix_to_coord
(pix)[source]¶ Convert pixel coordinates to map coordinates.
- Parameters
- pixtuple
Tuple of pixel coordinates.
- Returns
- coordstuple
Tuple of map coordinates.
-
resample
(axis)[source]¶ Resample axis binning.
This method groups the existing bins into a new binning.
-
squash
(axis_name)[source]¶ Squash axis.
- Parameters
- axis_namestr
Axis to squash.
- Returns
- axes
MapAxes
Axes with squashed axis.
- axes
-
to_table
(format=None)[source]¶ Convert axes to table
- Parameters
- format{“gadf-dl3”}
Format to use.
- Returns
- table
Table
Table with axis data
- table
-
to_table_hdu
(format=None, prefix=None)[source]¶ Make FITS table columns for map axes.
- Parameters
- format{“gadf”, “fgst-ccube”, “fgst-template”}
Format to use.
- prefixstr
HDU name prefix to use
- Returns
- hdu
BinTableHDU
Bin table HDU.
- hdu