NRAO Home > CASA > CASA Toolkit Reference Manual
coordsys.torel - Function

1.1.3 Convert absolute coordinate to relative


Description

This function converts an absolute coordinate to a relative coordinate. The coordinate may be a pixel coordinate or a world coordinate.

Relative coordinates are relative to the reference pixel (pixel coordinates) or the reference value (world coordinates) in the sense relative = absolute - reference.

If the coordinate is a pixel coordinate, it is supplied as a numeric vector. If the coordinate is a world coordinate, you may give it in all of the formats described in the formatting discussion.

If the coordinate value is supplied by a Coordsys tool function (e.g. toworld) then the coordinate ’knows’ whether it is world or pixel (and absolute or relative). However, you might supply the value from some other source as a numeric vector (which could be world or pixel) in which case you must specify whether it is a world or pixel coordinate via the isworld argument.

Arguments





Inputs

value

Absolute coordinate

allowed:

any

Default:

variant

isworld

Is coordinate world or pixel? Default is unset.

allowed:

int

Default:

-1

Returns
record

Example

 
 
"""  
#  
print "\t----\t torel Ex 1 \t----"  
csys = cs.newcoordsys(direction=T, spectral=T)  
aw = csys.toworld([99,99,23], ’s’)  
rw = csys.torel(aw)  
aw2 = csys.toabs(rw)  
print aw  
#{’ar_type’: ’absolute’, ’pw_type’: ’world’,  
# ’string’: array([’23:53:23.78086843’, ’+01.39.00.82133427’,  
# ’1.41502300e+09 Hz’], dtype=’|S19’)}  
print rw  
#{’ar_type’: ’relative’, ’pw_type’: ’world’,  
# ’string’: array([’-5.94082202e+03 arcsec’, ’5.94082133e+03 arcsec’,  
# ’2.30000000e+04 Hz’], dtype=’|S23’)}  
print aw2  
#{’ar_type’: ’absolute’, ’pw_type’: ’world’,  
# ’string’: array([’23:53:23.78086818’, ’+01.39.00.82133000’,  
# ’1.41502300e+09 Hz’], dtype=’|S19’)}  
#  
"""  
 
 
This example uses world coordinates.  
 
 
"""  
#  
print "\t----\t torel Ex 2 \t----"  
csys = cs.newcoordsys(direction=T, spectral=T)  
ap = csys.topixel()           # Reference value  
rp = csys.torel(ap)  
ap2 = csys.toabs(rp)  
print ap  
#{’ar_type’: ’absolute’, ’pw_type’: ’pixel’, ’numeric’: array([ 0.,  0.,  0.])}  
print rp  
#{’ar_type’: ’relative’, ’pw_type’: ’pixel’, ’numeric’: array([ 0.,  0.,  0.])}  
print ap2  
#{’ar_type’: ’absolute’, ’pw_type’: ’pixel’, ’numeric’: array([ 0.,  0.,  0.])}  
#  
"""  
 
This example uses pixel coordinates.  

__________________________________________________________________


More information about CASA may be found at the CASA web page

Copyright 2016 Associated Universities Inc., Washington, D.C.

This code is available under the terms of the GNU General Public Lincense


Home | Contact Us | Directories | Site Map | Help | Privacy Policy | Search