coordsys.toworld - Function

1.1.3 Convert from absolute pixel coordinate to world
Description

This function converts between absolute pixel coordinate (0-rel) and absolute world (physical coordinate).

If you supply fewer pixel values than there are axes in the Coordinate System, your coordinate vector will be padded out with the reference pixel for the missing axes. Excess values will be silently ignored.

You may ask for the world coordinate in all of the formats described in the discussion regarding the formatting possibilities available via argument format.

Arguments





Inputs

value

Absolute pixel coordinate. Default is reference pixel.

allowed:

any

Default:

variant

format

Format string: combination of ”n”, ”q”, ”s”, ”m”

allowed:

string

Default:

n

Returns
anyrecord

Example

"""  
#  
print "\t----\t toworld Ex 1 \t----"  
csys = cs.newcoordsys(direction=T, spectral=T)  
print csys.toworld([-3,1,1], ’n’)  
#{’ar_type’: ’absolute’, ’pw_type’: ’world’,  
# ’numeric’: array([  3.00000051e+00,   1.00000001e+00,   1.41500100e+09])}  
print csys.toworld([-3,1,1], ’q’)  
#{’ar_type’: ’absolute’, ’pw_type’: ’world’,  
# ’quantity’: {’*1’: {’value’: 3.0000005076962117, ’unit’: "’"},  
#              ’*2’: {’value’: 1.0000000141027674, ’unit’: "’"},  
#              ’*3’: {’value’: 1415001000.0, ’unit’: ’Hz’}}}  
print csys.toworld([-3,1,1], ’m’)  
#{’ar_type’: ’absolute’, ’pw_type’: ’world’, ’measure’:  
# {’spectral’: {’radiovelocity’: {’type’: ’doppler’, ’m0’: {’value’: 1140733.0762829871, ’unit’: ’m/s’}, ’refer’: ’RADIO’},  
#             ’opticalvelocity’: {’type’: ’doppler’, ’m0’: {’value’: 1145090.2316004676, ’unit’: ’m/s’}, ’refer’: ’OPTICAL’},  
#                 ’frequency’: {’type’: ’frequency’, ’m0’: {’value’: 1415001000.0, ’unit’: ’Hz’}, ’refer’: ’LSRK’},  
#                ’betavelocity’: {’type’: ’doppler’, ’m0’: {’value’: 1142903.3485169839, ’unit’: ’m/s’}, ’refer’: ’TRUE’}},  
# ’direction’: {’type’: ’direction’, ’m1’: {’value’: 0.0002908882127680503, ’unit’: ’rad’},  
#                                    ’m0’: {’value’: 0.00087266477368000634, ’unit’: ’rad’}, ’refer’: ’J2000’}}}  
print csys.toworld([-3,1,1], ’s’)  
#{’ar_type’: ’absolute’, ’pw_type’: ’world’,  
# ’string’: array([’00:00:12.00000203’, ’+00.01.00.00000085’, ’1.41500100e+09 Hz’], dtype=’|S19’)}  
#  
"""

Example

"""  
#  
print "\t----\t toworld Ex 2 \t----"  
csys = cs.newcoordsys (stokes="I V", linear=2)  
print csys.toworld([0,1,2], ’s’)  
#{’ar_type’: ’absolute’, ’pw_type’: ’world’,  
# ’string’: array([’I’, ’1.00000000e+00 km’, ’2.00000000e+00 km’],  
#      dtype=’|S18’)}  
print csys.toworld([0,1,2], ’m’)  
#{’ar_type’: ’absolute’, ’pw_type’: ’world’,  
# ’measure’: {’stokes’: ’I’, ’linear’: {’*1’: {’value’: 1.0, ’unit’: ’km’},  
#                                       ’*2’: {’value’: 2.0, ’unit’: ’km’}}}}  
print csys.toworld([0,1,2], ’q’)  
#{’ar_type’: ’absolute’, ’pw_type’: ’world’,  
# ’quantity’: {’*1’: {’value’: 1.0, ’unit’: ’’},  
#              ’*2’: {’value’: 1.0, ’unit’: ’km’},  
#              ’*3’: {’value’: 2.0, ’unit’: ’km’}}}  
#  
"""

Example

"""  
#  
print "\t----\t toworld Ex 3 \t----"  
csys = cs.newcoordsys (spectral=T, linear=1)  
print cs.toworld([0,1,2], ’q’)  
#{’ar_type’: ’absolute’, ’pw_type’: ’world’,  
# ’quantity’: {’*1’: {’value’: 1415000000.0, ’unit’: ’Hz’},  
#              ’*2’: {’value’: 1.0, ’unit’: ’km’}}}  
#  
"""

Please send any comments or questions about CASA or AIPS++ to aips2-requests@nrao.edu

Copyright © 2008 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

Updated daily during alpha development.