NRAO Home > CASA > CASA Toolkit Reference Manual
componentlist.setspectrum - Function

1.2.1 Change the spectrum of the component


Description

The setspectrum function changes the spectrum of the specified components to the user specified spectrum.

The type argument defines what the sort of new spectrum to use. This can be either ’constant’or ’spectral index’. The parsing of this string is case insensitive.

If the spectrum type is ’constant’ then the remaining arguments in this function are ignored. There are no other parameters needed to specify a constant spectrum.

But if the spectrum is ’spectral index’, the index argument is needed to fully specify the spectrum by using the index argument.

If the spectrum is ’tabular’, then index is ignored but the three parameters tabularfreqs, tabularflux and tabularframe are considered. tabularfreqs and tabularflux have to be list of same lengths and larger than 2. You need at least 2 samples to interpolate the spectral value in between. The flux of the source is interpolated from these values. Extrappolation outside the range given in tabularfreqs is not done. tabularfreqs should be float values in ’Hz’ tabularflux should be float values in ’Jy’

You should ensure that the reference frequency is set to the value you desire, using the setfreq function if you change to the spectral index shape.

Arguments





Inputs

which

The index specifying the component to modify. A value between 0 and one less than the list length, inclusively

allowed:

int

Default:

type

The new spectrum type. A string that is either ’constant or ’spectral index’ or ’tabular’

allowed:

string

Default:

spectral index

index

The spectral index.

allowed:

double

Default:

0.0

tabularfreqs

The frequencies of for the tabular values, in Hz

allowed:

doubleArray

Default:

1.0e11

tabularflux

tabular flux density values, in Jy (same length as tabularfreqs)

allowed:

doubleArray

Default:

1.0

tabularframe

The frame for which the frequencies given are in

allowed:

string

Default:

LSRK

Returns
bool

Example

 
 
 
      cl.open(’centarusA.cl’)  
      cl.setspectrum(2, ’spectral index’, -0.5)  
      print cl.getcomponent(2)[’spectrum’][’index’]  
      cl.done()  
 
      This example revises the model for Centaurus-A changing the  
    spectral index of all the components in the left lobe. The output  
    from the print statement is \verb|[-0.5 0 0 0]|  
 
    cl.addcomponent(shape=’point’, flux=[1.0, 0.0, 0.0, 0.0], dir=’J2000 19h00m00 -20d00m00’)  
    cl.setspectrum(which=0, type=’tabular’, tabularfreqs=[1.0e9, 1.1e9, 1.4e9], tabularflux=[1.0, 0.9, 0.75])  
    cl.rename(’my19hcomp.cl’)  
    cl.done()  
 
   In this example a component is created from scratch as a point source  
   The spectrum is set to, say, measured values at 3 frequencies (1GHz, 1.1GHz and 1.4GHz) to 1.0Jy, 0.9Jy, 0.75Jy respectively.  
    Any frequency in between the range 1 to 1.4 GHz the flux will be estimated by interpolation.  
 
 

__________________________________________________________________


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