| AHELP for CIAO 4.4 | read_ds9_contours |
Context: contrib |
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 a ChIPS or Sherpa session 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 |
Example 1
(xs, ys) = read_ds9_contours("ds9.con")
add_image("image.fits")
for i in range(0, len(xs))
add_line(xs[i], ys[i], ["color", "green"])
Here we read in the contours stored in the file ds9.con and then add them onto a ChIPS image as green lines. See the add_ds9_contours() routine from chips_contrib.utils for a way to automate this.
Example 2
chips> (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).
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

![[CIAO Logo]](../imgs/ciao_logo_navbar.gif)