Coverage for /home/warp/casa/atejeda/coverage/build/linux-x86_64/python/2.7/__casac__/componentlist : 0%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# This file was automatically generated by SWIG (http://www.swig.org). # Version 2.0.4 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead.
from sys import version_info if version_info >= (2,6,0): def swig_import_helper(): from os.path import dirname import imp fp = None try: fp, pathname, description = imp.find_module('_componentlist', [dirname(__file__)]) except ImportError: import _componentlist return _componentlist if fp is not None: try: _mod = imp.load_module('_componentlist', fp, pathname, description) finally: fp.close() return _mod _componentlist = swig_import_helper() del swig_import_helper else: import _componentlist del version_info try: _swig_property = property except NameError: pass # Python < 2.2 doesn't have 'property'. def _swig_setattr_nondynamic(self,class_type,name,value,static=1): if (name == "thisown"): return self.this.own(value) if (name == "this"): if type(value).__name__ == 'SwigPyObject': self.__dict__[name] = value return method = class_type.__swig_setmethods__.get(name,None) if method: return method(self,value) if (not static): self.__dict__[name] = value else: raise AttributeError("You cannot add attributes to %s" % self)
def _swig_setattr(self,class_type,name,value): return _swig_setattr_nondynamic(self,class_type,name,value,0)
def _swig_getattr(self,class_type,name): if (name == "thisown"): return self.this.own() method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError(name)
def _swig_repr(self): try: strthis = "proxy of " + self.this.__repr__() except: strthis = "" return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
try: _object = object _newclass = 1 except AttributeError: class _object : pass _newclass = 0
class componentlist(_object): """Proxy of C++ casac::componentlist class""" __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, componentlist, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, componentlist, name) __repr__ = _swig_repr def __init__(self): """__init__(self) -> componentlist""" this = _componentlist.new_componentlist() try: self.this.append(this) except: self.this = this __swig_destroy__ = _componentlist.delete_componentlist __del__ = lambda self : None; def open(self, *args, **kwargs): """ open(self, filename = string(""), nomodify = False, log = True) -> bool
Summary Construct an componentlist from the data in an aipspp table
Description
Use this constructor to construct a componentlist tool by reading the data from an ipspp\ 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 toolootnote{To be more precise the table should have been created using the functions in the ComponentList class (C++).}.
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.
Input Parameters: filename The filename of the table nomodify Should the table be opened read only false log Send a message to the logger true
Example:
cl.open('crux.cl');
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_open(self, *args, **kwargs)
def asciitocomponentlist(self, *args, **kwargs): """ asciitocomponentlist(self, filename, asciifile, refer = string("J2000"), format = string("ST"), direction = initialize_record(""), spectrum = initialize_record(""), flux = initialize_record(""), log = True) -> int
Summary Create a componentlist from an ascii file {bf (Not implemented yet)}
Description
This constructor allows conversion of a number of ascii-file-based formats to componentlists. The formats currently supported are the AIPS star file format, the Caltech model format, and the WENSS, FIRST, and NVSS surveys.
egin{description} \item[AIPS ST file] The AIPS star file describes positions of ``stars'' that one might wish to plot overlaid on some other display. It does not contain source strength information. In the AIPS help file for STARS, the format of the star file is described as follows: egin{verbatim} The text file contains one line per star and each line has up to 7 logical columns containing, in order: 1. X position (Right Ascension 00 00 00.00) 2. Y position (Declination +/-00 00 00.0) 3. Major axis (Full width in arc seconds on sky) 4. Minor axis (Full width in arc seconds on sky) 5. Position Angle (E of N, degrees) 6. Star Type (-1 to 20, integer ) 7. Star label (up to 24 character string) If X and Y are not RA-DEC or DEC-RA, then the logical columns are also 7 actual columns and the units are in AIPS standard units (e.g. degrees, m/s etc. ). In this case the position angle should be given as 0.0, the major axis is the width in the Y coordinate and the minor axis is the width in the X coordinate. For RA and DEC positions, the sexagesimal notation is used (e.g. HH MM SS.SSS -DD MM SS.S) for the positions and arc seconds on the sky are used for the Deltas. The last 5 columns are not required. If the last 5 columns are not given, a value of 1 cell is assumed for the deltas. If the position angle is not included, the default is 0 degrees. If the star type is not included, the default type is a cross. The default is no label string. There are currently 22 different types of star marks. \< 0: No Mark, only the star label is printed 0: Cross 10: Five pointed star 1: Ellipse 11: Star of David 2: Box 12: Seven pointed star 3: Triangle 13: Eight pointed star 4: Diamond 14: Nine pointed star 5: Pentagon 15: Ten pointed star 6: Hexagon 16: 11 pointed star 7: Septagon 17: 12 pointed star 8: Octagon 18: 13 pointed star 9: Nine-gon 19: 14 pointed star 20: Cross with gap \>20: Ellipse The Box (type=2) is different from the diamond in that the star size is the half height and width of the box dimensions. The Box and the Null (\<0) are labeled at RA and Dec plus Delta RA and Delta Dec. The other marks are labeled at the right edge of the of the Rotated RA axis. The CROSS WITH GAP (type=20) has the inner third of the cross removed so the marked object is not over written. nd{verbatim}
For more information, see the AIPS help file for \htmladdnormallink{STARS}{http://www.cv.nrao.edu/cgi-bin/AIPSHELP?STARS}.
Caveats: egin{itemize} \item In AIPS, the following are supported: 1: 1900; 2: B1950; 3: J2000; 4: Galactic 5: OHLSSON Gal.; 6: VAN TULDER Galactic; 7: Super Galactic; if \> 1000 then year assumed. Currently, ipspp\ can support 2 (refer='b1950'), 3 (refer='j2000'), 4 (refer='gal'), 7 (refer='supergal'). If you need any of the others, please contact us.
\item[Caltech] The \htmladdnormallink{Caltech package} {http://astro.caltech.edu/~tjp/citvlb/index.html} uses a format for specifying positions relative to an undefined position. In the documentation for {m modelfit}, the format is described as follows: nd{itemize}
egin{verbatim} Model files are text files that can be typed or printed directly; they can be modified or created using the standard text editors. A model file consists of one line for each component of the model, with up to 7 numbers on each line (in free format):
1. Component flux density (Jy)
2. Distance of center of component from origin (milliarcsec), 'radius'
3. Position angle of center of component with respect to the origin (degrees, North through East), 'theta'
4. Major axis of component (milliarcsec), 'axis'
5. Axial ratio (minor/major, i.e. \< 1), 'ratio'
6. Position angle of major axis (degrees, North through East), 'phi'
7. Type: 0 or 1: elliptical Gaussian (major axis is FWHM) or delta-function (major axis = 0) 2: uniform elliptical disk (major axis is diameter) 3: optically thin spheroid or tapered disk (major axis is diameter) 4: elliptical ring (major axis is diameter) 5: line (major axis is length)
For Gaussians and delta-functions, the Type can be omitted; for delta-functions, the major-axis, axial-ratio, position- angle and type can be omitted. (Not all the programs understand types 2-5.) The 'origin' is an arbitrary phase-reference point. The maximum number of components varies from 600 to 10000, depending on the individual program. nd{verbatim}
Caveats: egin{itemize} \item In ipspp, directions in componentlist are currently absolute only. Hence one must specify the reference direction.
\item[WENSS] The \htmladdnormallink{Westerbork Northern Sky Survey (WENSS)} {http://www.strw.leidenuniv.nl/\%7Edpf/wenss/} is a low-frequency radio survey that covers the whole sky north of delta=30 degree at a wavelength of 92cm to a limiting flux density of approximately 18 mJy (5 sigma). This survey has a resolution of 54'' x 54'' cosec (delta) and a positional accuracy for strong sources of 1.5''. The WSRT Northern Sky Survey catalog is available via a \htmladdnormallink{Web interface}{http://www.strw.leidenuniv.nl/\%7Edpf/wenss/search.html}. Use this interface to search for sources, choose the plain text output, capture the output into a file and then convert.
\item[FIRST] \htmladdnormallink{Faint Images of the Radio Sky at Twenty-cm}{http://sundog.stsci.edu/top.html} -- is a project designed to produce the radio equivalent of the Palomar Observatory Sky Survey over 10,000 square degrees of the North and South Galactic Caps. Using the NRAO Very Large Array (VLA) and an automated mapping pipeline, they produce images with 1.8' pixels, a typical rms of 0.15 mJy, and a resolution of 5'. At the 1 mJy source detection threshold, there are ~90 sources per square degree, ~35\% of which have resolved structure on scales from 2-30'. Go to the \htmladdnormallink{FIRST catalog search page}{http://sundog.stsci.edu/cgi-bin/searchfirst}, search for the sources that you want, cut out only the lines that include the sources, put in a file and then convert.
\item[NVSS] The \htmladdnormallink{NRAO VLA Sky Survey} {http://www.cv.nrao.edu/~jcondon/nvss.html} The NRAO VLA Sky Survey (NVSS) is a radio continuum survey covering the sky north of -40 deg declination. A detailed description appears in the 1998 May issue of The Astronomical Journal (Condon, J. J., Cotton, W. D., Greisen, E. W., Yin, Q. F., Perley, R. A., Taylor, G. B., \& Broderick, J. J. 1998, AJ, 115, 1693). Go to the \htmladdnormallink{NVSS catalog search page}{http://www.cv.nrao.edu/NVSS/NVSS.html}, search for the sources that you want, cut out only the lines that include the sources (you can leave in the alternating lines with error information), put in a file and then convert. nd{itemize}
Caveats: egin{itemize} \item The catalog contains upper limits on some scale sizes. We have chosen to represent these as actual sizes. nd{itemize} nd{description}
Input Parameters: filename Name of output component list table asciifile Name of input ascii file refer Input reference frame B1950 J2000 format Name of format (only ST supported) ST direction Direction measure (for relative coordinates) spectrum Default spectrum field, valid spectrum field [type='Constant', frequency=[type='frequency' , refer='LSR' , m0=[unit='GHz' , value=1.0]] flux Default flux field, valid flux field [value=[0.0, 0.0, 0.0, 0.0], unit='Jy', polarization='Stokes'] log Send a message to the logger true
Example:
mycl := asciitocomponentlist('sgra-stars.cl', 'sgra-stars.stfile', refer='j2000', format='ST')
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_asciitocomponentlist(self, *args, **kwargs)
def concatenate(self, *args, **kwargs): """ concatenate(self, list = initialize_variant(""), which = initialize_vector(1, (int)-1), log = True) -> bool
Summary Append components from another componentlist.
Description
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.
Input Parameters: list list to copy from. Can be a componentlist record or a componentlist file name from disk which which components to copy, -1 unset -1 log Send a message to the logger true
Example:
cl.addcomponent(flux=1.0, dir='J2000 19h00m00 -40d00m00') cl.addcomponent(flux=2.0, dir='J2000 19h10m00 -40d00m00') cl.addcomponent(flux=3.0, dir='J2000 19h00m00 -40d00m00') cl2 = cltool(); cl2.concatenate(cl.torecord(), [0,2]); cl.done() cl2.rename('part_list.cl'); cl2.done() We make a 3 component component list and copies the first and third component to another a componentlist that was initially empty. These components are then saved to the table called part_list.cl.
cl.close() ### make sure we start with empty componentlist cl.concatenate('crux.cl', [0,2]); cl.rename('crux-copy.cl'); cl.done()
This example reads a componentlist from a casa table and copies the first and third component to another a componentlist that was initially empty. These components are then saved to the table called crux-copy.cl.
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_concatenate(self, *args, **kwargs)
def fromrecord(self, *args, **kwargs): """ fromrecord(self, record = initialize_record("")) -> bool
Summary make a componentlist tool from a record
Description
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
Input Parameters: record a component list record
Example:
cl2 = cltool()
cl2.fromrecord(ia.findsources()) cl2.rename('sourcesfound.cl') cl2.done()
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_fromrecord(self, *args, **kwargs)
def torecord(self): """ torecord(self) -> record
Summary convert componentlist to a record
Description
This function allows the componentlist to be converted to a record. Usually useful to pass to other functions in image analysis for e.g
Example:
cl2=cltool() cl.open('mycomp.cl')
cl2.fromrecord(ia.deconvolvecomponentlist(cl.torecord())) cl2.rename('deconvolved_sources.cl') cl2.done()
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_torecord(self)
def remove(self, *args, **kwargs): """ remove(self, which = initialize_vector(1, (int)-1), log = True) -> bool
Summary Remove a component from the list.
Description
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.
Input Parameters: which indices of which component(s) to remove a vector containing unique integers between 0 and one less than the length of the list, -1 for all -1 log Send a message to the logger true
Example:
cl.open('crux.cl') cl.remove(1)
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_remove(self, *args, **kwargs)
def purge(self): """ purge(self) -> bool
Summary Permanently delete removed components.
Description
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.
Example:
cl.open('crux.cl') cl.remove(1) cl.purge()
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_purge(self)
def recover(self, log = True): """ recover(self, log = True) -> bool
Summary Obtain removed components.
Description
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.
Input Parameters: log Send a message to the logger true
Example:
cl.open('crux.cl') cl.remove(1) cl.recover()
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_recover(self, log)
def length(self): """ length(self) -> int
Summary Find the number of components in the list.
Description
The length function returns a non-negative integer that indicates how many components the list currently contains.
Example:
cl.open('crux.cl') n = cl.length()
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_length(self)
def indices(self): """ indices(self) -> std::vector<(int)>
Summary Return a vector of indices. {bf (Not implemented yet)}
Description
The indices function 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 exttt{for} loops as is illustrated in the example below.
Example:
include 'componentlist.g' cl := componentlist('crux.cl'); allcomp := cl.indices(); cl.convertfluxunit(allcomp, 'jy'); cl.convertfluxpol(allcomp, 'stokes'); totalflux := [0,0,0,0]; for (i in allcomp) { totalflux +:= cl.getfluxvalue(i); }
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_indices(self)
def sort(self, *args, **kwargs): """ sort(self, criteria = string("Flux"), log = True) -> bool
Summary Sort the components in a list
Description
The sort function can sort all the components in a list using a variety of criteria. Currently the following criteria are available. egin{description} \item[Flux] Sorts the list so that the brightest components, as defined by the $\mbox{abs}(I)$, are at the beginning of the list. \item[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. \item[Polarization] Sorts the list so that components with the largest fractional polarization, $rac{\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. nd{description} The parsing of the string containg the sorting criteria is case insensitive. You cannot sort a list that has been opened read only.
Input Parameters: criteria a string containg the criteria to use to sort the list Polarization Position Flux log Send a message to the logger true
Example:
cl.open('crux.cl') cl.sort('Polarization')
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_sort(self, *args, **kwargs)
def isphysical(self, *args, **kwargs): """ isphysical(self, which = initialize_vector(1, (int)-1)) -> bool
Summary Check if a component is physically plausible
Description
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: egin{itemize} \item $I \>= \sqrt{Q^2 + U^2 + V^2}$ \item That the flux, when represented using the Stokes representation, has a zero imaginary value. nd{itemize}
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.
Input Parameters: which A vector of indices Indices must be between 0 and one less than the list length, inclusively -1
Example:
cl2 = cltool() cl2.simulate(2) cl2.setflux(1, value=[10, 1+3j, 1-4j, 0], polarization='linear'); print cl2.isphysical([0,1])
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_isphysical(self, *args, **kwargs)
def sample(self, *args, **kwargs): """ sample(self, direction = initialize_variant("J2000 00h00m00.00 90d00m00.0"), pixellatsize = initialize_variant("0.0deg"), pixellongsize = initialize_variant("0.0deg"), frequency = initialize_variant("1.4GHz")) -> std::vector<(double)>
Summary Sample the flux of the list in a specified direction. {bf (Not implemented yet)}
Description
The sample function 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.
Input Parameters: direction The direction to sample any 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' J2000 00h00m00.00 90d00m00.0 pixellatsize the x-size of the in pixels to use when sampling any quantity that has angular units. 0.0deg pixellongsize the y-size of the in pixels to use when sampling any quantity that has angular units. 0.0deg frequency The frequency to sample at Any frequency measure 1.4GHz
Example:
include 'componentlist.g' include 'measures.g' cl := componentlist('crux.cl', readonly=T); dir := dm.direction('J2000', '12h26m35.9', '-63d5m56'); pixelsize := dm.quantity('1arcsec'); flux := cl.sample(dir, pixelsize);
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_sample(self, *args, **kwargs)
def rename(self, *args, **kwargs): """ rename(self, filename, log = True) -> bool
Summary Give the list a name so it can save itself. use close to save to disk
Description
The rename function is used to specify the name of the table associated with this componentlist.
When a componentlist is created using the emptycomponentlist constructor 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
{f NOTE: that by just using { t rename} the componentlist is not ensured to be on disk; to be sure use { t close} after rename}
If the componentlist is created using the componentlist 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.
Input Parameters: filename The filename of the table log Send a message to the logger true
Example:
cl.simulate(1); cl.setshape(0, 'gaussian', '35mas', '27mas', '-10d') cl.setflux(0, [1.0, 0.2, 0.1, 0.01]); cl.rename('smallblob.cl'); cl.close();
cl.open('smallblob.cl') n=cl.length()
This example starts with an empty componentlist tool and then adds one component to it. The parameters of this component are then modified to change the shape and flux and the list saved in the casa table called 'smallblob.cl' The data is not written to disk until the list is closed, and when it is the componentlist is reset. So you need to reopen it if you want to interact with it.
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_rename(self, *args, **kwargs)
def simulate(self, howmany = 1, log = True): """ simulate(self, howmany = 1, log = True) -> bool
Summary Add some simulated components to the list
Description
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.
Input Parameters: howmany How many components to simulate, greater than zero 1 log Send a message to the logger true
Example:
cl.simulate(2) cl.setflux(1, [2.78, 0, 0, 0]); cl.rename('test.cl'); cl.close();
This example creates a componentlist with two components. The setflux function is used to modify the second component. The list is then saved on disk. I use short scripts like this a lot during testing.
I expect bad things will happen if you save the list to disk, using the close function, before having shut down the editor gui (using the done button) or if you modify the same component using any of the set functions while it is being modified by the gui.
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_simulate(self, howmany, log)
def addcomponent(self, *args, **kwargs): """ addcomponent(self, flux = initialize_variant(""), fluxunit = string("Jy"), polarization = string("Stokes"), dir = initialize_variant("J2000 00h00m00.0 90d00m00.0"), shape = string("point"), majoraxis = initialize_variant("2.0arcmin"), minoraxis = initialize_variant("1.0arcmin"), positionangle = initialize_variant("0.0deg"), freq = initialize_variant("LSRK 1.415GHz"), spectrumtype = string("constant"), index = 1.0, optionalparms = initialize_vector(1, (double)0.0), label = string("")) -> bool
Summary Add a component to the list
Description
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. egin{description} \item[flux, fluxunit, polarization] See the setflux function. \item[ra, raunit, dec, decunit] See the setrefdir function. \item[dirframe] See the setrefdirframe function. \item[shape, majoraxis, minoraxis, positionangle] See the setshape function. \item[freq] A frequency quantity which is split into a value and units and passed to the setfreq function. \item[freqframe] See the setfreq function. \item[spectrumtype, index] See the setspectrum function.
OR
setspectrum \item[label] See the setlabel function. nd{description}
Input Parameters: flux The flux value. A vector with four real or complex numbers fluxunit The units of the flux. Any string with the same dimensions as the Jansky Jy polarization The polarization of the value field. ``Stokes'', ``linear'' or ``circular'' Circular Linear Stokes dir 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 Dec J2000 00h00m00.0 90d00m00.0 shape The new shape type. A string that is either 'point', 'Gaussian', 'disk', or 'limbdarkeneddisk' disk limbdarkeneddisk Gaussian point majoraxis The width of the larger axis. A quantity with angular units 2.0arcmin minoraxis The width of the smaller axis. A quantity with angular units 1.0arcmin positionangle The rotation of the axes with respect to the reference frame. A quantity with angular units 0.0deg freq 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' LSRK 1.415GHz spectrumtype The spectrum type, a string that is either 'constant' or 'spectral index' spectral index constant index The spectral index 1.0 optionalparms optional parameters in vector (currently only used for limbdarkeneddisk) 0.0 label The label for the component
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_addcomponent(self, *args, **kwargs)
def close(self, log = True): """ close(self, log = True) -> bool
Summary Save the componentlist to disk and reset its state.
Description
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.
Input Parameters: log Send a message to the logger true
Example:
See the example for the rename function.
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_close(self, log)
def edit(self, *args, **kwargs): """ edit(self, which, log = True) -> bool
Summary Start up the component editor gui {bf (Not implemented yet)}
Description
The edit function starts up a graphical user interface which allows the user to view and manipulate individual components. The which argument specifies the component to edit.
The component being edited is copied into the componenteditor tool. Hence if you add or remove components or change the order of components in the list while the component is in the editor it will be put back in the wrong place! So do not manipulate the list while editting a component. It is also suggested you only edit one component at a time.
Input Parameters: which An index specifying which component. An integer between 0 and one less than the list length no default log Send a message to the logger true
Example:
See the example for the simulate function.
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_edit(self, *args, **kwargs)
def done(self): """ done(self) -> bool
Summary Delete the componentlist tool
Description
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.
Example:
See the example for the rename function.
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_done(self)
def select(self, *args, **kwargs): """ select(self, which) -> bool
Summary Mark components in the list
Description
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.
Input Parameters: which A vector of indices. Indices must be between 0 and one less than the list length, inclusively
Example:
cl.open('crux.cl') cl.select([1,3])
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_select(self, *args, **kwargs)
def deselect(self, *args, **kwargs): """ deselect(self, which) -> bool
Summary Unmark components in the list
Description
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. Deselecting a component that is already deselected is perfectly valid and results in no change.
Input Parameters: which A vector of indices Indices must be between 0 and one less than the list length, inclusively
Example:
cl.open('crux.cl') cl.select([1,3]) cl.deselect([2,3])
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_deselect(self, *args, **kwargs)
def selected(self): """ selected(self) -> std::vector<(int)>
Summary Determine which components are selected
Description
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.
Example:
cl.open('crux.cl') cl.select([1,3]) cl.deselect([2,3]) cl.selected()
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_selected(self)
def getlabel(self, *args, **kwargs): """ getlabel(self, which) -> string
Summary Get the label of the specified component
Description
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.
Input Parameters: which An index specifying which component. An integer between 0 and one less than the list length, inclusively
Example:
cl.open('crux.cl') cl.getlabel(1)
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_getlabel(self, *args, **kwargs)
def setlabel(self, *args, **kwargs): """ setlabel(self, which, value, log = True) -> bool
Summary Set the label of the specified components
Description
The setlabel function is used to reassign the label (an arbitrary text string) of the specified components to a new value.
Input Parameters: which An index specifying the component to modify. An integer between 0 and one less than the list length, inclusively no default value The label for the specified components log Send a message to the logger true
Example:
cl.open('centarusA.cl') cl.setlabel(1, 'Core')
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_setlabel(self, *args, **kwargs)
def getfluxvalue(self, *args, **kwargs): """ getfluxvalue(self, which) -> std::vector<(double)>
Summary Get the flux value of the specified component
Description
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.
Input Parameters: which An index specifying which component. An integer between 0 and one less than the list length, inclusively no default
Example:
cl.open('crux.cl'); flux = cl.getfluxvalue(1); unit = cl.getfluxunit(1);
This example returns the values, units, polarization and error of the first component in the list.
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_getfluxvalue(self, *args, **kwargs)
def getfluxunit(self, *args, **kwargs): """ getfluxunit(self, which) -> string
Summary Get the flux unit of the specified component
Description
The getfluxunit function returns the units of the flux of the specified component. The actual values are obtained using the getfluxvalue function.
Input Parameters: which An index specifying which component. An integer between 0 and one less than the list length, inclusively
Example:
See the example for the getfluxvalue function.
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_getfluxunit(self, *args, **kwargs)
def getfluxpol(self, *args, **kwargs): """ getfluxpol(self, which) -> string
Summary Get the polarization representation for the flux of the specified component {bf (Not implmented yet)}
Description
The getfluxunit function returns the polarization representation of the flux of the specified component. The actual values are obtained using the getfluxvalue function.
Input Parameters: which An index specifying which component. An integer between 0 and one less than the list length, inclusively
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_getfluxpol(self, *args, **kwargs)
def getfluxerror(self, *args, **kwargs): """ getfluxerror(self, which) -> std::vector<(double)>
Summary Get the error in the flux of the specified component
Description
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.
Input Parameters: which Index specifying which component. An integer between 0 and one less than the list length, inclusively
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_getfluxerror(self, *args, **kwargs)
def setflux(self, *args, **kwargs): """ setflux(self, which, value = initialize_variant(""), unit = string("Jy"), polarization = string("Stokes"), error = initialize_variant(""), log = True) -> bool
Summary Set the flux of the specified components
Description
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.)
Input Parameters: which A vector of indices specifying the components to modify. A vector with indices between 0 and one less than the list length, inclusively value The flux values for the specified components A vector with four real or complex numbers unit The units of the flux. Any string with the same dimensions as the Jansky Jy polarization The polarization of the value field circular linear Stokes error The error in the value field. A complex vector of length four. log Send a message to the logger true
Example:
cl.open('crux.cl'); cl.setflux(0, [1,0,0,0], unit='jy', polarization='Stokes', error=[.3, 0, 0, 0])
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_setflux(self, *args, **kwargs)
def convertfluxunit(self, *args, **kwargs): """ convertfluxunit(self, which, unit = string("Jy")) -> bool
Summary Change (convert) the flux units of the specified components
Description
The convertfluxunit function is used to convert the flux to another unit. The units mph{must} have the same dimensions as the Jansky.
Input Parameters: which A vector of indices specifying the components to modify. A vector with indices between 0 and one less than the list length, inclusively unit The units of the flux. Any string with the same dimensions as the Jansky Jy
Example:
cl.open('crux.cl') print cl.getfluxvalue(1) cl.convertflux(1, 'WU') print cl.getfluxvalue(1)
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_convertfluxunit(self, *args, **kwargs)
def convertfluxpol(self, *args, **kwargs): """ convertfluxpol(self, which, polarization = string("Stokes")) -> bool
Summary Change (convert) the polarization representation of the specified components
Description
The convertfluxpol function is used to convert the flux to another polarization representation. There are are three representations used, namely , 'Stokes', 'linear' \& 'circular'
Input Parameters: which A vector of indices specifying the components to modify. A vector with indices between 0 and one less than the list length, inclusively polarization The new polarization representation circular linear Stokes
Example:
cl.open('centarusA.cl') print cl.getfluxvalue(1) cl.convertfluxpol(1, 'linear') print cl.getfluxvalue(1)
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_convertfluxpol(self, *args, **kwargs)
def getrefdir(self, *args, **kwargs): """ getrefdir(self, which) -> record
Summary Return the reference direction
Description
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.
Input Parameters: which An index specifying which component. An integer between 0 and one less than the list length, inclusively
Example:
cl.open('crux.cl') dir = cl.getrefdir(1)
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_getrefdir(self, *args, **kwargs)
def getrefdirra(self, *args, **kwargs): """ getrefdirra(self, which, unit = string("deg"), precision = 6) -> string
Summary Get the RA of the reference direction. {bf (Not implemented not) }
Description
The getrefdirra function returns the right ascension 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 latitude or the azimuthal angle.
The unit argument specifies the units for the returned value. It can be any angular unit (eg. 'deg', 'rad', 'arcsec', 'mas') or it can be 'angle' or 'time'. If it is 'angle' then the returned string is formatted in degrees, minutes, seconds ie., '+DDD.MM.SS.sss'. If it is 'angle' then the returned string is formatted in hours, minutes, seconds ie., 'HH:MM:SS.sss'.
The precision argument controls the numerical precision of the returned value. For the angular units it controls how many digits are in the returned string. For the 'angle' unit, precisions of two, four \& six control whether the degrees, degrees,minutes or degrees, minutes \& seconds are returned. Higher precisions increase the precision of the seconds field. Similarly, for the 'time' unit precisions of two, four \& six control whether the hours, hours, minutes or hours, minutes \& seconds are returned.
All directions are stored internally in double precision.
Input Parameters: which An index specifying which component. An integer between 0 and one less than the list length, inclusively unit The angular unit of the returned value. Any string containing an angular unit or 'angle' or 'time' deg precision The number of digits in the returned string. Numbers between 1 and 16 make the most sense 6
Example:
include 'componentlist.g' cl := componentlist('crux.cl'); print 'The first component is at RA: ', cl.getrefdirra(1, 'time'), ' Dec: ', cl.getrefdirdec(1, 'angle'), ' (', cl.getrefdirframe(1), ')'
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_getrefdirra(self, *args, **kwargs)
def getrefdirdec(self, *args, **kwargs): """ getrefdirdec(self, which, unit = string("deg"), precision = 6) -> string
Summary Get the declination of the reference direction.{bf (Not implemented yet)}
Description
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.
Input Parameters: which An index specifying which component. An integer between 0 and one less than the list length, inclusively unit The angular unit of the returned value. Any string containing an angular unit or 'angle' or 'time' deg precision The number of digits in the returned string. Numbers between 1 and 16 make the most sense 6
Example:
See the example for the getrefdirra function.
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_getrefdirdec(self, *args, **kwargs)
def getrefdirframe(self, *args, **kwargs): """ getrefdirframe(self, which) -> string
Summary Get the reference frame of the reference direction.
Description
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'.
Input Parameters: which An index specifying which component. An integer between 0 and one less than the list length, inclusively
Example:
See the example for the getrefdirra function.
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_getrefdirframe(self, *args, **kwargs)
def setrefdir(self, *args, **kwargs): """ setrefdir(self, which = 1, ra = initialize_variant(""), dec = initialize_variant(""), log = True) -> bool
Summary Set the reference direction
Description
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'.
Input Parameters: which A vector of indices specifying the components to modify. A vector with indices between 0 and one less than the list length, inclusively 1 ra The RA of the new direction, A formatted string or a number dec The declination of the new direction. A formatted string or a number log Send a message to the logger true
Example:
cl.simulate(3) cl.setrefdir(0, '12:26:35.9', '-63.5.56') cl.setrefdir(1, '12h26m35.9', '-63d5m56') cl.setrefdir(2, '-173.35deg', '-1.10128rad') cl.rename('testcls.cl') # write to disk
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_setrefdir(self, *args, **kwargs)
def setrefdirframe(self, *args, **kwargs): """ setrefdirframe(self, which, frame, log = True) -> bool
Summary Set the reference frame for the direction
Description
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.
Input Parameters: which A vector of indices specifying the components to modify. A vector with indices between 0 and one less than the list length, inclusively frame The new reference frame, A string like 'B1950', 'J2000' or 'galactic' log Send a message to the logger true
Example:
cl.open('crux.cl'); cl.setrefdirframe(0, 'B1950');
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_setrefdirframe(self, *args, **kwargs)
def convertrefdir(self, *args, **kwargs): """ convertrefdir(self, which, frame) -> bool
Summary Convert the reference direction to a new frame
Description
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.
Input Parameters: which A vector of indices specifying the components to modify. A vector with indices between 0 and one less than the list length, inclusively frame The new reference frame A string like 'B1950', 'J2000' or 'galactic'
Example:
cl.open('crux.cl'); cl.convertrefdirframe(0, 'J2000');
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_convertrefdir(self, *args, **kwargs)
def shapetype(self, *args, **kwargs): """ shapetype(self, which) -> string
Summary Returns the shape type of the component
Description
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', 'Disk', and 'Limbdarkeneddisk' (experimental). This function returns one of these four strings.
Input Parameters: which An index specifying which component. An integer between 0 and one less than the list length, inclusively
Example:
cl.open('crux.cl') print 'The first component has a', cl.shapetype(0), ' shape'
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_shapetype(self, *args, **kwargs)
def getshape(self, *args, **kwargs): """ getshape(self, which) -> record
Summary Return the shape parameters the component
Description
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.
Input Parameters: which An index specifying which component. An integer between 0 and one less than the list length, inclusively
Example:
See the examples for the setshape \& convertshape functions.
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_getshape(self, *args, **kwargs)
def setshape(self, *args, **kwargs): """ setshape(self, which, type = string("Point"), majoraxis = initialize_variant("1.0arcmin"), minoraxis = initialize_variant("1.0arcmin"), positionangle = initialize_variant("0.0deg"), majoraxiserror = initialize_variant("0.0arcmin"), minoraxiserror = initialize_variant("0.0arcmin"), positionangleerror = initialize_variant("0.0deg"), optionalparms = initialize_vector(1, (double)0.0), log = True) -> bool
Summary Change the shape of the component
Description
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', 'disk', or 'limbdarkeneddisk'. The parsing of this string is case insensitive. The 'limbdarkeneddisk' is an experimental disk model with the limb-darkening effect, where the sky brigtness is described as {${I=I_o (1-(r/R)^2)^{n/2}}$} with R being apparent body radius. The n can be set in optionalparms (if it is not set, the default value, 0.0 will be used).
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', 'disk', or 'limbdarkeneddisk', 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.
Input Parameters: which A vector of indices specifying the components to modify. A vector with indices between 0 and one less than the list length, inclusively type The new shape type. A string that is either 'point', 'Gaussian', 'disk'i, or 'limbdarkeneddisk' disk limbdarkeneddisk Gaussian Point majoraxis The width of the larger axis. A quantity with angular units 1.0arcmin minoraxis The width of the smaller axis. A quantity with angular units 1.0arcmin positionangle The rotation of the axes with respect to the reference frame. A quantity with angular units 0.0deg majoraxiserror Error ~The width of the larger axis. A quantity with angular units 0.0arcmin minoraxiserror Error of the width of the smaller axis. A quantity with angular units 0.0arcmin positionangleerror Error of the rotation of the axes with respect to the reference frame. A quantity with angular units 0.0deg optionalparms optional parameters in a vector (for limbdarkeneddisk) 0.0 log Send a message to the logger true
Example:
cl.open('crux.cl', nomodify=False) cl.setshape(3, 'disk', '45mas', '45mas') print cl.getshape(3)['majoraxis']
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_setshape(self, *args, **kwargs)
def convertshape(self, *args, **kwargs): """ convertshape(self, which, majoraxis = string("arcmin"), minoraxis = string("arcmin"), positionangle = string("deg")) -> bool
Summary Change the units of the shape parameters {bf (Not implemented yet) }
Description
The convertshape function changes the units of the specified shape parameters on the specified components. When changing the units it also converts the values so that overall the angle has not changed.
Depending on the component shape some arguments of this function are ignored. If the shape type is 'point', then all but the which argument are ignored. This function is useless for points.
If the shape is a 'gaussian' or 'disk' then this will modify the units of the major and minor axes and the positionangle. Use the getshape function to see these parameters using the new units.
Input Parameters: which A vector of indices specifying the components to modify. A vector with indices between 0 and one less than the list length, inclusively majoraxis The units to use on the larger axis. A string with angular units rad deg mas arcsec arcmin minoraxis The units to use on the smaller axis. A string with angular units rad deg mas arcsec arcmin positionangle The units to use for the rotation of these axes. A string with angular units rad deg
Example:
include 'componentlist.g' cl := componentlist('crux.cl'); cl.convertshape(3, 'arcsec', 'arcsec'); print cl.getshape(3).minoraxis;
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_convertshape(self, *args, **kwargs)
def spectrumtype(self, *args, **kwargs): """ spectrumtype(self, which) -> string
Summary Returns the spectral shape of the component
Description
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.
Input Parameters: which An index specifying which component. An integer between 0 and one less than the list length, inclusively
Example:
cl.open('crux.cl') print 'The first component has a', cl.spectrumtype(1), ' spectrum'
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_spectrumtype(self, *args, **kwargs)
def getspectrum(self, *args, **kwargs): """ getspectrum(self, which) -> record
Summary Return the spectral parameters the component
Description
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.
Input Parameters: which An index specifying which component. An integer between 0 and one less than the list length, inclusively
Example:
See the examples for the setspectrum \& getspectrum functions.
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_getspectrum(self, *args, **kwargs)
def setstokesspectrum(self, *args, **kwargs): """ setstokesspectrum(self, which, type = string("spectral index"), index = initialize_vector(1,(double)0.0), tabularfreqs = initialize_vector(1,(double)1.0e11), tabulari = initialize_vector(1,(double)1.0), tabularq = initialize_vector(1,(double)0.0), tabularu = initialize_vector(1,(double)0.0), tabularv = initialize_vector(1,(double)0.0), reffreq = initialize_variant("1.4GHz"), frame = string("LSRK")) -> bool
Summary 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 { t 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.
Input Parameters: which The index specifying the component to modify. A value between 0 and one less than the list length, inclusively type The new spectrum type. A string that is either 'constant or 'spectral index' or 'tabular' spectral index spectral index constant tabular index The spectral index. A 4-element vector of real numbers 0.0 tabularfreqs The frequencies of for the tabular values, in Hz 1.0e11 tabulari tabular Stokes I values, in Jy (same length as tabularfreqs) 1.0 tabularq tabular Stokes Q values, in Jy (same length as tabularfreqs) 0.0 tabularu tabular Stokes U values, in Jy (same length as tabularfreqs) 0.0 tabularv tabular Stokes V values, in Jy (same length as tabularfreqs) 0.0 reffreq The reference frequency for spectral index 1.4GHz frame The frame for which the frequencies given are in LSRK
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 ###add first component 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
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_setstokesspectrum(self, *args, **kwargs)
def setspectrum(self, *args, **kwargs): """ setspectrum(self, which, type = string("spectral index"), index = 0.0, tabularfreqs = initialize_vector(1,(double)1.0e11), tabularflux = initialize_vector(1,(double)1.0), tabularframe = string("LSRK")) -> bool
Summary 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 { t index} argument is needed to fully specify the spectrum by using the index argument.
If the spectrum is 'tabular', then { t index} is ignored but the three parameters { t tabularfreqs, tabularflux and tabularframe} are considered. { t tabularfreqs} and { t 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 { t tabularfreqs} is not done. { t tabularfreqs} should be float values in 'Hz' { t 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.
Input Parameters: which The index specifying the component to modify. A value between 0 and one less than the list length, inclusively type The new spectrum type. A string that is either 'constant or 'spectral index' or 'tabular' spectral index spectral index constant tabular index The spectral index. 0.0 tabularfreqs The frequencies of for the tabular values, in Hz 1.0e11 tabularflux tabular flux density values, in Jy (same length as tabularfreqs) 1.0 tabularframe The frame for which the frequencies given are in LSRK
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 erb|[-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.
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_setspectrum(self, *args, **kwargs)
def getfreq(self, *args, **kwargs): """ getfreq(self, which) -> record
Summary Get the reference frequency {bf (Not implemented yet) }
Description
The getfreq function returns, as a frequency measure, the reference frequency for the specified component. At the reference frequency the flux of the component is the value obtained with the getfluxvalue function. The flux may be different at other frequencies, depending on the components spectral shape.
If the spectral shape is constant then changing the reference frequency will not affect the spectrum of the component.
Input Parameters: which An index specifying which component. An integer between 0 and one less than the list length, inclusively
Example:
include 'componentlist.g' cl := componentlist('centarusA.cl'); f := cl.getfreq(2);
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_getfreq(self, *args, **kwargs)
def getfreqvalue(self, *args, **kwargs): """ getfreqvalue(self, which) -> double
Summary Get the reference frequency value {bf (Not implemeted yet) }
Description
The getfreqvalue function returns as a floating point number the value of the reference frequency. To fully interpret this value you should also use the frequency unit, obtained using the getfrequnit function and the frequency reference frame, obtained using the getfrequnit function
Input Parameters: which An index specifying which component. An integer between 0 and one less than the list length, inclusively
Example:
include 'componentlist.g' cl := componentlist('centarusA.cl'); print 'The reference frequency is ', cl.getfreqvalue(1), ' ', cl.getfrequnit(1), '(', cl.getfreqframe(1), ')'
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_getfreqvalue(self, *args, **kwargs)
def getfrequnit(self, *args, **kwargs): """ getfrequnit(self, which) -> string
Summary Get the reference frequency unit {bf (Not implemeted yet) }
Description
The getfrequnit function returns as a string that defines the units of the reference frequency. This unit should be used in conjunction with the getfreqvalue function.
Input Parameters: which An index specifying which component. An integer between 0 and one less than the list length, inclusively
Example:
See the example for the getfreqvalue function.
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_getfrequnit(self, *args, **kwargs)
def getfreqframe(self, *args, **kwargs): """ getfreqframe(self, which) -> string
Summary Get the reference frequency frame {bf (Not implemeted yet) }
Description
The getfreqframe function returns as a string the reference frame of the reference frequency of the specified component.
See the measures module for a description of the available frequency reference frames. Common frames are, 'LSR', 'TOPO' and 'GEO'.
The frame string is always returned in upper case.
Input Parameters: which An index specifying which component. An integer between 0 and one less than the list length, inclusively
Example:
See the example for the getfreqvalue function.
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_getfreqframe(self, *args, **kwargs)
def setfreq(self, *args, **kwargs): """ setfreq(self, which, value, unit = string("'GHz'"), log = True) -> bool
Summary Set the reference frequency
Description
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
Input Parameters: which An index specifying the component to modify An integer between 0 and one less than the list length, inclusively no default value The new frequency value. A number unit The units of the frequency. Any string with the same dimensions as the 'Hz' 'GHz' log Send a message to the logger true
Example:
cl.open('centarusA.cl') cl.setfreq(1, 1.415, 'GHz')
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_setfreq(self, *args, **kwargs)
def setfreqframe(self, *args, **kwargs): """ setfreqframe(self, which, frame = string("LSRK"), log = True) -> bool
Summary Set the reference frame for the frequency
Description
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.
Input Parameters: which An index specifying the component to modify. An integer between 0 and one less than the list length, inclusively frame The new reference frame, A string like 'LSRK', 'LSRD', 'GEO' or 'TOPO TOPO GEO LSRD LSRK log Send a message to the logger true
Example:
cl.open('centarusA.cl') cl.setfreqframe(0, 'LSRK')
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_setfreqframe(self, *args, **kwargs)
def convertfrequnit(self, *args, **kwargs): """ convertfrequnit(self, which, unit = string("'GHz'")) -> bool
Summary Convert the reference frequency to a new unit
Description
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'.
Input Parameters: which An index specifying the component to modify. An integer between 0 and one less than the list length, inclusively unit The new frequency unit. Any string with the same dimensions as the 'Hz' 'GHz'
Example:
cl.open('centarusA.cl'); cl.convertfrequnit(1, 'kHz');
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_convertfrequnit(self, *args, **kwargs)
def getcomponent(self, *args, **kwargs): """ getcomponent(self, which, iknow = False) -> record
Summary Extract a component from the list.
Description
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 aips++ and you are urged to use the get functions to extract information about a component.
Input Parameters: which index of which component to extract. integers between 0 and one less than the length of the list, inclusively iknow Suppress the warning message false
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_getcomponent(self, *args, **kwargs)
def add(self, *args, **kwargs): """ add(self, thecomponent, iknow = True) -> bool
Summary Add a component to the list.
Description
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.
Input Parameters: thecomponent A record that represents a component. any record that contains the required fields iknow Suppress the warning message true
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_add(self, *args, **kwargs)
def replace(self, *args, **kwargs): """ replace(self, which, list, whichones = initialize_vector(1, (int)-1)) -> bool
Summary Replace components in the list. {bf (Not implemented yet) }
Description
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.
Input Parameters: which A vector of indices specifying the components to replace. A vector with indices between 0 and one less than the list length, inclusively list The list containing the components to copy. A componentlist tool whichones A vector of indices specifying the components to copy A vector with indices between 1 and the length of the list in the second argument -1
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_replace(self, *args, **kwargs)
def summarize(self, *args, **kwargs): """ summarize(self, which = -1) -> bool
Summary Summarize the specified component to the logger
Description
The summarize function summarizes the contents of the specified components to the logger.
Input Parameters: which An index specifying which component. Unset or an integer between 0 and one less than the list length, inclusive -1
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_summarize(self, *args, **kwargs)
def iscomponentlist(self, *args, **kwargs): """ iscomponentlist(self, tool) -> bool
Summary Is the argument a componentlist tool? {bf (Not implemented yet) }
Description
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.
Input Parameters: tool The variable that you wish to test
Example:
include 'componentlist.g' if (iscomponentlist(cl)) { cl.simulate(2); } else { fail 'Not a componentlist'; }
--------------------------------------------------------------------------------
""" return _componentlist.componentlist_iscomponentlist(self, *args, **kwargs)
componentlist_swigregister = _componentlist.componentlist_swigregister componentlist_swigregister(componentlist)
# This file is compatible with both classic and new-style classes.
|