NRAO Home > CASA > CASA Toolkit Reference Manual
##### componentlist.setstokesspectrum - Function

1.2.1 Change the spectrum of the component

Description

The setstokesspectrum function changes the spectrum of the specified components to the user specified spectrum. This is different from setspectrum as it provides ways to control variation of all 4 Stokes parameters with frequency. If only I variation is needed please use setspectrum

The type argument defines what the sort of new spectrum to use. This can be either ’constant’ or ’spectral index’ or ’tabular’. 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. It is a 4 element vector.

The first element (α0) is the spectral index of stokes I (I(ν) = I(ν0)( ν_ ν0 )α0)

The second element (α1) is a spectral index for the fractional linear polarization ( = ( ν_ ν0 )α1). α1 = 0 implies constant fractional linear polarization w.r.t frequency.

The third element is a ”Rotation Measure” factor, i.e angle of rotation θ = α2(λ2 - λ02) of the linear polarization at frequency ν w.r.t frequency ν0.

The fourth element is a spectral index for the fractional spectral polarization ( V (ν) ___ I(ν) = V (ν0) I(ν0) ( ν_ ν0 )α3

If the spectrum is ’tabular’, then index is ignored but the six parameters tabularfreqs, tabulari, tabularq, tabularu, tabularv and tabularframe are considered. tabularfreqs and tabulari, tabularq, tabularu, tabularv 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 Stokes parameters 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’ tabulari, tabularq, tabularu, tabularv 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: doubleArray Default: 0.0 tabularfreqs The frequencies of for the tabular values, in Hz allowed: doubleArray Default: 1.0e11 tabulari tabular Stokes I values, in Jy (same length as tabularfreqs) allowed: doubleArray Default: 1.0 tabularq tabular Stokes Q values, in Jy (same length as tabularfreqs) allowed: doubleArray Default: 0.0 tabularu tabular Stokes U values, in Jy (same length as tabularfreqs) allowed: doubleArray Default: 0.0 tabularv tabular Stokes V values, in Jy (same length as tabularfreqs) allowed: doubleArray Default: 0.0 reffreq The reference frequency for spectral index allowed: any Default: 1.4GHz frame The frame for which the frequencies given are in allowed: string Default: LSRK
Returns
bool

Example

This example add a point source model and revises the model point source spectral variation  changing the spectral index  and setting the reference flux to be at 2GHz.
I is assigned a spectral index of 1. fractional linear pol is assigned a spectral index of 0.4 and similarly for fraction circular pol and the linear pol angle is kept fixed with frequency.

cl.addcomponent(shape=’point’, flux=[10.0, 0.4, -0.2, 0.1], dir=’J2000 19h00m00 -20d00m00’)
cl.setstokesspectrum(which=0, type=’spectral index’, index=[1.0, 0.4, 0, 0.4], reffreq=’2.0GHz’)
cl.rename(’my19hcomp.cl’)
cl.done()

In this example a componentlist  is created from scratch and 2 sources are added
One whose spectral variation is defined by a spectral index and the other one as
tabular values. Both components have full Stokes parameters spectral variation
defined.

cl.done()  ### effectively resets state of cl tool
cl.addcomponent(flux=[10, 0.5, -0.3, 0.2], dir=’J2000 15h22m00 5d04m00’)
cl.setstokesspectrum(which=0, type=’spectral index’, index=[1.0, 0.4, 0, 0.4], reffreq=’2.0GHz’)
###adding second component; flux value is unimportant as the tabular values will
###will set it
cl.addcomponent(flux=[1.0, 0, 0, 0],dir=’J2000 15h22m30 5d05m00’)
##define the IQUV flux variation as tabular values at different frequencies.
cl.setstokesspectrum(which=1, type=’tabular’, tabularfreqs=[1.0e9, 1.1e9, 1.2e9, 1.3e9, 1.4e9, 1.5e9, 1.6e9], tabulari=[10.0, 10.1, 10.2, 10.2, 10.25, 10.3, 1.4], tabularq=[0.2, 0.2, 0.22, 0.23, 0.22, 0.24, 0.25], tabularu=[-0.1, -0.12, -0.13, -0.13, -0.12, -0.14, -0.15], tabularv=[0.1, 0.2, 0.2, 0.2, 0.3, 0.1, 0.15])
###saving the componentlist to disk
cl.rename(’two_comp.cl’)
cl.done()  ###done is needed to sync to disk

__________________________________________________________________

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