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

Load an image as a data set.

Changed in version 4.16.0: Setting coord to a value other than ‘logical’ will now correctly change the coordinate setting for DataIMG datasets.

  • id (int or str, optional) – The identifier for the data set to use. If not given then the default identifier is used, as returned by get_default_id.

  • arg – Identify the image 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' }) – The coordinate system to use. The ‘image’ option is the same as ‘logical’, and ‘wcs’ the same as ‘world’.

  • dstype (optional) – The data class to use. The default is DataIMG.

See also


Create a data set from array values.


Load an ASCII file as a data set.


Load a FITS binary file as a data set.


Set the coordinate system to use for image analysis.


Set a data set.


Create an image data structure.


The function does not follow the normal Python standards for parameter use, since it is designed for easy interactive use. When called with a single un-named argument, it is taken to be the arg parameter. If given two un-named arguments, then they are interpreted as the id and arg parameters, respectively. The remaining parameters are expected to be given as named arguments.


Load the image from the file “img.fits” into the default data set:

>>> load_image('img.fits')

Set the ‘bg’ data set to the contents of the file “img_bg.fits”:

>>> load_image('bg', 'img_bg.fits')

Load in the data from the file ‘src.img’ and set the coordinate system to the physical system of the file:

>>> load_image('src.img', coord='physical')