Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatools/componentlist.py: 61%
135 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-31 19:53 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-31 19:53 +0000
1##################### generated by xml-casa (v2) from componentlist.xml #############
2##################### 43a16d9ee24c4de1d5c37387c410a8fa ##############################
3from __future__ import absolute_import
4from .__casac__.componentlist import componentlist as _componentlist
6from .errors import create_error_string
7from .typecheck import CasaValidator as _validator
8_pc = _validator( )
9from .coercetype import coerce as _coerce
12class componentlist:
13 _info_group_ = """components"""
14 _info_desc_ = """A tool for the manipulation of groups of components"""
15 ### self
16 def __init__(self, *args, **kwargs):
17 """Use this constructor to construct a componentlist tool that does not
18 contain any components. Components can be appended to the list using
19 the addcomponent or simulate functions,
20 and the list can be stored to disk by giving it a name with cl.rename
22 """
23 self._swigobj = kwargs.get('swig_object',None)
24 if self._swigobj is None:
25 self._swigobj = _componentlist()
27 def open(self, filename='', nomodify=False, log=True):
28 """Use this constructor to construct a componentlist tool by reading
29 the data from an table. To ensure that this table contains
30 all the necessary columns and to allow the table format to be
31 enhanced in the future, it is highly recommended that the table be
32 created using a componentlist tool.
34 The table that contains the componentlist may be opened read-only by
35 setting the readonly flag to True. When this is done some of the
36 functions in the componentlist tool cannot be used. These include
37 the ``set'', ``convert'', ``remove'', ``replace'', ``purge'',
38 ``recover'', and ``sort'' functions.
40 """
41 return self._swigobj.open(filename, nomodify, log)
43 def asciitocomponentlist(self, filename, asciifile, refer='J2000', format='ST', direction={ }, spectrum={ }, flux={ }, log=True):
44 """This constructor will allow conversion of a number of ascii-file-based
45 formats to componentlists.
47 """
48 return self._swigobj.asciitocomponentlist(filename, asciifile, refer, format, direction, spectrum, flux, log)
50 def concatenate(self, list=[ ], which=[ int(-1) ], log=True):
51 """The concatenate function copies the specified component(s), from
52 the specified to list, to the end of the current list. The
53 components are specified by numbering them from one to the length
54 of the list. You cannot append components to a list that has been
55 opened read only but the list you are copying from may be
56 readonly.
58 You use a vector of indices to copy a number of components at
59 once. By default all components are copied.
61 """
62 return self._swigobj.concatenate(list, which, log)
64 def fromrecord(self, record={ }):
65 """This function allows the componentlist records that are returned
66 by other functions (for e.g from imageanalysis tool) be converted
67 to a tool to be manipulated or to be saved on disk
70 """
71 return self._swigobj.fromrecord(record)
73 def haskeyword(self, keyword='metadata'):
74 """Does the attached component list table have the specified keyword? This
75 method will not work for in-memory componentlists. That is, the componentlist
76 must exist on disk. If not, an exception is thrown. This method is for
77 convenience for string keywords and is not meant as a replacement for the
78 table tool API.
81 """
82 return self._swigobj.haskeyword(keyword)
84 def putkeyword(self, keyword='metadata', value=[ ]):
85 """Set the specified keyword in the componentlist table. If the keyword
86 already exists in the table, it will be overwritten with this specified
87 value. The value can be any type that CASA supports as an input
88 parameter to tool methods. This method will not work for in-memory
89 componentlists. That is, the componentlist must exist on disk. If not,
90 an exception is thrown. This method is for convenience for string
91 keywords and is not meant as a replacement for the table tool API.
93 """
94 return self._swigobj.putkeyword(keyword, value)
96 def getkeyword(self, keyword='metadata'):
97 """Get the specified keyword in the componentlist table. This method
98 will not work for in-memory componentlists. That is, the componentlist
99 must exist on disk. If not, an exception is thrown. If the specified
100 keyword does not exist in the table, an exception is thrown. This
101 method is for convenience for string keywords and is not meant as a
102 replacement for the table tool API.
104 """
105 return self._swigobj.getkeyword(keyword)
107 def torecord(self):
108 """This function allows the componentlist to be converted to a
109 record. Usually useful to pass to other functions in image
110 analysis for e.g
113 """
114 return self._swigobj.torecord()
116 def remove(self, which=[ int(-1) ], log=True):
117 """The remove function removes the specified component(s) from the
118 list. Components are specified by numbering them from one to the
119 length of the list. So removing component one will remove the
120 first component. After using this function all the
121 remaining components will be shuffled down so that component two
122 becomes component one. You cannot remove components from a list
123 that has been opened read only.
125 You can specify a vector of indices to remove a number of
126 components at once. For example in a five element list removing
127 elements [1,3,5] will result in a two element list, now indexed as
128 elements one and two, containing what was previously the second
129 and fourth components.
131 Components that have been deleted using this function are not
132 lost. The recover function can be used to get them back unless the
133 purge function has been executed. Then they are completely gone.
136 """
137 return self._swigobj.remove(which, log)
139 def purge(self):
140 """The remove function deletes components from the list but does not
141 remove them from memory. They remain accessible and can be
142 obtained with the recover function. The purge function frees up
143 the memory occupied by the removed components. You cannot use the
144 recover function to obtain the removed components after the purge
145 function has been called.
148 """
149 return self._swigobj.purge()
151 def recover(self, log=True):
152 """The recover function appends components to the end of the list
153 that have been deleted with the remove function. This does not
154 include components that were removed before the purge function was
155 last executed.
157 """
158 return self._swigobj.recover(log)
160 def length(self):
161 """The length function returns a non-negative integer that
162 indicates how many components the list currently contains.
164 """
165 return self._swigobj.length()
167 def indices(self):
168 """The indices function will returns a vector of non-negative
169 integers that can be used to index through the list. This vector
170 always contains the integers starting at one and increasing
171 sequentially to the length of the list. Its main use is in for
172 loops as is illustrated in the example below.
174 """
175 return self._swigobj.indices()
177 def sort(self, criteria='Flux', log=True):
178 """The sort function can sort all the components in a list using a
179 variety of criteria. Currently the following criteria are
180 available:
181 Flux: Sorts the list so that the brightest components,
182 as defined by Stokes I, are at the beginning of the list.
183 Position: Sorts the list so that components that are
184 closest to a reference position, which is currently fixed at
185 (ra,dec)=(0,0), are at the beginning of the list.
186 Polarization: Sorts the list so that components with the
187 largest fractional polarization, sqrt(Q**2+U**2+V**2)/I, are
188 at the front of the list. Components where I=0 are placed at
189 the end of the list.
190 The parsing of the string containg the sorting criteria is case
191 insensitive. You cannot sort a list that has been opened read only.
193 """
194 return self._swigobj.sort(criteria, log)
196 def isphysical(self, which=[ int(-1) ]):
197 """The isphysical function is used to check if the specified
198 components meet a number of criteria that must be true if the
199 component could be used to model a physical process. These
200 criteria are:
201 1. I >= sqrt(Q**2 + U**2 + V**2)
202 2. That the flux, when represented using the Stokes
203 representation, has a zero imaginary value.
205 The ``Flux properties'' section of the ComponentModels module
206 documentation describes how it is possible to generate a
207 component which has non-zero imaginary value in the Stokes
208 representation.
210 It is possible to check a number of components at once by
211 specifying the indicies of all the components. The returned value
212 will only be True if all the specified components are physical.
215 """
216 return self._swigobj.isphysical(which)
218 def sample(self, direction=[ ], pixellatsize=[ ], pixellongsize=[ ], frequency=[ ]):
219 """The sample function will returns a vector containing the flux in
220 Janskys/pixel of all the components in the list, in the specified
221 direction, at the specified frequency. The returned vector always
222 contains four elements corresponding to the Stokes parameters
223 I,Q,U,V.
226 """
227 return self._swigobj.sample(direction, pixellatsize, pixellongsize, frequency)
229 def rename(self, filename, log=True):
230 """The rename function is used to specify the name of the table
231 associated with this componentlist.
233 When a componentlist is created it is not associated with an casa
234 table. So when the componentlist is removed from memory its
235 contents are lost. But if a name is attached to the componentlist,
236 using the rename function, then its contents are saved in a table
237 with the specified name when the componentlist is closed
239 NOTE: that by just using rename the componentlist is not ensured
240 to be on disk; to be sure use close after rename
242 If the componentlist is created using the open() constructor then
243 this function will rename the table associated with the list to
244 the user specified name. You cannot rename a componentlist that
245 has been opened read only.
250 """
251 return self._swigobj.rename(filename, log)
253 def simulate(self, howmany=int(1), log=True):
254 """The simulate function adds simulated components to the list. The
255 simulation criterion is very simple, all the components added are
256 identical! They are point sources at the J2000 north pole with a
257 flux in Stokes I of 1~Jy, and zero in the other polarizations. The
258 spectrum is constant. The 'set' functions (eg. setflux, setfreq)
259 can be used to change these parameters to desired ones.
261 The howmany argument indicates how many components to append to
262 the list.
264 """
265 return self._swigobj.simulate(howmany, log)
267 def addcomponent(self, flux=[ ], fluxunit='Jy', polarization='Stokes', dir=[ ], shape='point', majoraxis=[ ], minoraxis=[ ], positionangle=[ ], freq=[ ], spectrumtype='constant', index=[ ], optionalparms=[ float(0.0) ], label=''):
268 """The addcomponent function is a convenience function that ties
269 together the simulate function, and the various set
270 functions. This function adds a component to the end of the
271 list. For a description of the arguments see the following
272 functions.
273 [flux, fluxunit, polarization] See setflux
274 [ra, raunit, dec, decunit] See setrefdir
275 [dirframe] See setrefdirframe
276 [shape, majoraxis, minoraxis, positionangle] See setshape
277 [freq] A frequency quantity which is split into a value and
278 units and passed to the setfreq function
279 [freqframe] See setfreq
280 [spectrumtype, index] The spectral index alpha such that flux density S
281 as a function of frequency nu is: S~nu**alpha.
282 See also the setspectrum or setstokesspectrum functions.
283 [label] See setlabel
285 """
286 return self._swigobj.addcomponent(flux, fluxunit, polarization, dir, shape, majoraxis, minoraxis, positionangle, freq, spectrumtype, index, optionalparms, label)
288 def close(self, log=True):
289 """The close function resets the componentlist to its default state. In
290 this state it contains no components and is not associated with
291 any table.
293 This function flushes all the components in memory to disk if the
294 componentlist is associated with a table. The table is then
295 closed, and the contents of the list deleted.
297 If the list is not associated with a table its contents are still
298 deleted and memory used by the list is released.
300 """
301 return self._swigobj.close(log)
303 def edit(self, which, log=True):
304 """
305 """
306 return self._swigobj.edit(which, log)
308 def done(self):
309 """The done function frees up all the memory associated with a
310 componentlist tool. After calling this function the componentlist
311 tool cannot be used, either to manipulate the current list, or
312 to open a new one. This function does not delete the disk
313 file associated with a componentlist, but it will shut down the
314 server process if there are no other componentlist tools being used.
316 """
317 return self._swigobj.done()
319 def select(self, which):
320 """The select function is used to mark the specified components as
321 ``selected''. This function will be used in conjunction with the
322 planned graphical user interface. Other functions functions in the
323 componentlist tool will behave no differently if a component is
324 marked as ``selected''.
326 Components are not selected when the list is initially read
327 from disk or when a new component is added to the list using the
328 simulate function.
330 """
331 return self._swigobj.select(which)
333 def deselect(self, which):
334 """The deselect function is used to remove the ``selected'' mark from
335 specified components in the list. This function wiil be used in
336 conjunction with the planned graphical user interface and no other
337 functions in the componentlist will behave differently if a
338 component is marked as ``selected'' or not.
340 Components are not selected when the list is initially read from
341 disk or when a new component is added to the list using the
342 simulate function. function. Deselecting a component that is
343 already deselected is perfectly valid and results in no change.
345 """
346 return self._swigobj.deselect(which)
348 def selected(self):
349 """The selected function is used to determine which components in a
350 list are selected. It returns a vector with indices that indicate
351 which components are selected. A zero length vector is returned if
352 no components are selected.
354 Components are marked as selected using the
355 select
356 function. This function will be used in conjunction with the
357 graphical user interface and other functions in the componentlist
358 tool will behave no differently if a component is marked as
359 ``selected'' or not.
362 """
363 return self._swigobj.selected()
365 def getlabel(self, which):
366 """The getlabel function returns the label associated with the specified
367 component. The label is an arbitrary text string that can be used
368 to tag a component.
370 """
371 return self._swigobj.getlabel(which)
373 def setlabel(self, which, value, log=True):
374 """The setlabel function is used to reassign the label (an arbitrary
375 text string) of the specified components to
376 a new value.
378 """
379 return self._swigobj.setlabel(which, value, log)
381 def getfluxvalue(self, which):
382 """The getfluxvalue function returns the value of the flux of the
383 specified component using the current units and the current
384 polarization representation. The functions
385 getfluxunit &
386 getfluxpol &
387 can be used to get the units and polarization
388 representation that corresponds to the supplied value.
390 """
391 return self._swigobj.getfluxvalue(which)
393 def getfluxunit(self, which):
394 """The getfluxunit function returns the units of the flux of the
395 specified component. The actual values are obtained using the
396 getfluxvalue function.
398 """
399 return self._swigobj.getfluxunit(which)
401 def getfluxpol(self, which):
402 """The getfluxunit function returns the polarization representation
403 of the flux of the specified component. The actual values are
404 obtained using the
405 getfluxvalue
406 function.
408 """
409 return self._swigobj.getfluxpol(which)
411 def getfluxerror(self, which):
412 """The getfluxerror function returns the error in the flux of the
413 specified component using the current units and the current
414 polarization representation. The functions
415 getfluxvalue &
416 getfluxunit &
417 getfluxpol &
418 can be used to get the value, units and polarization
419 representation that corresponds to the specified error.
421 No error calculations are done by this tool. The error can be
422 stored and retreived and if any of the parameters of the flux
423 change the user is responsible for updating the errors.
425 """
426 return self._swigobj.getfluxerror(which)
428 def setflux(self, which, value=[ ], unit='Jy', polarization='Stokes', error=[ ], log=True):
429 """The setflux function is used to reassign the flux of the
430 specified components to a new value. The flux value, unit and
431 polarization can be specified and any number of components can be
432 set to the new value. (Currently, the parameter, error is
433 ignored.)
435 """
436 return self._swigobj.setflux(which, value, unit, polarization, error, log)
438 def convertfluxunit(self, which, unit='Jy'):
439 """The convertfluxunit function is used to convert the flux to another
440 unit. The units emph{must} have the same dimensions as the Jansky.
442 """
443 return self._swigobj.convertfluxunit(which, unit)
445 def convertfluxpol(self, which, polarization='Stokes'):
446 """The convertfluxpol function is used to convert the flux to another
447 polarization representation. There are are three representations
448 used, namely , 'Stokes', 'linear' & 'circular'
450 """
451 return self._swigobj.convertfluxpol(which, polarization)
453 def getrefdir(self, which):
454 """The getrefdir function returns, as a direction measure, the
455 reference direction for the specified component. The reference
456 direction is for all the currently supported component shapes the
457 direction of the centre of the component.
459 """
460 return self._swigobj.getrefdir(which)
462 def getrefdirra(self, which, unit='deg', precision=int(6)):
463 """
464 """
465 return self._swigobj.getrefdirra(which, unit, precision)
467 def getrefdirdec(self, which, unit='deg', precision=int(6)):
468 """The getrefdirdec function returns the declination of the reference
469 direction of the component as a formatted string. If the reference
470 frame is something other than J2000 or B1950 the value returned is
471 the longitude or the altitude.
473 See the getrefdirra function for a description of the unit and
474 precision arguments.
477 """
478 return self._swigobj.getrefdirdec(which, unit, precision)
480 def getrefdirframe(self, which):
481 """The getrefdirframe function returns the reference frame of the reference
482 direction of the component as a string. The returned string is
483 always in upper case. Common frames are, 'J2000', 'B1950' and 'GALACTIC'.
486 """
487 return self._swigobj.getrefdirframe(which)
489 def setrefdir(self, which=int(1), ra=[ ], dec=[ ], log=True):
490 """The setrefdir function sets the reference direction of the
491 specified components to a new value. The direction is defined by
492 separately specifying the right ascension and the declination.
494 The right ascension is specified as a string or a real number
496 Ra can be in standard angle units 'deg', 'rad', or time formatted as such 'HH:MM:SS.sss'
497 eg., '19:34:63.8' or angle formatted as such '+DDD.MM.SS.sss' eg.,
498 '127.23.12.37'.
500 Similarly the declination is specified as a string or a real
501 number and the decunit can be any angular unit or 'angle' or
502 'time'.
504 """
505 return self._swigobj.setrefdir(which, ra, dec, log)
507 def setrefdirframe(self, which, frame, log=True):
508 """The setrefdirframe function sets the reference frame for the
509 reference direction of the specified components (what a mouthful)!
511 Currently the reference frame does not include additional
512 information like when and where the observation took place. Hence
513 only reference frames that are independent of this information can be
514 used. This includes the common ones of 'J2000', 'B1950', and
515 'Galactic'. The measures module contains a
516 complete listing of all possible reference frames. The parsing of
517 the reference frame string is case-insensitive.
520 """
521 return self._swigobj.setrefdirframe(which, frame, log)
523 def convertrefdir(self, which, frame):
524 """The convertrefdir function changes the specified components to use a
525 new direction reference frame. Using this function will change the
526 right-ascension and declination of the component(s), unlike the
527 setrefdirframe which does not.
529 Please see the
530 setrefdirframe
531 function for a description of what frames are allowed.
534 """
535 return self._swigobj.convertrefdir(which, frame)
537 def shapetype(self, which):
538 """The shapetype function returns the current shape of the specified
539 component. The shape defines how the flux of the component varies
540 with direction on the sky. Currently there are three shapes
541 available. These are 'Point', 'Gaussian', and 'Disk'. This
542 function returns one of these four strings.
545 """
546 return self._swigobj.shapetype(which)
548 def getshape(self, which):
549 """The getshape function returns the shape parameters of a component
550 in a record. As different shapes can have a differing number and
551 type of parameters the shape parameters are returned in a record
552 with fields that correspond to parameters relevant to the current
553 shape.
555 For a point shape there are only two fields; type and
556 direction. These are the shape type, and the reference
557 direction. These values are also returned by the
558 shapetype and
559 getrefdir
560 functions.
562 For both the Gaussian and disk shapes there are three additional
563 fields; majoraxis, minoraxis, positionangle. These are angular
564 quantities, and hence are records with a value
565 and a unit.
568 """
569 return self._swigobj.getshape(which)
571 def setshape(self, which, type='Point', majoraxis=[ ], minoraxis=[ ], positionangle=[ ], majoraxiserror=[ ], minoraxiserror=[ ], positionangleerror=[ ], optionalparms=[ float(0.0) ], log=True):
572 """The setshape function changes the shape of the specified components
573 to the user specified shape.
575 The type argument defines what the sort of new shape to use. This
576 can be either 'point', 'Gaussian', or 'disk'.
577 The parsing of this string is case insensitive.
580 If the shape type is 'point' then the remaining arguments in this
581 function are ignored. There are no other parameters needed to
582 specify a point shape.
584 But if the shape is 'Gaussian', or 'disk',
585 the remaining arguments are needed to fully specify the shape.
586 The majoraxis, minoraxis and positionangle arguments are quantities (see the
587 quanta module for a definition of a
588 quantity). Hence they can be specified either as with string eg.,
589 '1arcsec' or with a record eg., [value=1, unit='deg'].
591 The major axis is the width of the larger axis. For the Gaussian
592 shape this is the full width at half maximum. And the minor axis
593 is the width of the orthogonal axis. The positionangle is the
594 specifies the rotation of these two axes with respect to a line
595 connecting the poles of the current direction reference frame. If
596 the angle is positive the the north point of the component moves
597 in the eastern direction.
600 """
601 return self._swigobj.setshape(which, type, majoraxis, minoraxis, positionangle, majoraxiserror, minoraxiserror, positionangleerror, optionalparms, log)
603 def convertshape(self, which, majoraxis='arcmin', minoraxis='arcmin', positionangle='deg'):
604 """
605 """
606 return self._swigobj.convertshape(which, majoraxis, minoraxis, positionangle)
608 def spectrumtype(self, which):
609 """The spectrumtype function returns the current spectral shape of the
610 specified component. The spectral shape defines how the flux of
611 the component varies with frequency. Returns one of "Constant",
612 "Spectral Index", "Tabular Spectrum", and "Power Logarithmic Polynomial".
615 """
616 return self._swigobj.spectrumtype(which)
618 def getspectrum(self, which):
619 """The getspectrum function returns the spectral parameters of a
620 component in a record. As different spectral shapes can have a
621 differing number and type of parameters the spectral parameters
622 are returned in a record with fields that correspond to parameters
623 relevant to the current spectral shape.
625 For a constant spectrum there are only two fields; type and
626 frequency. These are the spectral type, and the reference
627 frequency. These values are also returned by the
628 spectrumtype and
629 getfreq
630 functions.
632 For the spectral index spectral shape there is also an index
633 field. This contains a vector with four numbers, these are the
634 spectral indicies for the I,Q,U,V components of the flux.
636 The dictionary associated with a power log polynomial spectrum has the following structure:
638 {
639 'coeffs': array([ 1., 2., 3.]),
640 'frequency': {
641 'type': 'frequency',
642 'm0': {'value': 1.4200000000000002, 'unit': 'GHz'},
643 'refer': 'LSRK'
644 },
645 'type': 'Power Logarithmic Polynomial',
646 'error': array([ 0., 0., 0.])
647 }
649 The 'error' value is currently not used.
653 """
654 return self._swigobj.getspectrum(which)
656 def setstokesspectrum(self, which, type='spectral index', index=[ float(0.0) ], tabularfreqs=[ float(1.0e11) ], tabulari=[ float(1.0) ], tabularq=[ float(0.0) ], tabularu=[ float(0.0) ], tabularv=[ float(0.0) ], reffreq=[ ], frame='LSRK'):
657 """The setstokesspectrum function changes the spectrum of the specified components
658 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
660 The type argument defines what the sort of new spectrum to use. This
661 can be either 'constant' or 'spectral index' or 'tabular'. The parsing of this
662 string is case insensitive.
664 If the spectrum type is 'constant' then the remaining arguments in
665 this function are ignored. There are no other parameters needed to
666 specify a constant spectrum.
668 But if the spectrum is 'spectral index', the 'index' argument is
669 needed. It is a 4 element vector.
671 The first element ($alpha_0$) is the spectral index of stokes I ($ I(nu)=I(nu_0)({{nu}over{nu_0}})^{alpha_0} $)
673 The second element ($alpha_1$) is a spectral index for the fractional linear polarization ( $sqrt{{{(Q(nu)^2+U(nu)^2)}over{I(nu)^2}}} = sqrt{{{(Q(nu_0)^2+U(nu_0)^2)}over{I(nu_0)^2}}}({{nu}over{nu_0}})^{alpha_1}$). $alpha_1=0$ implies constant fractional linear polarization w.r.t frequency.
675 The third element is a "Rotation Measure" factor, i.e angle of rotation $theta= alpha_2 (lambda^2 - lambda_0^2)$ of the linear polarization at frequency $nu$ w.r.t frequency $nu_0$.
677 The fourth element is a spectral index for the fractional spectral polarization ( $ {{V(nu)}over{I(nu)}} = {{V(nu_0)}over{I(nu_0)}}({{nu}over{nu_0}})^{alpha_3}$
679 If the spectrum is 'tabular', then {tt index} is ignored but the six parameters
680 {tt tabularfreqs, tabulari, tabularq, tabularu, tabularv and tabularframe} are considered. {tt tabularfreqs} and {tt 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.
681 The Stokes parameters of the source is interpolated from these values. Extrappolation outside the range given in {tt tabularfreqs} is not done.
682 {tt tabularfreqs} should be float values in 'Hz'
683 {tt tabulari, tabularq, tabularu, tabularv} should be float values in 'Jy'
686 You should ensure that the reference
687 frequency is set to the value you desire, using the
688 setfreq
689 function if you change to the spectral index shape.
692 """
693 return self._swigobj.setstokesspectrum(which, type, index, tabularfreqs, tabulari, tabularq, tabularu, tabularv, reffreq, frame)
695 def setspectrum(self, which, type='spectral index', index=[ ], tabularfreqs=[ float(1.0e11) ], tabularflux=[ float(1.0) ], tabularframe='LSRK'):
696 """The setspectrum function changes the spectrum of the specified components
697 to the user specified spectrum.
699 The type argument defines what the sort of new spectrum to use. This
700 can be one of 'constant', 'tabular', 'plp', or 'spectral index'. Minimal
701 match, case insensitive.
703 If the spectrum type is 'constant' then the remaining arguments in
704 this function are ignored. There are no other parameters needed to
705 specify a constant spectrum. The reference frequency is set to be
706 the same value as the component being replaced. Although this is
707 unimportant for a constant spectrum, it may be important if
708 the spectral model of the component in question is changed again
709 later. See rules to how the reference frequencies of various spectral
710 models are set in the description below.
712 If the spectrum is 'spectral index', the 'index' argument is
713 needed to fully specify the spectrum by using the index argument. The
714 index parameter may be in the form of a single numerical value, or
715 an array containing a numerical value. In the case of the array containing
716 multiple values, the zeroth value is used as the value of index, while
717 subsequent values are tacitly ignored. The functional form of this model
718 is
720 R = x^(alpha)
722 where R = I_nu/I_nu0 is the ratio of the intensities at observed frequency nu
723 and the reference frequency nu_0, x = nu/nu_0, and alpha is the specified
724 spectral index. The reference frequency is tacitly set to that of the component
725 being replaced. and can be changed by a subsequent call to setfreq().
727 If spectrum = 'plp', then the spectral model is set to a power log polynomial.
728 The functional form of this model is
730 R = x^(c_0 + c_1*(ln(x)) + c_2*(ln(x))^2 + c_3*(ln(x))^3 + ... + c_n*(ln(x))^n)
732 where R = I_nu/I_nu0 is the ratio of the intensities at observed frequency nu
733 and the reference frequency nu_0, x = nu/nu_0, ln is the natural logarithm, and
734 c_0 ... c_n are the coefficients specified by index. In this case, index should
735 be an array of numerical values, and the array length is unconstrained. The
736 reference frequency is tacitly set to that of the component being replaced, and
737 can be changed by a subsequent call to setfreq().
739 If the spectrum is 'tabular', then 'index' is ignored but the
740 three parameters 'tabularfreqs', 'tabularflux' and 'tabularframe'
741 are considered. 'tabularfreqs' and 'tabularflux' have to be list
742 of same lengths and larger than 2. You need at least 2 samples to
743 interpolate the spectral value in between. The flux of the source
744 is interpolated from these values. Extrapolation outside the range
745 given in 'tabularfreqs' is not done.
746 'tabularfreqs' should be float values in 'Hz'
747 'tabularflux' should be float values in 'Jy'
748 The reference frequency is chosen to be the zeroth element of tabularfreqs.
752 You should ensure that the reference
753 frequency is set to the value you desire, using the
754 setfreq
755 function if you change to the spectral index shape.
758 """
759 return self._swigobj.setspectrum(which, type, index, tabularfreqs, tabularflux, tabularframe)
761 def getfreq(self, which):
762 """
763 """
764 return self._swigobj.getfreq(which)
766 def getfreqvalue(self, which):
767 """
768 """
769 return self._swigobj.getfreqvalue(which)
771 def getfrequnit(self, which):
772 """
773 """
774 return self._swigobj.getfrequnit(which)
776 def getfreqframe(self, which):
777 """
778 """
779 return self._swigobj.getfreqframe(which)
781 def setfreq(self, which, value, unit='GHz', log=True):
782 """The setfreq function sets the reference frequency of the specified
783 components to a new value. The frequency is defined by separately
784 specifying the value and its units. Use the
785 setfreqframe
786 function to set the frequency reference frame
789 """
790 return self._swigobj.setfreq(which, value, unit, log)
792 def setfreqframe(self, which, frame='LSRK', log=True):
793 """The setfreqframe function sets the reference frame for the
794 reference frequency of the specified components.
796 Currently the reference frame does not include additional
797 information like when are where the observation took place. Hence
798 no conversion between reference frames is available. In the
799 interim I recommend you always use the same frame.
802 """
803 return self._swigobj.setfreqframe(which, frame, log)
805 def convertfrequnit(self, which, unit='GHz'):
806 """The convertfrequnit function changes the specified components to use
807 a new unit for the reference frequency. Using this function will
808 change the frequency value also so that the overall reference
809 frequency is not changed. It will affect the values and units
810 obtained with
811 setfreqvalue
812 function.
814 Any unit can be used that has the same dimensions as the 'Hz'.
817 """
818 return self._swigobj.convertfrequnit(which, unit)
820 def getcomponent(self, which, iknow=False):
821 """The component function returns a record, showing the current state
822 of the specified component in the list.
824 Modifying the record that is returned by this function does not
825 modify the component in the list. To do this you must remove the
826 component from the list, using the
827 remove function,
828 and add the modified component using the
829 add function, or use
830 the replace object
831 function. This function will be removed in a future release of
832 and you are urged to use the get functions to extract
833 information about a component.
836 """
837 return self._swigobj.getcomponent(which, iknow)
839 def add(self, thecomponent, iknow=True):
840 """The add function adds a component to the component
841 list. You cannot add components to a list that has been opened
842 read only. To use this function you need to know the details of
843 the record format. however this has been deprecated and you are
844 urged to use the set functions, in conjunction with the simulate
845 function to add a component to the list.
848 """
849 return self._swigobj.add(thecomponent, iknow)
851 def replace(self, which, list, whichones=[ int(-1) ]):
852 """The replace function replaces the components from the list with
853 the specified components from another list. The source list can be
854 opened readonly and the length of the vectors in the first and
855 third arguments must the the name.
857 You cannot replace components in a list that has been opened read
858 only.
861 """
862 return self._swigobj.replace(which, list, whichones)
864 def summarize(self, which=int(-1)):
865 """The summarize function summarizes the contents of the specified components to the logger.
867 """
868 return self._swigobj.summarize(which)
870 def iscomponentlist(self, tool=[ ]):
871 """This global function can be used to determine if the supplied
872 argument is a componentlist tool. If so it returns True, otherwise
873 it returns False.
875 """
876 return self._swigobj.iscomponentlist(tool)