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

1.1.3 Set the rest frequency


Description

If the Coordinate System contains a spectral coordinate, then it has a rest frequency. In fact, the spectral coordinate can hold several rest frequencies (to handle for example, an observation where the band covers many lines), although only one is active (for velocity conversions) at a time.

This function allows you to set new rest frequencies. You can provide the rest frequency as a quantity, or as a quantity string, or a double (units of current rest frequency assumed).

You specify whether the list of frequencies will be appended to the current list or whether it will replace that list. You must select which of the frequencies will become the active one. By default its the first in the list. The index refers to the final list (either appended or replaced).

You can recover the current rest frequencies with restfrequency.

If the Coordinate System does not contain a frequency coordinate, an exception is generated.

Arguments





Inputs

value

New rest frequencies

allowed:

any

Default:

variant

which

Which is the active rest frequency

allowed:

int

Default:

0

append

Append this list or overwrite ?

allowed:

bool

Default:

false

Returns
bool

Example

 
 
"""  
#  
print "\t----\t setrestfrequency Ex 1 \t----"  
csys = cs.newcoordsys(spectral=True)  
print csys.restfrequency()  
#{’value’: array([  1.42040575e+09]), ’unit’: ’Hz’}  
csys.setrestfrequency(qa.quantity(’1.4GHz’))  
print csys.restfrequency()  
#{’value’: array([  1.40000000e+09]), ’unit’: ’Hz’}  
csys.setrestfrequency(1.3e9)  
print csys.restfrequency()  
#{’value’: array([  1.30000000e+09]), ’unit’: ’Hz’}  
csys.setrestfrequency (value=[1.2e9, 1.3e9], which=1)  
print csys.restfrequency()  
#{’value’: array([  1.30000000e+09,   1.20000000e+09]), ’unit’: ’Hz’}  
csys.setrestfrequency (qa.quantity([1,2],’GHz’), which=3, append=True)  
print csys.restfrequency()  
#{’value’: array([  2.00000000e+09,   1.20000000e+09,   1.30000000e+09,  
#         1.00000000e+09]), ’unit’: ’Hz’}  
csys.setrestfrequency ("1.4E9Hz 1667MHz")  
print csys.restfrequency()  
#{’value’: array([  1.40000000e+09,   1.66700000e+09]), ’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