sherpa.astro.ui.set_coord(id, coord=None)

Set the coordinate system to use for image analysis.

The default coordinate system - that is, the mapping between pixel position and coordinate value, for images (2D data sets) is ‘logical’. This function can change this setting, so that model parameters can be fit using other systems. This setting is also used by the notice2d and ignore2d series of commands.

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

  • 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’.

See also


Get the coordinate system used for image analysis.


Estimate the parameter values and ranges given the loaded data.


Exclude a spatial region from an image.


Include a spatial region of an image.


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 coord parameter. If given two un-named arguments, then they are interpreted as the id and coord parameters, respectively.

Any limits or values already set for model parameters, such as those made by guess, may need to be changed after changing the coordinate system.

The ‘logical’ system is one in which the center of the lower-left pixel has coordinates (1, 1) and the center of the top-right pixel has coordinates (nx, ny), for a nx (columns) by ny (rows) pixel image. The pixels have a side of length 1, so the first pixel covers the range x=0.5 to x=1.5 and y=0.5 to y=1.5.

The ‘physical’ and ‘world’ coordinate systems rely on FITS World Coordinate System (WCS) standard 1. The ‘physical’ system refers to a linear transformation, with possible offset, of the ‘logical’ system. The ‘world’ system refers to the mapping to a celestial coordinate system.




Change the coordinate system of the default data set to the world system (‘wcs’ is a synonym for ‘world’).

>>> set_coord('wcs')

Change the data set with the id of ‘m82’ to use the physical coordinate system.

>>> set_coord('m82', 'physical')