measures.measure - Function

1.3.1 convert a measure to another reference
Description

measure converts measures (epoch, direction etc.) from one reference to another. It will, for instance, convert a direction from J2000 to AZEL representation.
Its arguments are a measure, an output reference code (see the individual measures for the allowable codes (direction, position, epoch, frequency, doppler, radialvelocity, baseline, uvw, earthmagnetic)), and an optional offset of the same type as the main measure. The offset will be subtracted from the result before it is returned.
In some cases (see the individual measures for when), more information than just a reference code is necessary. E.g. the above example of a conversion to AZEL, needs to know for when, and where on Earth we want it. This information is stored in a reference frame. Measures are set in the reference frame with the doframe function. The frame is tool wide.
Arguments





Inputs

v

measure to be converted

allowed:

any

Default:

record

rf

output reference code

allowed:

string

Default:

off

optional output offset measure

allowed:

any

Default:

record

Returns
anyrecord

Example

"""  
#  
print "\t----\t measure Ex 1 \t----"  
a = me.epoch(’utc’,’today’)          # a time  
print a  
#{’m0’: {’value’: 54054.872957673608, ’unit’: ’d’},  
# ’refer’: ’UTC’,  
# ’type’: ’epoch’}  
print me.doframe(me.source(’1934-638’))  
print me.measure(a, ’tai’) # convert to IAT  
#{’m0’: {’value’: 54054.873339618054, ’unit’: ’d’},  
# ’refer’: ’TAI’,  
# ’type’: ’epoch’}  
print me.doframe(a) # set time in frame  
#True  
print me.doframe(me.observatory(’ALMA’)) # set position in frame  
#True  
b=me.direction(’j2000’, qa.toangle(’0h’), ’-30deg’)  # a direction  
print b  
#{’m0’: {’value’: 0.0, ’unit’: ’rad’},  
# ’m1’: {’value’: -0.52359877559829882, ’unit’: ’rad’},  
# ’refer’: ’J2000’,  
# ’type’: ’direction’}  
print me.measure(b, ’azel’) # convert to AZEL  
#{’m0’: {’value’: 1.9244096810822324, ’unit’: ’rad’},  
# ’m1’: {’value’: 0.76465385681363052, ’unit’: ’rad’},  
# ’refer’: ’AZEL’,  
# ’type’: ’direction’}  
print qa.angle(me.getvalue(me.measure(b,’azel’))[’m0’])     # show as angles  
#[’+110.15.38’]  
print qa.angle(me.getvalue(me.measure(b,’azel’))[’m1’])  
#[’+043.48.41’]  
#  
"""

Another example:

"""  
#  
print "\t----\t measure Ex 2 \t----"  
# Fill the frame with necessary information  
print me.doframe(me.epoch(’utc’,’today’))  
#True  
print me.doframe(me.observatory(’ALMA’))  
#True  
print me.doframe(me.direction(’mars’))  
#True  
a=qa.unit(’1GHz’)  
print a  
#{’value’: 1.0, ’unit’: ’GHz’}  
m=me.frequency(’lsrk’,qa.quantity(qa.getvalue(a),qa.getunit(a)))  
print m  
#{’m0’: {’value’: 1000000000.0, ’unit’: ’Hz’},  
# ’refer’: ’LSRK’,  
# ’type’: ’frequency’}  
print me.measure(m,’lsrd’)  
#{’m0’: {’value’: 1000001766.3928765, ’unit’: ’Hz’},  
# ’refer’: ’LSRD’,  
# ’type’: ’frequency’}  
#  
"""

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.