NRAO Home > CASA > CASA Toolkit Reference Manual
##### coordsys.setspectral - Function

1.1.3 Set tabular values for the spectral coordinate

Description

When you construct a Coordsys tool, if you include a Spectral Coordinate, it will be linear in frequency. This function allows you to replace the Spectral Coordinate by a finite table of values. Coordinate conversions between pixel and world are then done by interpolation.

You may specify either a vector of frequencies or velocities. If you specify frequencies, you can optionally specify a (new) reference code (see function setreferencecode for more details) and rest frequency (else the existing ones will be used).

If you specify velocities, you can optionally specify a (new) reference code and rest frequency (else the existing ones will be used). You must also give the doppler type (see function summary for more details). The velocities are then converted to frequency for creation of the Spectral Coordinate (which is fundamentally described by frequency).

You may specify the rest frequency as a Quantum or a double (native units of Spectral Coordinate used).

Arguments

 Inputs refcode Reference code. Leave unset for no change. allowed: string Default: restfreq Rest frequency. Leave unset for no change. allowed: any Default: variant frequencies Vector of frequencies. Leave unset for no change. allowed: any Default: variant 1GHz doppler Doppler type. Leave unset for no change. allowed: string Default: velocities Vector of velocities types. Leave unset for no change. allowed: any Default: variant 1km/s
Returns
bool

Example

print "\t----\t setspectral Ex 1 \t----"
csys = cs.newcoordsys(spectral=T);
f1 = [1,1.01,1.03,1.4]
fq = qa.quantity(f1, ’GHz’)
csys.setspectral(frequencies=fq)
v = csys.frequencytovelocity(f1, ’GHz’, ’radio’, ’km/s’)
print ’v=’, v
#v= [88731.317461076716, 86620.706055687479, 82399.483244909003, 4306.8612455073862]
vq = qa.quantity(v, ’km/s’)
csys.setspectral(velocities=vq, doppler=’radio’)
f2 = csys.velocitytofrequency(v, ’GHz’, ’radio’, ’km/s’)
print ’f1 = ’, f1
#f1 =  [1, 1.01, 1.03, 1.3999999999999999]
print ’f2 = ’, f2
#f2 =  [1.0, 1.01, 1.03, 1.3999999999999999]

We make a linear Spectral Coordinate.  Then overwrite it with
a list of frequenices.  Convert those values to velocity,
then overwrite the coordinate starting with a list of
velocities. Then convert the velocities to frequency
and show we get the original result.

__________________________________________________________________

More information about CASA may be found at the CASA web page

Copyright © 2016 Associated Universities Inc., Washington, D.C.

Home | Contact Us | Directories | Site Map | Help | Privacy Policy | Search