SkyImageList

class gammapy.image.SkyImageList(images=None, meta=None)[source]

Bases: collections.UserList

List of SkyImage objects.

This is a simple class that provides

  • FITS I/O
  • Dict-like access by string image name keys in addition to list-like access by integer index.

Examples

Load the image collection from a FITS file:

>>> from gammapy.image import SkyImage, SkyImageList
>>> images = SkyImageList.read('$GAMMAPY_EXTRA/datasets/fermi_survey/all.fits.gz')

Which images are available?

>>> images.names

Access one image by list index or image name string key:

>>> images[0]
>>> images['counts']
>>> images['counts'].show('ds9')

Print some summary info about the images:

>>> print(images)

Remove and append an image:

>>> del images['background']
>>> images.

Attributes Summary

names List of image names.

Methods Summary

append(item)
assert_allclose(images1, images2[, check_wcs]) Assert all-close for SkyImageList.
check_required(required_images) Check if required images are present in the sky image list.
clear()
copy()
count(item)
extend(other)
from_hdu_list(hdu_list) Construct from HDUList.
index(item, *args)
insert(i, item)
pop([i])
read(filename, **kwargs) Write to FITS file.
remove(item)
reverse()
sort(*args, **kwds)
to_hdu_list() Convert to HDUList.
write(filename, **kwargs) Write to FITS file.

Attributes Documentation

names

List of image names.

Methods Documentation

append(item)
static assert_allclose(images1, images2, check_wcs=True)[source]

Assert all-close for SkyImageList.

A useful helper function to implement tests.

check_required(required_images)[source]

Check if required images are present in the sky image list.

Parameters:

required_images : list

List of names of required sky images.

clear()
copy()
count(item)
extend(other)
classmethod from_hdu_list(hdu_list)[source]

Construct from HDUList.

index(item, *args)
insert(i, item)
pop(i=-1)
classmethod read(filename, **kwargs)[source]

Write to FITS file.

kwargs are passed to astropy.io.fits.open.

remove(item)
reverse()
sort(*args, **kwds)
to_hdu_list()[source]

Convert to HDUList.

write(filename, **kwargs)[source]

Write to FITS file.

kwargs are passed to astropy.io.fits.HDUList.writeto.