componentlist¶
-
class
componentlist
[source]¶ A tool for the manipulation of groups of components
A componentlist is a tool that contains functions that manipulate components. A component is a functional representation of the sky brightness - point source, disk, Gaussian, etc.
Note for those new to CASA: components are not used explicitly in cleaning, rather the model is stored as an image. Components are useful for e.g. simulation and modifying images (ia.modify), but one will not in general have a clean component list associated with cleaning data.
The simplest way to make a componentlist tool is to use cl.addcomponent: cl.done() # it is safest to close it before beginning # add a single point source component with # Stokes I=2.3Jy and other Stokes parameters 0 cl.addcomponent(dir=’J2000 10h30m00 -20d00m00.0’, flux=[2.3,0,0,0]) cl.rename(“myList.cl”) # save to disk
One can open a list on disk with cl.open(filename).
Componentlists can be converted to/from records (python dictionaries) with cl.torecord() and cl.fromrecord(record).
Methods Summary
Add a component to the list.
Add a component to the list
Create a componentlist from an ascii file {f (Not implemented yet)}
Save the componentlist to disk and reset its state.
Construct an empty componentlist
Append components from another componentlist.
Change (convert) the polarization representation of the specified components
Change (convert) the flux units of the specified components
Convert the reference frequency to a new unit
Convert the reference direction to a new frame
Change the units of the shape parameters (Not implemented yet)
Unmark components in the list
Delete the componentlist tool
Start up the component editor gui (Not implemented yet)
make a componentlist tool from a record
Extract a component from the list.
Get the error in the flux of the specified component
Get the polarization representation for the flux of the specified component {f (Not implmented yet)}
Get the flux unit of the specified component
Get the flux value of the specified component
Get the reference frequency (Not implemented yet)
Get the reference frequency frame (Not implemeted yet)
Get the reference frequency unit (Not implemeted yet)
Get the reference frequency value (Not implemeted yet)
Get the label of the specified component
Return the reference direction
Get the declination of the reference direction.(Not implemented yet)
Get the reference frame of the reference direction.
Get the RA of the reference direction.
Return the shape parameters the component
Return the spectral parameters the component
Return a vector of indices.
Is the argument a componentlist tool? (Not implemented yet)
Check if a component is physically plausible
Find the number of components in the list.
Construct a cl from a table on disk
Permanently delete removed components.
Obtain removed components.
Remove a component from the list.
Give the list a name so it can save itself.
Replace components in the list.
Sample the flux of the list in a specified direction.
Mark components in the list
Determine which components are selected
Set the flux of the specified components
Set the reference frequency
Set the reference frame for the frequency
Set the label of the specified components
Set the reference direction
Set the reference frame for the direction
Change the shape of the component
Change the spectrum of the component
Change the spectrum of the component
Returns the shape type of the component
Add some simulated components to the list
Sort the components in a list
Returns the spectral shape of the component
Summarize the specified component to the logger
convert componentlist to a record
-
add
(thecomponent='', iknow=True)[source]¶ Add a component to the list.
- The add function adds a component to the component
list. You cannot add components to a list that has been opened read only. To use this function you need to know the details of the record format. however this has been deprecated and you are urged to use the set functions, in conjunction with the simulate function to add a component to the list.
Parameters
thecomponent (record='')
- A record that represents a component.any record that contains the required fields
iknow (bool=True)
- Suppress the warning message
-
addcomponent
(flux='', fluxunit='Jy', polarization='Circular', dir='J2000 00h00m00.0 90d00m00.0', shape='disk', majoraxis='2.0arcmin', minoraxis='1.0arcmin', positionangle='0.0deg', freq='LSRK 1.415GHz', spectrumtype='spectral index', index=1.0, optionalparms=[0.0], label='')[source]¶ Add a component to the list
- The addcomponent function is a convenience function that ties
together the simulate function, and the various set functions. This function adds a component to the end of the list. For a description of the arguments see the following functions.
[flux, fluxunit, polarization] See setflux [ra, raunit, dec, decunit] See setrefdir [dirframe] See setrefdirframe [shape, majoraxis, minoraxis, positionangle] See setshape [freq] A frequency quantity which is split into a value and
units and passed to the setfreq function
[freqframe] See setfreq [spectrumtype, index] The spectral index alpha such that flux density S
as a function of frequency nu is: S~nu**alpha. See also the setspectrum or setstokesspectrum functions.
[label] See setlabel
Parameters
flux (any='')
- The flux value.A vector with four real or complex numbers
fluxunit (string='Jy')
- The units of the flux.Any string with the same dimensions as the Jansky
dir (any='J2000 00h00m00.0 90d00m00.0')
- The direction measure of the source, it can a be any direction measure from the measures tool or a string of the type ‘J2000 10h30m00 -20d00m00.0’ or a vector of strings of the type [‘J2000’, ‘10:30:00.00’, ‘-20.00.00.0’]. Basically the string or strings should have the direction frame and quantities for Ra and Decshape (string='disk')
- The new shape type.A string that is either ‘point’, ‘Gaussian’, or ‘disk’
majoraxis (any='2.0arcmin')
- The width (FWHM in the case of a Gaussian) of the larger axis.A quantity with angular units
minoraxis (any='1.0arcmin')
- The width (FWHM in the case of a Gaussian) of the smaller axis.A quantity with angular units
positionangle (any='0.0deg')
- The rotation of the axes with respect tothe reference frame.
A quantity with angular units
freq (any='LSRK 1.415GHz')
- The reference frequency.A quantity with units equivalent to the ‘Hz’ and frame or a frequency measure, e.g [‘TOPO’, ‘1.6GHz’], or simply default frame (LSRK) ‘1.6GHz’
spectrumtype (string='spectral index')
- The spectrum type,a string that is either ‘constant’ or ‘spectral index’
index (double=1.0)
- The spectral indexoptionalparms (doubleArray=[0.0])
- optional parameters in vector (for future use)label (string='')
- The label for the component
-
asciitocomponentlist
(filename='', asciifile='', refer='B1950', format='ST', direction='', spectrum='', flux='', log=True)[source]¶ Create a componentlist from an ascii file {f (Not implemented yet)}
- This constructor will allow conversion of a number of ascii-file-based
formats to componentlists.
Parameters
filename (string='')
- Name of output component list tableasciifile (string='')
- Name of input ascii filerefer (string='B1950')
- Input reference frameformat (string='ST')
- Name of format (only ST supported)direction (record='')
- Direction measure (for relative coordinates)spectrum (record='')
- Default spectrum field, valid spectrum field[type=”Constant”, frequency=[type=”frequency” , refer=”LSR” , m0=[unit=”GHz” , value=1.0]]
flux (record='')
- Default flux field, valid flux field[value=[0.0, 0.0, 0.0, 0.0], unit=’Jy’, polarization=”Stokes”]
log (bool=True)
- Send a message to the logger
-
close
(log=True)[source]¶ Save the componentlist to disk and reset its state.
- The close function resets the componentlist to its default state. In
this state it contains no components and is not associated with any table.
This function flushes all the components in memory to disk if the componentlist is associated with a table. The table is then closed, and the contents of the list deleted.
If the list is not associated with a table its contents are still deleted and memory used by the list is released.
Parameters
log (bool=True)
- Send a message to the logger
-
componentlist
()[source]¶ Construct an empty componentlist
- Use this constructor to construct a componentlist tool that does not
contain any components. Components can be appended to the list using the addcomponent or simulate functions, and the list can be stored to disk by giving it a name with cl.rename
-
concatenate
(list='', which=[- 1], log=True)[source]¶ Append components from another componentlist.
- The concatenate function copies the specified component(s), from
the specified to list, to the end of the current list. The components are specified by numbering them from one to the length of the list. You cannot append components to a list that has been opened read only but the list you are copying from may be readonly.
You use a vector of indices to copy a number of components at once. By default all components are copied.
Parameters
list (any='')
- list to copy from. Can be a componentlist record or a componentlist file name from diskwhich (intArray=[-1])
- which components to copy, -1 unsetlog (bool=True)
- Send a message to the logger
-
convertfluxpol
(which='', polarization='circular')[source]¶ Change (convert) the polarization representation of the specified components
- The convertfluxpol function is used to convert the flux to another
polarization representation. There are are three representations used, namely , ‘Stokes’, ‘linear’ & ‘circular’
Parameters
which (int='')
- A vector of indices specifying the components to modify.A vector with indices between 0 and one less than the list length, inclusively
polarization (string='circular')
- The new polarization representation
-
convertfluxunit
(which='', unit='Jy')[source]¶ Change (convert) the flux units of the specified components
- The convertfluxunit function is used to convert the flux to another
unit. The units emph{must} have the same dimensions as the Jansky.
Parameters
which (int='')
- A vector of indices specifying the components to modify.A vector with indices between 0 and one less than the list length, inclusively
unit (string='Jy')
- The units of the flux.Any string with the same dimensions as the Jansky
-
convertfrequnit
(which='', unit='GHz')[source]¶ Convert the reference frequency to a new unit
- The convertfrequnit function changes the specified components to use
a new unit for the reference frequency. Using this function will change the frequency value also so that the overall reference frequency is not changed. It will affect the values and units obtained with setfreqvalue function.
Any unit can be used that has the same dimensions as the ‘Hz’.
Parameters
which (int='')
- An index specifying the component to modify.An integer between 0 and one less than the list length, inclusively
unit (string='GHz')
- The new frequency unit.Any string with the same dimensions as the ‘Hz’
-
convertrefdir
(which='', frame='')[source]¶ Convert the reference direction to a new frame
- The convertrefdir function changes the specified components to use a
new direction reference frame. Using this function will change the right-ascension and declination of the component(s), unlike the setrefdirframe which does not.
Please see the setrefdirframe function for a description of what frames are allowed.
Parameters
which (int='')
- A vector of indices specifying the components to modify.A vector with indices between 0 and one less than the list length, inclusively
frame (string='')
- The new reference frameA string like ‘B1950’, ‘J2000’ or ‘galactic’
-
convertshape
(which='', majoraxis='rad', minoraxis='rad', positionangle='rad')[source]¶ Change the units of the shape parameters (Not implemented yet)
Parameters
which (int='')
- A vector of indices specifying the components to modify.A vector with indices between 0 and one less than the list length, inclusively
majoraxis (string='rad')
- The units to use on the larger axis.A string with angular units
minoraxis (string='rad')
- The units to use on the smaller axis.A string with angular units
positionangle (string='rad')
- The units to use for the rotation ofthese axes.
A string with angular units
-
deselect
(which='')[source]¶ Unmark components in the list
- The deselect function is used to remove the ``selected’’ mark from
specified components in the list. This function wiil be used in conjunction with the planned graphical user interface and no other functions in the componentlist will behave differently if a component is marked as ``selected’’ or not.
Components are not selected when the list is initially read from disk or when a new component is added to the list using the simulate function. function. Deselecting a component that is already deselected is perfectly valid and results in no change.
Parameters
which (intArray='')
- A vector of indicesIndices must be between 0 and one less than the list length, inclusively
-
done
()[source]¶ Delete the componentlist tool
- The done function frees up all the memory associated with a
componentlist tool. After calling this function the componentlist tool cannot be used, either to manipulate the current list, or to open a new one. This function does not delete the disk file associated with a componentlist, but it will shut down the server process if there are no other componentlist tools being used.
-
edit
(which='', log=True)[source]¶ Start up the component editor gui (Not implemented yet)
Parameters
which (int='')
- An index specifying which component.An integer between 0 and one less than the list length
log (bool=True)
- Send a message to the logger
-
fromrecord
(record='')[source]¶ make a componentlist tool from a record
- This function allows the componentlist records that are returned
by other functions (for e.g from imageanalysis tool) be converted to a tool to be manipulated or to be saved on disk
Parameters
record (record='')
- a component list record
-
getcomponent
(which='', iknow=False)[source]¶ Extract a component from the list.
- The component function returns a record, showing the current state
of the specified component in the list.
Modifying the record that is returned by this function does not modify the component in the list. To do this you must remove the component from the list, using the remove function, and add the modified component using the add function, or use the replace object function. This function will be removed in a future release of and you are urged to use the get functions to extract information about a component.
Parameters
which (int='')
- index of which component to extract.integers between 0 and one less than the length of the list, inclusively
iknow (bool=False)
- Suppress the warning message
-
getfluxerror
(which='')[source]¶ Get the error in the flux of the specified component
- The getfluxerror function returns the error in the flux of the
specified component using the current units and the current polarization representation. The functions getfluxvalue & getfluxunit & getfluxpol & can be used to get the value, units and polarization representation that corresponds to the specified error.
No error calculations are done by this tool. The error can be stored and retreived and if any of the parameters of the flux change the user is responsible for updating the errors.
Parameters
which (int='')
- Index specifying which component.An integer between 0 and one less than the list length, inclusively
-
getfluxpol
(which='')[source]¶ Get the polarization representation for the flux of the specified component {f (Not implmented yet)}
- The getfluxunit function returns the polarization representation
of the flux of the specified component. The actual values are obtained using the getfluxvalue function.
Parameters
which (int='')
- An index specifying which component.
An integer between 0 and one less than the list length, inclusively
-
getfluxunit
(which='')[source]¶ Get the flux unit of the specified component
- The getfluxunit function returns the units of the flux of the
specified component. The actual values are obtained using the getfluxvalue function.
Parameters
which (int='')
- An index specifying which component.An integer between 0 and one less than the list length, inclusively
-
getfluxvalue
(which='')[source]¶ Get the flux value of the specified component
- The getfluxvalue function returns the value of the flux of the
specified component using the current units and the current polarization representation. The functions getfluxunit & getfluxpol & can be used to get the units and polarization representation that corresponds to the supplied value.
Parameters
which (int='')
- An index specifying which component.An integer between 0 and one less than the list length, inclusively
-
getfreq
(which='')[source]¶ Get the reference frequency (Not implemented yet)
Parameters
which (int='')
- An index specifying which component.An integer between 0 and one less than the list length, inclusively
-
getfreqframe
(which='')[source]¶ Get the reference frequency frame (Not implemeted yet)
Parameters
which (int='')
- An index specifying which component.An integer between 0 and one less than the list length, inclusively
-
getfrequnit
(which='')[source]¶ Get the reference frequency unit (Not implemeted yet)
Parameters
which (int='')
- An index specifying which component.An integer between 0 and one less than the list length, inclusively
-
getfreqvalue
(which='')[source]¶ Get the reference frequency value (Not implemeted yet)
Parameters
which (int='')
- An index specifying which component.An integer between 0 and one less than the list length, inclusively
-
getlabel
(which='')[source]¶ Get the label of the specified component
- The getlabel function returns the label associated with the specified
component. The label is an arbitrary text string that can be used to tag a component.
Parameters
which (int='')
- An index specifying which component.An integer between 0 and one less than the list length, inclusively
-
getrefdir
(which='')[source]¶ Return the reference direction
- The getrefdir function returns, as a direction measure, the
reference direction for the specified component. The reference direction is for all the currently supported component shapes the direction of the centre of the component.
Parameters
which (int='')
- An index specifying which component.An integer between 0 and one less than the list length, inclusively
-
getrefdirdec
(which='', unit='deg', precision=6)[source]¶ Get the declination of the reference direction.(Not implemented yet)
- The getrefdirdec function returns the declination of the reference
direction of the component as a formatted string. If the reference frame is something other than J2000 or B1950 the value returned is the longitude or the altitude.
See the getrefdirra function for a description of the unit and precision arguments.
Parameters
which (int='')
- An index specifying which component.An integer between 0 and one less than the list length, inclusively
unit (string='deg')
- The angular unit of the returned value.Any string containing an angular unit or ‘angle’ or ‘time’
precision (int=6)
- The number of digits in the returned string.Numbers between 1 and 16 make the most sense
-
getrefdirframe
(which='')[source]¶ Get the reference frame of the reference direction.
- The getrefdirframe function returns the reference frame of the reference
direction of the component as a string. The returned string is always in upper case. Common frames are, ‘J2000’, ‘B1950’ and ‘GALACTIC’.
Parameters
which (int='')
- An index specifying which component.An integer between 0 and one less than the list length, inclusively
-
getrefdirra
(which='', unit='deg', precision=6)[source]¶ Get the RA of the reference direction. (Not implemented not)
Parameters
which (int='')
- An index specifying which component.An integer between 0 and one less than the list length, inclusively
unit (string='deg')
- The angular unit of the returned value.Any string containing an angular unit or ‘angle’ or ‘time’
precision (int=6)
- The number of digits in the returned string.Numbers between 1 and 16 make the most sense
-
getshape
(which='')[source]¶ Return the shape parameters the component
- The getshape function returns the shape parameters of a component
in a record. As different shapes can have a differing number and type of parameters the shape parameters are returned in a record with fields that correspond to parameters relevant to the current shape.
For a point shape there are only two fields; type and direction. These are the shape type, and the reference direction. These values are also returned by the shapetype and getrefdir functions.
For both the Gaussian and disk shapes there are three additional fields; majoraxis, minoraxis, positionangle. These are angular quantities, and hence are records with a value and a unit.
Parameters
which (int='')
- An index specifying which component.An integer between 0 and one less than the list length, inclusively
-
getspectrum
(which='')[source]¶ Return the spectral parameters the component
- The getspectrum function returns the spectral parameters of a
component in a record. As different spectral shapes can have a differing number and type of parameters the spectral parameters are returned in a record with fields that correspond to parameters relevant to the current spectral shape.
For a constant spectrum there are only two fields; type and frequency. These are the spectral type, and the reference frequency. These values are also returned by the spectrumtype and getfreq functions.
For the spectral index spectral shape there is also an index field. This contains a vector with four numbers, these are the spectral indicies for the I,Q,U,V components of the flux.
Parameters
which (int='')
- An index specifying which component.An integer between 0 and one less than the list length, inclusively
-
indices
()[source]¶ Return a vector of indices. (Not implemented yet)
- The indices function will returns a vector of non-negative
integers that can be used to index through the list. This vector always contains the integers starting at one and increasing sequentially to the length of the list. Its main use is in for loops as is illustrated in the example below.
-
iscomponentlist
(tool='')[source]¶ Is the argument a componentlist tool? (Not implemented yet)
- This global function can be used to determine if the supplied
argument is a componentlist tool. If so it returns True, otherwise it returns False.
Parameters
tool (any='')
- The variable that you wish to test
-
isphysical
(which=[- 1])[source]¶ Check if a component is physically plausible
- The isphysical function is used to check if the specified
components meet a number of criteria that must be true if the component could be used to model a physical process. These criteria are:
I >= sqrt(Q**2 + U**2 + V**2)
- That the flux, when represented using the Stokes
representation, has a zero imaginary value.
The ``Flux properties’’ section of the ComponentModels module documentation describes how it is possible to generate a component which has non-zero imaginary value in the Stokes representation.
It is possible to check a number of components at once by specifying the indicies of all the components. The returned value will only be True if all the specified components are physical.
Parameters
which (intArray=[-1])
- A vector of indicesIndices must be between 0 and one less than the list length, inclusively
-
length
()[source]¶ Find the number of components in the list.
- The length function returns a non-negative integer that
indicates how many components the list currently contains.
-
open
(filename='', nomodify=False, log=True)[source]¶ Construct a cl from a table on disk
- Use this constructor to construct a componentlist tool by reading
the data from an table. To ensure that this table contains all the necessary columns and to allow the table format to be enhanced in the future, it is highly recommended that the table be created using a componentlist tool.
The table that contains the componentlist may be opened read-only by setting the readonly flag to True. When this is done some of the functions in the componentlist tool cannot be used. These include the ``set’’, ``convert’’, ``remove’’, ``replace’’, ``purge’’, ``recover’’, and ``sort’’ functions.
Parameters
filename (string='')
- The filename of the tablenomodify (boolean=False)
- Should the table be opened read onlylog (boolean=True)
- Send a message to the logger
-
purge
()[source]¶ Permanently delete removed components.
- The remove function deletes components from the list but does not
remove them from memory. They remain accessible and can be obtained with the recover function. The purge function frees up the memory occupied by the removed components. You cannot use the recover function to obtain the removed components after the purge function has been called.
-
recover
(log=True)[source]¶ Obtain removed components.
- The recover function appends components to the end of the list
that have been deleted with the remove function. This does not include components that were removed before the purge function was last executed.
Parameters
log (bool=True)
- Send a message to the logger
-
remove
(which=[- 1], log=True)[source]¶ Remove a component from the list.
- The remove function removes the specified component(s) from the
list. Components are specified by numbering them from one to the length of the list. So removing component one will remove the first component. After using this function all the remaining components will be shuffled down so that component two becomes component one. You cannot remove components from a list that has been opened read only.
You can specify a vector of indices to remove a number of components at once. For example in a five element list removing elements [1,3,5] will result in a two element list, now indexed as elements one and two, containing what was previously the second and fourth components.
Components that have been deleted using this function are not lost. The recover function can be used to get them back unless the purge function has been executed. Then they are completely gone.
Parameters
which (intArray=[-1])
- indices of which component(s) to removea vector containing unique integers between 0 and one less than the length of the list, -1 for all
log (bool=True)
- Send a message to the logger
-
rename
(filename='', log=True)[source]¶ Give the list a name so it can save itself. use close to save to disk
- The rename function is used to specify the name of the table
associated with this componentlist.
When a componentlist is created it is not associated with an casa table. So when the componentlist is removed from memory its contents are lost. But if a name is attached to the componentlist, using the rename function, then its contents are saved in a table with the specified name when the componentlist is closed
NOTE: that by just using rename the componentlist is not ensured to be on disk; to be sure use close after rename
If the componentlist is created using the open() constructor then this function will rename the table associated with the list to the user specified name. You cannot rename a componentlist that has been opened read only.
Parameters
filename (string='')
- The filename of the tablelog (bool=True)
- Send a message to the logger
-
replace
(which='', list='', whichones=[- 1])[source]¶ Replace components in the list. {f (Not implemented yet) }
- The replace function replaces the components from the list with
the specified components from another list. The source list can be opened readonly and the length of the vectors in the first and third arguments must the the name.
You cannot replace components in a list that has been opened read only.
Parameters
which (int='')
- A vector of indices specifying the components to replace.A vector with indices between 0 and one less than the list length, inclusively
list (record='')
- The list containing the components to copy.A componentlist tool
whichones (intArray=[-1])
- A vector of indices specifying the components to copyA vector with indices between 1 and the length of the
list in the second argument
-
sample
(direction='J2000 00h00m00.00 90d00m00.0', pixellatsize='0.0deg', pixellongsize='0.0deg', frequency='1.4GHz')[source]¶ Sample the flux of the list in a specified direction. (Not implemented yet)
- The sample function will returns a vector containing the flux in
Janskys/pixel of all the components in the list, in the specified direction, at the specified frequency. The returned vector always contains four elements corresponding to the Stokes parameters I,Q,U,V.
Parameters
direction (any='J2000 00h00m00.00 90d00m00.0')
- The direction to sampleany valid direction measure. A valid Direction measure or vector of string or string, e.g me.direction(‘J2000’,’19h30m00’, ‘-20d00m00’) or [‘J2000’,’19h30m00’, ‘-20d00m00’] or ‘J2000 19h30m00 -20d00m00’
pixellatsize (any='0.0deg')
- the x-size of the in pixels to use when samplingany quantity that has angular units.
pixellongsize (any='0.0deg')
- the y-size of the in pixels to use when samplingany quantity that has angular units.
frequency (any='1.4GHz')
- The frequency to sample atAny frequency measure
-
select
(which='')[source]¶ Mark components in the list
- The select function is used to mark the specified components as
``selected’’. This function will be used in conjunction with the planned graphical user interface. Other functions functions in the componentlist tool will behave no differently if a component is marked as ``selected’’.
Components are not selected when the list is initially read from disk or when a new component is added to the list using the simulate function.
Parameters
which (intArray='')
- A vector of indices.
Indices must be between 0 and one less than the list length, inclusively
-
selected
()[source]¶ Determine which components are selected
- The selected function is used to determine which components in a
list are selected. It returns a vector with indices that indicate which components are selected. A zero length vector is returned if no components are selected.
Components are marked as selected using the select function. This function will be used in conjunction with the graphical user interface and other functions in the componentlist tool will behave no differently if a component is marked as ``selected’’ or not.
-
setflux
(which='', value='', unit='Jy', polarization='circular', error='', log=True)[source]¶ Set the flux of the specified components
- The setflux function is used to reassign the flux of the
specified components to a new value. The flux value, unit and polarization can be specified and any number of components can be set to the new value. (Currently, the parameter, error is ignored.)
Parameters
which (int='')
- A vector of indices specifying the components to modify.A vector with indices between 0 and one less than the list length, inclusively
value (any='')
- The flux values for the specified componentsA vector with four real or complex numbers
unit (string='Jy')
- The units of the flux.Any string with the same dimensions as the Jansky
polarization (string='circular')
- The polarization of the value fielderror (any='')
- The error in the value field.A complex vector of length four.
log (bool=True)
- Send a message to the logger
-
setfreq
(which='', value='', unit='GHz', log=True)[source]¶ Set the reference frequency
- The setfreq function sets the reference frequency of the specified
components to a new value. The frequency is defined by separately specifying the value and its units. Use the setfreqframe function to set the frequency reference frame
Parameters
which (int='')
- An index specifying the component to modifyAn integer between 0 and one less than the list length, inclusively
value (double='')
- The new frequency value.A number
unit (string='GHz')
- The units of the frequency.Any string with the same dimensions as the ‘Hz’
log (bool=True)
- Send a message to the logger
-
setfreqframe
(which='', frame='TOPO', log=True)[source]¶ Set the reference frame for the frequency
- The setfreqframe function sets the reference frame for the
reference frequency of the specified components.
Currently the reference frame does not include additional information like when are where the observation took place. Hence no conversion between reference frames is available. In the interim I recommend you always use the same frame.
Parameters
which (int='')
- An index specifying the component to modify.An integer between 0 and one less than the list length, inclusively
frame (string='TOPO')
- The new reference frame,A string like ‘LSRK’, ‘LSRD’, ‘GEO’ or ‘TOPO
log (bool=True)
- Send a message to the logger
-
setlabel
(which='', value='', log=True)[source]¶ Set the label of the specified components
- The setlabel function is used to reassign the label (an arbitrary
text string) of the specified components to a new value.
Parameters
which (int='')
- An index specifying the component to modify.An integer between 0 and one less than the list length, inclusively
value (string='')
- The label for the specified componentslog (bool=True)
- Send a message to the logger
-
setrefdir
(which=1, ra='', dec='', log=True)[source]¶ Set the reference direction
- The setrefdir function sets the reference direction of the
specified components to a new value. The direction is defined by separately specifying the right ascension and the declination.
The right ascension is specified as a string or a real number
Ra can be in standard angle units ‘deg’, ‘rad’, or time formatted as such ‘HH:MM:SS.sss’ eg., ‘19:34:63.8’ or angle formatted as such ‘+DDD.MM.SS.sss’ eg., ‘127.23.12.37’.
Similarly the declination is specified as a string or a real number and the decunit can be any angular unit or ‘angle’ or ‘time’.
Parameters
which (int=1)
- A vector of indices specifying the components to modify.A vector with indices between 0 and one less than the list length, inclusively
ra (any='')
- The RA of the new direction,A formatted string or a number
dec (any='')
- The declination of the new direction.A formatted string or a number
log (bool=True)
- Send a message to the logger
-
setrefdirframe
(which='', frame='', log=True)[source]¶ Set the reference frame for the direction
- The setrefdirframe function sets the reference frame for the
reference direction of the specified components (what a mouthful)!
Currently the reference frame does not include additional information like when and where the observation took place. Hence only reference frames that are independent of this information can be used. This includes the common ones of ‘J2000’, ‘B1950’, and ‘Galactic’. The measures module contains a complete listing of all possible reference frames. The parsing of the reference frame string is case-insensitive.
Parameters
which (int='')
- A vector of indices specifying the components to modify.A vector with indices between 0 and one less than the list length, inclusively
frame (string='')
- The new reference frame,A string like ‘B1950’, ‘J2000’ or ‘galactic’
log (bool=True)
- Send a message to the logger
-
setshape
(which='', type='disk', majoraxis='1.0arcmin', minoraxis='1.0arcmin', positionangle='0.0deg', majoraxiserror='0.0arcmin', minoraxiserror='0.0arcmin', positionangleerror='0.0deg', optionalparms=[0.0], log=True)[source]¶ Change the shape of the component
- The setshape function changes the shape of the specified components
to the user specified shape.
The type argument defines what the sort of new shape to use. This can be either ‘point’, ‘Gaussian’, or ‘disk’. The parsing of this string is case insensitive.
If the shape type is ‘point’ then the remaining arguments in this function are ignored. There are no other parameters needed to specify a point shape.
But if the shape is ‘Gaussian’, or ‘disk’, the remaining arguments are needed to fully specify the shape. The majoraxis, minoraxis and positionangle arguments are quantities (see the quanta module for a definition of a quantity). Hence they can be specified either as with string eg., ‘1arcsec’ or with a record eg., [value=1, unit=’deg’].
The major axis is the width of the larger axis. For the Gaussian shape this is the full width at half maximum. And the minor axis is the width of the orthogonal axis. The positionangle is the specifies the rotation of these two axes with respect to a line connecting the poles of the current direction reference frame. If the angle is positive the the north point of the component moves in the eastern direction.
Parameters
which (int='')
- A vector of indices specifying the components to modify.A vector with indices between 0 and one less than the list length, inclusively
type (string='disk')
- The new shape type.A string that is either ‘point’, ‘Gaussian’, or ‘disk’
majoraxis (any='1.0arcmin')
- The width of the larger axis.A quantity with angular units
minoraxis (any='1.0arcmin')
- The width of the smaller axis.A quantity with angular units
positionangle (any='0.0deg')
- The rotation of the axes with respect tothe reference frame.
A quantity with angular units
majoraxiserror (any='0.0arcmin')
- Error of width of the larger axis.A quantity with angular units
minoraxiserror (any='0.0arcmin')
- Error of the width of the smaller axis.A quantity with angular units
positionangleerror (any='0.0deg')
- Error of the rotation of the axes with respect tothe reference frame.
A quantity with angular units
optionalparms (doubleArray=[0.0])
- optional parameters in a vector (for future use)log (bool=True)
- Send a message to the logger
-
setspectrum
(which='', type='spectral index', index=0.0, tabularfreqs=[100000000000.0], tabularflux=[1.0], tabularframe='LSRK')[source]¶ Change the spectrum of the component
- 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. Extrapolation 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.
Parameters
which (int='')
- The index specifying the component to modify.A value between 0 and one less than the list length, inclusively
type (string='spectral index')
- The new spectrum type.A string that is either ‘constant or ‘spectral index’ or ‘tabular’
index (double=0.0)
- The spectral index.tabularfreqs (doubleArray=[1.0e11])
- The frequencies of for the tabular values, in Hztabularflux (doubleArray=[1.0])
- tabular flux density values, in Jy (same length as tabularfreqs)tabularframe (string='LSRK')
- The frame for which the frequencies given are in
-
setstokesspectrum
(which='', type='spectral index', index=[0.0], tabularfreqs=[100000000000.0], tabulari=[1.0], tabularq=[0.0], tabularu=[0.0], tabularv=[0.0], reffreq='1.4GHz', frame='LSRK')[source]¶ Change the spectrum of the component
- 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 ($lpha_0$) is the spectral index of stokes I ($ I(
u)=I( u_0)({{ u}over{ u_0}})^{lpha_0} $)
The second element ($lpha_1$) is a spectral index for the fractional linear polarization ( $sqrt{{{(Q(
u)^2+U( u)^2)}over{I( u)^2}}} = sqrt{{{(Q( u_0)^2+U( u_0)^2)}over{I( u_0)^2}}}({{ u}over{ u_0}})^{lpha_1}$). $lpha_1=0$ implies constant fractional linear polarization w.r.t frequency.
The third element is a “Rotation Measure” factor, i.e angle of rotation $ heta= lpha_2 (lambda^2 - lambda_0^2)$ of the linear polarization at frequency $
u$ w.r.t frequency $ u_0$.
The fourth element is a spectral index for the fractional spectral polarization ( $ {{V(
u)}over{I( u)}} = {{V( u_0)}over{I( u_0)}}({{ u}over{ u_0}})^{lpha_3}$
If the spectrum is ‘tabular’, then { t index} is ignored but the six parameters { t tabularfreqs, tabulari, tabularq, tabularu, tabularv and tabularframe} are considered. { t tabularfreqs} and { t 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 { t tabularfreqs} is not done. { t tabularfreqs} should be float values in ‘Hz’ { t 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.
Parameters
which (int='')
- The index specifying the component to modify.A value between 0 and one less than the list length, inclusively
type (string='spectral index')
- The new spectrum type.A string that is either ‘constant or ‘spectral index’ or ‘tabular’
index (doubleArray=[0.0])
- The spectral index.tabularfreqs (doubleArray=[1.0e11])
- The frequencies of for the tabular values, in Hztabulari (doubleArray=[1.0])
- tabular Stokes I values, in Jy (same length as tabularfreqs)tabularq (doubleArray=[0.0])
- tabular Stokes Q values, in Jy (same length as tabularfreqs)tabularu (doubleArray=[0.0])
- tabular Stokes U values, in Jy (same length as tabularfreqs)tabularv (doubleArray=[0.0])
- tabular Stokes V values, in Jy (same length as tabularfreqs)reffreq (any='1.4GHz')
- The reference frequency for spectral indexframe (string='LSRK')
- The frame for which the frequencies given are in
-
shapetype
(which='')[source]¶ Returns the shape type of the component
- The shapetype function returns the current shape of the specified
component. The shape defines how the flux of the component varies with direction on the sky. Currently there are three shapes available. These are ‘Point’, ‘Gaussian’, and ‘Disk’. This function returns one of these four strings.
Parameters
which (int='')
- An index specifying which component.An integer between 0 and one less than the list length, inclusively
-
simulate
(howmany=1, log=True)[source]¶ Add some simulated components to the list
- The simulate function adds simulated components to the list. The
simulation criterion is very simple, all the components added are identical! They are point sources at the J2000 north pole with a flux in Stokes I of 1~Jy, and zero in the other polarizations. The spectrum is constant. The ‘set’ functions (eg. setflux, setfreq) can be used to change these parameters to desired ones.
The howmany argument indicates how many components to append to the list.
Parameters
howmany (int=1)
- How many components to simulate, greater than zerolog (bool=True)
- Send a message to the logger
-
sort
(criteria='Polarization', log=True)[source]¶ Sort the components in a list
- The sort function can sort all the components in a list using a
variety of criteria. Currently the following criteria are available:
- Flux: Sorts the list so that the brightest components,
as defined by Stokes I, are at the beginning of the list.
- Position: Sorts the list so that components that are
closest to a reference position, which is currently fixed at (ra,dec)=(0,0), are at the beginning of the list.
- Polarization: Sorts the list so that components with the
largest fractional polarization, sqrt(Q**2+U**2+V**2)/I, are at the front of the list. Components where I=0 are placed at the end of the list.
The parsing of the string containg the sorting criteria is case insensitive. You cannot sort a list that has been opened read only.
Parameters
criteria (string='Polarization')
- a string containg the criteria to use to sort the listlog (bool=True)
- Send a message to the logger
-
spectrumtype
(which='')[source]¶ Returns the spectral shape of the component
- The spectrumtype function returns the current spectral shape of the
specified component. The spectral shape defines how the flux of the component varies with frequency. Currently there are two spectral shapes available. These are ‘Constant’ and ‘Spectral Index’. This function returns one of these two strings.
Parameters
which (int='')
- An index specifying which component.An integer between 0 and one less than the list length, inclusively
-
summarize
(which=- 1)[source]¶ Summarize the specified component to the logger
The summarize function summarizes the contents of the specified components to the logger.
Parameters
which (int=-1)
- An index specifying which component.Unset or an integer between 0 and one less than the list length, inclusive
-