|
|||
NRAO Home > CASA > CASA Toolkit Reference Manual |
|
image.coordmeasures - Function
1.1.1 Convert from pixel to world coordinate wrapped as Measures
Description
You can use this function to get the world coordinates for a specified absolute
pixel coordinate in the image. You specify a pixel coordinate (0-rel) for each
axis in the image.
If you supply fewer pixel values then there are axes in the image, your value will be padded out with the reference pixel for the missing axes. Excess values will be ignored.
The parameters dframe and sframe allow one to specify to which reference frame the direction and spectral measures, respectively, should be converted. These values are case-insensitive. ”native” means use the native reference frame of the coordinate in question. ”cl” means use the conversion layer frame if one exists (if not, the native frame will be used).
The world coordinate is returned as a record of measures. This function is just a wrapper for the Coordsys tool toworld function (invoked with argument format=’m’). Please see its documentation for discussion about the formatting and meaning of the measures.
This Image tool function adds two additional fields to the return record.
The mask field contains the value of the image pixel mask at the specified position. It is either T (pixel is good) or F (pixel is masked as bad or the specified position was off the image).
The intensity field contains the value of the image (at the nearest pixel to that given) and its units. This is actually stored as a Quantity. This field does not exist if the specified pixel coordinate is off the image.
Arguments
Inputs |
| ||
pixel |
| Absolute pixel coordinate. Default is reference pixel.
| |
| allowed: | doubleArray |
|
| Default: | -1 | |
dframe |
| Direction reference frame to which to convert the
direction data. Case insensitive. ”cl” means use the
conversion layer, if present, of the image direction
coordinate. ”native” means use the native native
direction frame of the image. Other examples are
”J2000”, ”B1950”, ”GALACTIC”, etc.
| |
| allowed: | string |
|
| Default: | cl |
|
sframe |
| Spectral reference frame to which to convert the spectral
data. Case insensitive. ”cl” means use the conversion
layer, if present, of the image spectral coordinate.
”native” means use the native spectral reference frame
of the image. Other examples are ”LSRK”, ”CMB”,
”LGROUP”, etc.
| |
| allowed: | string |
|
| Default: | cl |
|
record
Example
"""
#
print "\t----\t coordmeasures Ex 1 \t----"
ia.maketestimage(’myimage’,overwrite=true)
s = ia.shape()
for i in range(len(s)):
s[i] = 0.5*s[i]
meas = ia.coordmeasures(s)
print meas.keys() # Get names of fields in record
#[’intensity’, ’mask’, ’measure’]
print meas[’intensity’]
#{’value’: 1.39924156665802, ’unit’: ’Jy/beam’}
print meas[’measure’][’direction’]
#{’type’: ’direction’,
# ’m1’: {’value’: 5.817764003289323e-05, ’unit’: ’rad’},
# ’m0’: {’value’: -5.8177644130875234e-05, ’unit’: ’rad’}, ’refer’: ’J2000’}
dir = meas[’measure’][’direction’] # Get direction coordinate
me.doframe(me.observatory(’ATCA’)) # Set location on earth
me.doframe(me.epoch(’utc’,’16jun1999/12:30:20’)) # Set epoch
azel = me.measure(dir,’azel’) # Convert to azimuth/elevation
print ’az,el=’, qa.angle(azel[’m0’]), qa.angle(azel[’m1’]) # Format nicely
#az,el= +105.15.47 -024.22.57
meas2=ia.coordmeasures() # defaults to reference pixel
print meas2[’intensity’]
#{’value’: 2.5064315795898438, ’unit’: ’Jy/beam’}
print meas2[’measure’][’direction’]
#{’type’: ’direction’,
# ’m1’: {’value’: 0.0, ’unit’: ’rad’},
# ’m0’: {’value’: 0.0, ’unit’: ’rad’}, ’refer’: ’J2000’}
dir = meas2[’measure’][’direction’] # Get direction coordinate
me.doframe(me.observatory(’ATCA’)) # Set location on earth
me.doframe(me.epoch(’utc’,’16jun1999/12:30:20’)) # Set epoch
azel = me.measure(dir,’azel’) # Convert to azimuth/elevation
print ’az,el=’, qa.angle(azel[’m0’]), qa.angle(azel[’m1’])
#az,el= +105.16.05 -024.23.00
#
"""
In this example we first find the world coordinates of the centre of the
image. Then we use the Measures \tool\ {\stf me} to convert the
{\cf direction coordinate} field from J2000 to an azimuth and elevation
at a particular location at a particular time.
__________________________________________________________________
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