nraonrao
 
 NRAO Home > CASA > CasaDocument
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 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

Returns
anyrecord

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 me to convert the direction coordinate field from J2000 to an azimuth and elevation at a particular location at a particular time.

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

Copyright © 2007 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.