| AHELP for CIAO 4.4 | transform |
Context: transform |
Synopsis
TRANSFORMS - A Python interface for the Transform library
Description
TRANSFORMS is a software package developed by the Chandra X-Ray Center (CXC) to provide a means of applying mathematical operations to data in order to convert it from one reference frame to another. Various Transform objects can be strung together to create complex operations.
The library can be used as a standalone system, and is incorporated into the CRATES package to support the generation and use of "virtual" data objects (see "ahelp cratedata"). To date, there are two Transform flavors:
- LINEAR2DTransfrom - 2D affine transform
- WCSTAN - WCS Tangent plane projection
There are help files for each of the Transform commands:
"ahelp -c transform"
Example
chips> from pytransform import *
chips> cr = read_file("img.fits")
chips> img = get_piximgvals(cr)
chips> sky = get_transform(cr, "sky")
chips> eqpos = get_transform(cr, "eqpos")
chips> (yi, xi) = np.where(img == img.max())
chips> plog = np.column_stack((xi, yi)) + 1.0
chips> psky = apply_transform(sky, plog)
chips> peqpos = apply_transform(eqpos, psky)Here we get the coordinates of the maximum value in the image in the 1D numpy arrays xi and yi. As the apply_transform routine requires a single array, we use the column_stack routine from NumPy to combine the two arrays, adding on 1.0 to
- convert from the 0-based scheme used by NumPy to the 1-based scheme used by the logical coordinate system,
- and convert from an integer value to floating-point, since apply_transform uses the data type of the input coordinates for its output values.
The comparison of xi, yi and plog for this particular dataset looks like:
chips> print(xi) [1030] chips> print(yi) [398] chips> print(plog) [[ 1031. 399.]]
The psky values are the SKY coordinates corresponding to this location are:
chips> print(psky) [[ 4069.5 3945.5]]
and the equatorial coordinates are:
chips> print(peqpos) [[ 116.07298861 37.88802783]]
Changes in CIAO 4.4
The pytransform module is no longer included as part of pycrates, so you either have to import it directly by saying
chips> import pytransform
or, if you have loaded pycrates as a named module, use the instance it provides:
>>> import pycrates as pyc
and then you can use pyc.apply_transform.
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.

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