NRAO Home > CASA > CASA Toolkit Reference Manual
coordsys.setreferencevalue - Function

1.1.3 Set the reference value


Description

Each axis associated with the Coordinate System has a reference value, reference pixel and an increment (per pixel). These are used in the mapping from pixel to world coordinate.

This function allows you to set a new reference value. You should not do this on ”stokes” axes unless you are an adept or a big risk taker.

You may supply the reference value in all of the formats described in the formatting discussion.

You can recover the current reference value with function referencevalue.

Note that the value argument should be one of the specified possibilitioes. Especially a measure will be accepted, but will have a null effect, due to the interpretation as a generic record.

Arguments





Inputs

value

Reference value

allowed:

any

Default:

variant

type

Coordinate type: ”direction”, ”stokes”, ”spectral”, ”linear”, ”tabular” or leave empty for all.

allowed:

string

Default:

Returns
bool

Example

 
 
"""  
#  
print "\t----\t setreferencevalue Ex 1 \t----"  
csys = cs.newcoordsys(direction=True, spectral=True)  
rv = csys.referencevalue(format=’q’)  
print rv  
#{’quantity’: {’*1’: {’value’: 0.0, ’unit’: "’"},  
# ’*2’: {’value’: 0.0, ’unit’: "’"}, ’*3’: {’value’: 1415000000.0, ’unit’: ’Hz’}}}  
rv2 = rv[’quantity’][’*3’]  
rv2[’value’] = 2.0e9  
print rv2  
#{’value’: 2000000000.0, ’unit’: ’Hz’}  
csys.setreferencevalue(type=’spec’, value=rv2)  
print csys.referencevalue(format=’n’)  
#{’numeric’: array([  0.00000000e+00,   0.00000000e+00,   2.00000000e+09])}  
#  
# To set a new direction reference value, the easiest way, given a  
# direction measure dr would be:  
dr = me.direction(’j2000’,’30deg’,’40deg’)  
# SHOULD BE SIMPLIFIED!!!  
newrv=csys.referencevalue(format=’q’)  
newrv[’quantity’][’*1’]=dr[’m0’]  
newrv[’quantity’][’*2’]=dr[’m1’]  
csys.setreferencevalue(value=newrv)  
print csys.referencevalue(format=’q’)  
#{’ar_type’: ’absolute’, ’pw_type’: ’world’,  
# ’quantity’: {’*1’: {’value’: 1800.0, ’unit’: "’"},  
#              ’*2’: {’value’: 2399.9999999999995, ’unit’: "’"},  
#              ’*3’: {’value’: 1415000000.0, ’unit’: ’Hz’}}}  
#  
"""  
 

__________________________________________________________________


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