Maps#
- class gammapy.maps.Maps[source]#
Bases:
MutableMapping
A Dictionary containing Map objects sharing the same geometry.
This class simplifies handling and I/O of maps collections.
For maps with different geometries, use a regular dict.
Attributes Summary
Methods Summary
from_geom
(geom, names[, kwargs_list])Create map dictionary from a geometry.
from_hdulist
(hdulist[, hdu_bands])Create map dictionary from a HDU list.
read
(filename[, checksum])Read map dictionary from file.
to_hdulist
([hdu_bands])Convert map dictionary to list of HDUs.
write
(filename[, overwrite, checksum])Write map dictionary to file.
Attributes Documentation
Methods Documentation
- classmethod from_geom(geom, names, kwargs_list=None)[source]#
Create map dictionary from a geometry.
- Parameters:
- geom
Geom
The input geometry that will be used by all maps.
- nameslist of str
The list of all map names.
- kwargs_listlist of dict
the list of arguments to be passed to
from_geom()
.
- geom
- Returns:
- maps
Maps
Maps object.
- maps
- classmethod from_hdulist(hdulist, hdu_bands='BANDS')[source]#
Create map dictionary from a HDU list.
Because FITS keywords are case-insensitive, all key names will return as lower-case.
- classmethod read(filename, checksum=False)[source]#
Read map dictionary from file.
Because FITS keywords are case-insensitive, all key names will return as lower-case.
- Parameters:
- filenamestr
Filename to read from.
- Returns:
- maps
Maps
Maps object.
- maps
- to_hdulist(hdu_bands='BANDS')[source]#
Convert map dictionary to list of HDUs.
- Parameters:
- hdu_bandsstr, optional
Name of the HDU with the BANDS table. If set to None, each map will have its own hdu_band. Default is ‘BANDS’.
- Returns:
- hdulist
HDUList
Map dataset list of HDUs.
- hdulist
- write(filename, overwrite=False, checksum=False)[source]#
Write map dictionary to file.
- Parameters:
- filenamestr
Filename to write to.
- overwritebool, optional
Overwrite existing file. Default is False.
- checksumbool, optional
When True adds both DATASUM and CHECKSUM cards to the headers written to the file. Default is False.
- classmethod __new__(*args, **kwargs)#