Chandra X-Ray Observatory
Skip to the navigation links
Last modified: April 2014

AHELP for CIAO 4.9


Context: contrib


Convert between the different coordinate systems of an image.


tr = SimpleCoordTransform(input)
(xout, yout) = tr.convert(fromsys, tosys, xin, yin)


The SimpleCoordTransform class allows you to easily convert between the different coordinate systems of a CIAO-produced image (it may work on some non-CIAO data).

Loading the routine

The routine can be loaded into a ChIPS or Sherpa session by saying:

from crates_contrib.utils import *

Coordinate conversion

An object is created using the SimpleCoordTransform constructor, which takes a single argument: the name of an image file or an image crate. The object has a single method - convert - which can then be used to convert between one of three coordinate systems: world, physical, or logical.

The fromsys and tosys arguments define the input and output coordinate systems respectivelty and can be one of:

The fromsys and tosys arguments

Value Description
"world" or "eqpos" The WCS coordinate systems supported by CIAO
"physical" or "sky" The physical coordinate system
"logical" or "image" The logical coordinate system

The xin and yin arguments can be of a single point or multiple points.

Example 1

chips> tr = SimpleCoordTransform("img.fits")
chips> (r0, d0) = tr.convert("sky", "world", 4096.5, 4096.5)

Here the sky coordinate (4096.5, 4096.5) is converted into Ra and Dec coordinates (assuming the "world" system represents an equatorial coordinate system).

Example 2

chips> tcr = read_file("sources.fits[cols ra,dec]")
chips> ra = copy_colvals(tcr, "ra")
chips> dec = copy_colvals(tcr, "dec")
chips> icr = read_file("img.fits")
chips> tr = SimpleCoordTransform("img.fits")
chips> (x, y) = tr.convert("world", "image", ra, dec)
chips> add_image(icr, ["wcs", "logical"])
chips> add_points(x, y, ["symbol", "square", "fill", False])

Here Ra and Dec coordiantes from the file "sources.fits" are converted into image (a.k.a. logical) coordinates of the image stored in img.fits. They are then drawn, as open squares, on top of the image using ChIPS.


Coordinate-system support

The coordinate-transform code has been written and tested for use with images created by CIAO tools. Please let the CXC HelpDesk know if it does not work for your image file(s).

Changes in the scripts 4.6.4 (April 2014) release

The error where SimpleCoordTransform would fail, claiming that it was "Unable to find the world system", has been fixed.


See the bug pages on the CIAO website for an up-to-date listing of known bugs.

Refer to the CIAO bug pages for an up-to-date listing of known issues.

Last modified: April 2014
Smithsonian Institute Smithsonian Institute

The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory. 60 Garden Street, Cambridge, MA 02138 USA.   Email: Smithsonian Institution, Copyright © 1998-2017. All rights reserved.