| AHELP for CIAO 4.4 | apply_transform |
Context: transform |
Synopsis
Apply a transform to the given data.
Syntax
apply_transform(transform, data)
Description
- transform - input Transform object
- data - data to be transformed
The apply_transform command applies the transform to the provided data.
The command assumes that the data is appropriate for the transform definition. That is, if the transform is a simple scale, the data may be a list of scalars. If the transform expects a list of coordinate pairs, the input data must be a list of pairs.
Example 1
chips> from pytransform import *
chips> cr = read_file("evt2.fits")
chips> trans = get_transform(cr, "MSC")
chips> data = [[4000.0, 5000.0],[5500.0,3500.0]]
chips> odat = apply_transform(trans, data)
chips> print odat[[ 9.60964703e+01 1.24180444e-01] [ 3.36974076e+02 2.08415725e-01]]
The "MSC" transform from evt2.fits is applied to the values (4000,5000) and (5500,3500).
Example 2
>>> import pycrates as pyc
>>> cr = pyc.read_file("img.fits")
>>> sky = pyc.get_transform(cr, "sky")
>>> pyc.apply_transform(sky, [[0.5,0.5]])
array([[ 2008.5, 3148.5]])Here we find out the SKY coordinates of the bottom-left corner of the image (the logical coordinates 1,1 refer to the center of the first pixel so 0.5,0.5 is the bottom-left corner of the pixel).
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.
See Also
- transform
- copy_transform, get_transform_type

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