unpack_image

sherpa.astro.ui.unpack_image(arg, coord='logical', dstype=<class 'sherpa.astro.data.DataIMG'>)

Create an image data structure.

Parameters:
  • arg – Identify the data: a file name, or a data structure representing the data to use, as used by the I/O backend in use by Sherpa: an IMAGECrate for crates, as used by CIAO, or a list of AstroPy HDU objects.
  • coord ({ 'logical', 'image', 'physical', 'world', 'wcs' }, optional) – Ensure that the image contains the given coordinate system.
  • dstype (optional) – The image class to use. The default is DataIMG.
Returns:

The class of the returned object is controlled by the dstype parameter.

Return type:

img

Raises:

sherpa.utils.err.DataErr – If the image does not contain the requested coordinate system.

See also

load_image()
Load an image as a data set.
set_data()
Set a data set.

Examples

>>> img1 = unpack_img("img.fits")
>>> set_data(img1)
>>> img = unpack_img('img.fits', 'physical')

Read in an image using Crates:

>>> cr = pycrates.read_file('broad.img')
>>> idata = unpack_img(cr)

Read in an image using AstroPy:

>>> hdus = astropy.io.fits.open('broad.img')
>>> idata = unpack_img(hdus)