read_image
- sherpa.astro.io.read_image(arg, coord: str = 'logical', dstype: ~typing.Type[~sherpa.data.Data2D] = <class 'sherpa.astro.data.DataIMG'>) Data2D [source] [edit on github]
Create an image dataset from a file.
Changed in version 4.16.0: Setting coord to a value other than ‘logical’ will now correctly change the coordinate setting for
DataIMG
datasets.- Parameters:
arg – The name of the file or a representation of the file (the type depends on the I/O backend).
coord ({'logical', 'physical', 'world'}, optional) – The type of axis coordinates to use. An error is raised if the file does not contain the necessary metadata for the selected coordinate system or the selected dstype does not support it.
dstype (optional) – The data type to create (it is expected to follow the
sherpa.data.Data
interface).
- Returns:
data
- Return type:
a sherpa.data.Data derived object
See also
Examples
The following examples do not contain argument types specific to a particular I/O backend.
Create a
sherpa.astro.data.DataIMG
object from the FITS fileimg.fits
:>>> d = read_image('img.fits')
Select the physical coordinate system from the file:
>>> d = read_image('img.fits', coord='physical')