|AHELP for CIAO 4.9||
Read in the contours from a ds9 *.con file with optional coordinate conversion.
(xs, ys) = read_ds9_contours(filename [, coords=None, fromsys=None, tosys=None])
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).
The add_ds9_contours routine from the chips_contrib.utils module can be used to display a DS9 contour file in ChIPS.
The routine can be loaded into a ChIPS or Sherpa session by saying:
from crates_contrib.utils import *
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
|"world" or "eqpos"||The WCS coordinate systems supported by CIAO|
|"physical" or "sky"||The physical coordinate system|
|"logical" or "image"||The logical coordinate system|
(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.
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.
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).
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).
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.