Chandra X-Ray Observatory
	(CXC)
Skip to the navigation links
Last modified: March 2015

URL: http://cxc.harvard.edu/ciao/ahelp/coords_chandra.html
AHELP for CIAO 4.9

coords_chandra

Context: contrib

Synopsis

Utility routines for working with Chandra Coordinates

Syntax

from coords.chandra import cel_to_chandra
from coords.chandra import sky_to_chandra

Description

The coords.chandra module contains two routines to convert either a list of SKY(X,Y) or a list of celestial (RA,Dec) values to the most common Chandra coordinate systems: detector (detx, dety) mirror spherical (aka off-axis angles theta and phi) and chip coordinates.

The input to each routine is a dictionary of header keywords that can be retrieved from the input file something like:

>>> from pycrates import read_file
>>> myfile = read_file(infile)
>>> key_names = myfile.get_keynames()
>>> key_vals = [ myfile.get_key_value(x) for x in key_names ]
>>> keywords = dict(zip(key_names, key_vals ))

Example 1

>>> from coords.chandra import sky_to_chandra
>>> print sky_to_chandra( keywords, 4096.5, 4096.5)
{'dety': [4096.5], 'detx': [4096.5], 'phi': [0.0], 'ra':
[246.82474880852999], 'chipy': [996.6745464316374], 'chip_id': [3],
'theta': [0.0], 'chipx': [975.2463325198958], 'dec':
[-24.573378630717002], 'pixsize': 0.492}

In this example a single set of sky X,Y values is input and the coordinate values are simply printed to the terminal. Note: the order of the values may be different.

Example 2

>>> from coords.chandra import cel_to_chandra
>>> from pycrates import read_file
>>> from pychips.hlui import *
>>> srclist = read_file("wavedetect.src")
>>> keywords = dict( [ (x,srclist.get_key_value(x)) for x in
srclist.get_keynames()] )
>>> ra = srclist.get_column("RA").values
>>> dec = srclist.get_column("DEC").values
>>> coords = cel_to_chandra( keywords, ra, dec )
>>> add_curve( coords["x"], coords["y"], "line.style=none" )
>>> print coords.keys()
['dety', 'detx', 'phi', 'chip_id', 'chipy', 'x', 'y', 'theta', 'chipx',
'pixsize']

In this longer example the RA and DEC values for each source in a wavdetect source list is read in using pycrates. The Chandra coordinates are computed for all the source positions. The sky X and Y values, returned as lists , are then plotted with ChIPS.

The pixsize value is the only value not returned as a list. It is in units of arcsec/pixel.

About Contributed Software

This module is not an official part of the CIAO release but is made available as "contributed" software via the CIAO scripts page. Please see this page for installation instructions.

See Also

contrib
coords_format, coords_utils, identify_name

Last modified: March 2015
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:   cxchelp@head.cfa.harvard.edu Smithsonian Institution, Copyright © 1998-2017. All rights reserved.