|
|||
NRAO Home > CASA > CASA Toolkit Reference Manual |
|
coordsys.topixel - Function
1.1.3 Convert from absolute world to pixel coordinate
Description
This function converts between world (physical) coordinate and absolute pixel
coordinate (0-rel).
The world coordinate can be provided in one of four formats via the argument world. These match the output formats of function toworld.
If you supply fewer world values than there are axes in the Coordinate System, your coordinate vector will be padded out with the reference value for the missing axes. Excess values will be silently ignored.
You may supply the world coordinate in all of the formats described in the formatting discussion.
Arguments
Inputs |
| ||
value |
| Absolute world coordinate
| |
| allowed: | any |
|
| Default: | variant |
|
record
Example
"""
#
print "\t----\t topixel Ex 1 \t----"
csys = cs.newcoordsys(direction=T, spectral=T, stokes="I V", linear=2)
w = csys.toworld([-2,2,1,2,23,24], ’n’)
print csys.topixel(w)
#{’ar_type’: ’absolute’, ’pw_type’: ’pixel’,
# ’numeric’: array([ -2., 2., 1., 2., 23., 24.])}
w = csys.toworld([-2,2,1,2,23,24], ’q’)
print csys.topixel(w)
#{’ar_type’: ’absolute’, ’pw_type’: ’pixel’,
# ’numeric’: array([ -2., 2., 1., 2., 23., 24.])}
w = csys.toworld([-2,2,1,2,23,24], ’m’)
print csys.topixel(w)
#{’ar_type’: ’absolute’, ’pw_type’: ’pixel’,
# ’numeric’: array([ -2., 2., 1., 2., 23., 24.])}
w = csys.toworld([-2,2,1,2,23,24], ’s’)
print cs.topixel(w)
#{’ar_type’: ’absolute’, ’pw_type’: ’pixel’,
# ’numeric’: array([ -2., 2., 1., 2., 23., 24.])}
w = csys.toworld([-2,2,1,2,23,24], ’mnq’)
print cs.topixel(w)
#{’ar_type’: ’absolute’, ’pw_type’: ’pixel’,
# ’numeric’: array([ -2., 2., 1., 2., 23., 24.])}
#
"""
Example
"""
#
print "\t----\t topixel 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 topixel Ex 3 \t----"
csys = cs.newcoordsys (spectral=T, linear=1)
print csys.toworld([0,1,2], ’q’)
#{’ar_type’: ’absolute’, ’pw_type’: ’world’,
# ’quantity’: {’*1’: {’value’: 1415000000.0, ’unit’: ’Hz’},
# ’*2’: {’value’: 1.0, ’unit’: ’km’}}}
#
"""
__________________________________________________________________
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