Synopsis
Read in the contours from a ds9 *.con file with optional coordinate conversion.
Syntax
(xs, ys) = read_ds9_contours(filename, coords=None, fromsys=None, tosys=None)
Description
This routine reads in the contours from a DS9 *.con file and returns the x and y coordinates of each component as a separate numpy array. If the coords, fromsys and tosys arguments are given then they are used to convert the values to a different coordinate system (e.g. if the values were written out in WCS but you wish to use the sky system).
Loading the routine
The routine can be loaded into Python by saying:
from crates_contrib.utils import *
Coordinate conversion
To convert the coordinate values form the file then coords should be either the name of an image file or a crate containing an image and the fromsys and tosys arguments determine what systems to use:
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 |
Examples
Example 1
>>> (xs, ys) = read_ds9_contours('ds9.con')
The contours from the file "ds9.con" are read into xs and ys arrays.
Example 2
>>> (xs, ys) = read_ds9_contours("ds9.con", "img.fits", "world", "sky")
Here the contour coordinates are read in and then converted from WCS to SKY coordinates using the coordinate axes in the image file img.fits.
Notes
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.5.2 (April 2013) release
The routine now works when asked to convert between coordinate systems (this removes the "Input must be a 2D array" error message introduced with CIAO 4.5).
Bugs
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.
See Also
- contrib
- add_ds9_contours