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

1.1.3 Convert relative coordinate to absolute


Description

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

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

Relative coordinate

allowed:

any

Default:

variant

isworld

Is coordinate world or pixel? Default is unset.

allowed:

int

Default:

-1

Returns
record

Example

 
 
"""  
#  
print "\t----\t toabs Ex 1 \t----"  
csys = cs.newcoordsys(direction=True, spectral=True)  
aw = csys.toworld([100,100,24], ’s’)  
rw = csys.torel(aw)  
aw2 = csys.toabs(rw)  
print aw  
#{’ar_type’: ’absolute’, ’pw_type’: ’world’,  
# ’string’: array([’23:53:19.77415678’, ’+01.40.00.84648186’,  
#                  ’1.41502400e+09 Hz’], dtype=’|S19’)}  
print rw  
#{’ar_type’: ’relative’, ’pw_type’: ’world’,  
# ’string’: array([’-6.00084720e+03 arcsec’, ’6.00084648e+03 arcsec’,  
#                  ’2.40000000e+04 Hz’], dtype=’|S23’)}  
print aw2  
#{’ar_type’: ’absolute’, ’pw_type’: ’world’,  
# ’string’: array([’23:53:19.77415672’, ’+01.40.00.84648000’,  
#                  ’1.41502400e+09 Hz’], dtype=’|S19’)}  
#  
"""  
 
 
This example uses world coordinates.  

Example

 
 
"""  
#  
print "\t----\t toabs Ex 2 \t----"  
csys = cs.newcoordsys(direction=True, spectral=True)  
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’: ’world’,  
#     ’numeric’: array([  0.00000000e+00,   0.00000000e+00,  -1.41500000e+09])}  
print ap2  
#{’ar_type’: ’absolute’, ’pw_type’: ’world’, ’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