WcsMap#

class gammapy.maps.WcsMap[source]#

Bases: Map

Base class for WCS map classes.

Parameters:
geomWcsGeom

A WCS geometry object.

datandarray

Data array.

Methods Summary

create([map_type, npix, binsz, width, proj, ...])

Factory method to create an empty WCS map.

from_hdulist(hdu_list[, hdu, hdu_bands, format])

Make a WcsMap object from a FITS HDUList.

to_hdu([hdu, hdu_bands, sparse])

Make a FITS HDU from this map.

to_hdulist([hdu, hdu_bands, sparse, format])

Convert to HDUList.

Methods Documentation

classmethod create(map_type='wcs', npix=None, binsz=0.1, width=None, proj='CAR', frame='icrs', refpix=None, axes=None, skydir=None, dtype='float32', meta=None, unit='')[source]#

Factory method to create an empty WCS map.

Parameters:
map_type{‘wcs’, ‘wcs-sparse’}, optional

Map type. Selects the class that will be used to instantiate the map. Default is “wcs”.

npixint or tuple or list, optional

Width of the map in pixels. A tuple will be interpreted as parameters for longitude and latitude axes. For maps with non-spatial dimensions, list input can be used to define a different map width in each image plane. This option supersedes width. Default is None.

binszfloat or tuple or list, optional

Map pixel size in degrees. A tuple will be interpreted as parameters for longitude and latitude axes. For maps with non-spatial dimensions, list input can be used to define a different bin size in each image plane. Default is 0.1.

widthfloat or tuple or list, optional

Width of the map in degrees. A tuple will be interpreted as parameters for longitude and latitude axes. For maps with non-spatial dimensions, list input can be used to define a different map width in each image plane. Default is None.

projstring, optional

Any valid WCS projection type. Default is ‘CAR’ (cartesian).

frame{“icrs”, “galactic”}, optional

Coordinate system, either Galactic (“galactic”) or Equatorial (“icrs”). Default is “icrs”.

refpixtuple, optional

Reference pixel of the projection. If None then this will be chosen to be center of the map. Default is None.

axeslist, optional

List of non-spatial axes. Default is None.

skydirtuple or SkyCoord, optional

Sky position of map center. Can be either a SkyCoord object or a tuple of longitude and latitude in degrees in the coordinate system of the map.

dtypestr, optional

Data type. Default is “float32”.

metadict, optional

Dictionary to store metadata. Default is None.

unitstr or Unit, optional

The unit of the map. Default is “”.

Returns:
mapWcsMap

A WCS map object.

classmethod from_hdulist(hdu_list, hdu=None, hdu_bands=None, format='gadf')[source]#

Make a WcsMap object from a FITS HDUList.

Parameters:
hdu_listHDUList

HDU list containing HDUs for map data and bands.

hdustr, optional

Name or index of the HDU with the map data. Default is None.

hdu_bandsstr, optional

Name or index of the HDU with the BANDS table. Default is None.

format{‘gadf’, ‘fgst-ccube’, ‘fgst-template’}, optional

FITS format convention. Default is “gadf”.

Returns:
wcs_mapWcsMap

Map object.

to_hdu(hdu='SKYMAP', hdu_bands=None, sparse=False)[source]#

Make a FITS HDU from this map.

Parameters:
hdustr, optional

The HDU extension name. Default is “SKYMAP”.

hdu_bandsstr, optional

The HDU extension name for BANDS table. Default is None.

sparsebool, optional

Set INDXSCHM to SPARSE and sparsify the map by only writing pixels with non-zero amplitude. Default is False.

Returns:
hduBinTableHDU or ImageHDU

HDU containing the map data.

to_hdulist(hdu=None, hdu_bands=None, sparse=False, format='gadf')[source]#

Convert to HDUList.

Parameters:
hdustr, optional

Name or index of the HDU with the map data. Default is None.

hdu_bandsstr, optional

Name or index of the HDU with the BANDS table. Default is None.

sparsebool, optional

Sparsify the map by only writing pixels with non-zero amplitude. Default is False.

format{‘gadf’, ‘fgst-ccube’,’fgst-template’}, optional

FITS format convention. Default is “gadf”.

Returns:
hdu_listHDUList

HDU list.

__init__(geom, data, meta=None, unit='')#
classmethod __new__(*args, **kwargs)#