Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatools/__casac__/componentlist.py: 54%
214 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-31 19:10 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-31 19:10 +0000
1# This file was automatically generated by SWIG (http://www.swig.org).
2# Version 3.0.12
3#
4# Do not make changes to this file unless you know what you are doing--modify
5# the SWIG interface file instead.
7from sys import version_info as _swig_python_version_info
8if _swig_python_version_info >= (2, 7, 0):
9 def swig_import_helper():
10 import importlib
11 pkg = __name__.rpartition('.')[0]
12 mname = '.'.join((pkg, '_componentlist')).lstrip('.')
13 try:
14 return importlib.import_module(mname)
15 except ImportError:
16 return importlib.import_module('_componentlist')
17 _componentlist = swig_import_helper()
18 del swig_import_helper
19elif _swig_python_version_info >= (2, 6, 0):
20 def swig_import_helper():
21 from os.path import dirname
22 import imp
23 fp = None
24 try:
25 fp, pathname, description = imp.find_module('_componentlist', [dirname(__file__)])
26 except ImportError:
27 import _componentlist
28 return _componentlist
29 try:
30 _mod = imp.load_module('_componentlist', fp, pathname, description)
31 finally:
32 if fp is not None:
33 fp.close()
34 return _mod
35 _componentlist = swig_import_helper()
36 del swig_import_helper
37else:
38 import _componentlist
39del _swig_python_version_info
41try:
42 _swig_property = property
43except NameError:
44 pass # Python < 2.2 doesn't have 'property'.
46try:
47 import builtins as __builtin__
48except ImportError:
49 import __builtin__
51def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
52 if (name == "thisown"):
53 return self.this.own(value)
54 if (name == "this"):
55 if type(value).__name__ == 'SwigPyObject':
56 self.__dict__[name] = value
57 return
58 method = class_type.__swig_setmethods__.get(name, None)
59 if method:
60 return method(self, value)
61 if (not static):
62 if _newclass:
63 object.__setattr__(self, name, value)
64 else:
65 self.__dict__[name] = value
66 else:
67 raise AttributeError("You cannot add attributes to %s" % self)
70def _swig_setattr(self, class_type, name, value):
71 return _swig_setattr_nondynamic(self, class_type, name, value, 0)
74def _swig_getattr(self, class_type, name):
75 if (name == "thisown"):
76 return self.this.own()
77 method = class_type.__swig_getmethods__.get(name, None)
78 if method:
79 return method(self)
80 raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
83def _swig_repr(self):
84 try:
85 strthis = "proxy of " + self.this.__repr__()
86 except __builtin__.Exception:
87 strthis = ""
88 return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
90try:
91 _object = object
92 _newclass = 1
93except __builtin__.Exception:
94 class _object:
95 pass
96 _newclass = 0
98class componentlist(_object):
99 """Proxy of C++ casac::componentlist class."""
101 __swig_setmethods__ = {}
102 __setattr__ = lambda self, name, value: _swig_setattr(self, componentlist, name, value)
103 __swig_getmethods__ = {}
104 __getattr__ = lambda self, name: _swig_getattr(self, componentlist, name)
105 __repr__ = _swig_repr
107 def __init__(self):
108 """__init__(self) -> componentlist"""
109 this = _componentlist.new_componentlist()
110 try:
111 self.this.append(this)
112 except __builtin__.Exception:
113 self.this = this
115 def open(self, *args, **kwargs):
116 """
117 open(self, _filename, _nomodify, _log) -> bool
121 Summary:
122 Construct a cl from a table on disk
124 Description:
127 Use this constructor to construct a componentlist tool by reading
128 the data from an table. To ensure that this table contains
129 all the necessary columns and to allow the table format to be
130 enhanced in the future, it is highly recommended that the table be
131 created using a componentlist tool.
133 The table that contains the componentlist may be opened read-only by
134 setting the readonly flag to True. When this is done some of the
135 functions in the componentlist tool cannot be used. These include
136 the ``set'', ``convert'', ``remove'', ``replace'', ``purge'',
137 ``recover'', and ``sort'' functions.
140 Input Parameters:
141 filename The filename of the table
142 nomodify Should the table be opened read only
143 log Send a message to the logger
145 Example:
147 cl.open('crux.cl')
149 --------------------------------------------------------------------------------
151 """
152 return _componentlist.componentlist_open(self, *args, **kwargs)
155 def asciitocomponentlist(self, *args, **kwargs):
156 """
157 asciitocomponentlist(self, _filename, _asciifile, _refer, _format, _direction, _spectrum, _flux, _log) -> long
161 Summary:
162 Create a componentlist from an ascii file {bf (Not implemented yet)}
164 Description:
167 This constructor will allow conversion of a number of ascii-file-based
168 formats to componentlists.
171 Input Parameters:
172 filename Name of output component list table
173 asciifile Name of input ascii file
174 refer Input reference frame
175 format Name of format (only ST supported)
176 direction Direction measure (for relative coordinates)
177 spectrum Default spectrum field, valid spectrum field [type='Constant', frequency=[type='frequency' , refer='LSR' , m0=[unit='GHz' , value=1.0]]
178 flux Default flux field, valid flux field [value=[0.0, 0.0, 0.0, 0.0], unit='Jy', polarization='Stokes']
179 log Send a message to the logger
181 --------------------------------------------------------------------------------
183 """
184 return _componentlist.componentlist_asciitocomponentlist(self, *args, **kwargs)
187 def concatenate(self, *args, **kwargs):
188 """
189 concatenate(self, _list, _which, _log) -> bool
193 Summary:
194 Append components from another componentlist.
196 Description:
199 The concatenate function copies the specified component(s), from
200 the specified to list, to the end of the current list. The
201 components are specified by numbering them from one to the length
202 of the list. You cannot append components to a list that has been
203 opened read only but the list you are copying from may be
204 readonly.
206 You use a vector of indices to copy a number of components at
207 once. By default all components are copied.
210 Input Parameters:
211 list list to copy from. Can be a componentlist record or a componentlist file name from disk
212 which which components to copy, -1 unset
213 log Send a message to the logger
215 Example:
217 cl.addcomponent(flux=1.0, dir='J2000 19h00m00 -40d00m00')
218 cl.addcomponent(flux=2.0, dir='J2000 19h10m00 -40d00m00')
219 cl.addcomponent(flux=3.0, dir='J2000 19h00m00 -40d00m00')
220 cl2 = cltool();
221 cl2.concatenate(cl.torecord(), [0,2]);
222 cl.done()
223 cl2.rename('part_list.cl');
224 cl2.done()
225 We make a 3 component component list and
226 copies the first and third component to another a componentlist
227 that was initially empty. These components are then saved to the
228 table called part_list.cl.
230 cl.close() ### make sure we start with empty componentlist
231 cl.concatenate('crux.cl', [0,2]);
232 cl.rename('crux-copy.cl');
233 cl.done()
235 This example reads a componentlist from a casa table and
236 copies the first and third component to another a componentlist
237 that was initially empty. These components are then saved to the
238 table called crux-copy.cl.
240 --------------------------------------------------------------------------------
242 """
243 return _componentlist.componentlist_concatenate(self, *args, **kwargs)
246 def fromrecord(self, *args, **kwargs):
247 """
248 fromrecord(self, _record) -> bool
252 Summary:
253 make a componentlist tool from a record
255 Description:
259 This function allows the componentlist records that are returned
260 by other functions (for e.g from imageanalysis tool) be converted
261 to a tool to be manipulated or to be saved on disk
265 Input Parameters:
266 record a component list record
268 Example:
270 cl2 = cltool()
272 cl2.fromrecord(ia.findsources())
273 cl2.rename('sourcesfound.cl')
274 cl2.done()
276 --------------------------------------------------------------------------------
278 """
279 return _componentlist.componentlist_fromrecord(self, *args, **kwargs)
282 def haskeyword(self, *args, **kwargs):
283 """
284 haskeyword(self, _keyword) -> bool
288 Summary:
289 Does the attached component list table have the specified keyword??
291 Description:
295 Does the attached component list table have the specified keyword? This
296 method will not work for in-memory componentlists. That is, the componentlist
297 must exist on disk. If not, an exception is thrown. This method is for
298 convenience for string keywords and is not meant as a replacement for the
299 table tool API.
303 Input Parameters:
304 keyword Keyword.
306 Example:
308 cl2 = componentlist()
309 cl2.open('my.cl')
310 res = cl2.haskeyword('metadata'))
311 cl2.done()
313 --------------------------------------------------------------------------------
315 """
316 return _componentlist.componentlist_haskeyword(self, *args, **kwargs)
319 def putkeyword(self, *args, **kwargs):
320 """
321 putkeyword(self, _keyword, _value)
325 Summary:
326 Set the specified table keyword.
328 Description:
331 Set the specified keyword in the componentlist table. If the keyword
332 already exists in the table, it will be overwritten with this specified
333 value. The value can be any type that CASA supports as an input
334 parameter to tool methods. This method will not work for in-memory
335 componentlists. That is, the componentlist must exist on disk. If not,
336 an exception is thrown. This method is for convenience for string
337 keywords and is not meant as a replacement for the table tool API.
340 Input Parameters:
341 keyword Keyword.
342 value Value to be set.
344 Example:
346 cl2 = componentlist()
347 cl2.open('my.cl')
348 myrec = {'fred': 2, 'you': 3}
349 cl2.setkeyword('metadata')
350 cl2.done()
352 --------------------------------------------------------------------------------
354 """
355 return _componentlist.componentlist_putkeyword(self, *args, **kwargs)
358 def getkeyword(self, *args, **kwargs):
359 """
360 getkeyword(self, _keyword) -> variant *
364 Summary:
365 Get the specified table keyword.
367 Description:
370 Get the specified keyword in the componentlist table. This method
371 will not work for in-memory componentlists. That is, the componentlist
372 must exist on disk. If not, an exception is thrown. If the specified
373 keyword does not exist in the table, an exception is thrown. This
374 method is for convenience for string keywords and is not meant as a
375 replacement for the table tool API.
378 Input Parameters:
379 keyword Keyword.
381 Example:
383 cl2 = componentlist()
384 cl2.open('my.cl')
385 res = cl2.getkeyword('metadata')
386 cl2.done()
388 --------------------------------------------------------------------------------
390 """
391 return _componentlist.componentlist_getkeyword(self, *args, **kwargs)
394 def torecord(self):
395 """
396 torecord(self) -> record *
400 Summary:
401 convert componentlist to a record
403 Description:
407 This function allows the componentlist to be converted to a
408 record. Usually useful to pass to other functions in image
409 analysis for e.g
413 Example:
415 cl2=cltool()
416 cl.open('mycomp.cl')
418 cl2.fromrecord(ia.deconvolvecomponentlist(cl.torecord()))
419 cl2.rename('deconvolved_sources.cl')
420 cl2.done()
422 --------------------------------------------------------------------------------
424 """
425 return _componentlist.componentlist_torecord(self)
428 def remove(self, *args, **kwargs):
429 """
430 remove(self, _which, _log) -> bool
434 Summary:
435 Remove a component from the list.
437 Description:
441 The remove function removes the specified component(s) from the
442 list. Components are specified by numbering them from one to the
443 length of the list. So removing component one will remove the
444 first component. After using this function all the
445 remaining components will be shuffled down so that component two
446 becomes component one. You cannot remove components from a list
447 that has been opened read only.
449 You can specify a vector of indices to remove a number of
450 components at once. For example in a five element list removing
451 elements [1,3,5] will result in a two element list, now indexed as
452 elements one and two, containing what was previously the second
453 and fourth components.
455 Components that have been deleted using this function are not
456 lost. The recover function can be used to get them back unless the
457 purge function has been executed. Then they are completely gone.
461 Input Parameters:
462 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
463 log Send a message to the logger
465 Example:
467 cl.open('crux.cl')
468 cl.remove(1)
470 --------------------------------------------------------------------------------
472 """
473 return _componentlist.componentlist_remove(self, *args, **kwargs)
476 def purge(self):
477 """
478 purge(self) -> bool
482 Summary:
483 Permanently delete removed components.
485 Description:
489 The remove function deletes components from the list but does not
490 remove them from memory. They remain accessible and can be
491 obtained with the recover function. The purge function frees up
492 the memory occupied by the removed components. You cannot use the
493 recover function to obtain the removed components after the purge
494 function has been called.
498 Example:
500 cl.open('crux.cl')
501 cl.remove(1)
502 cl.purge()
504 --------------------------------------------------------------------------------
506 """
507 return _componentlist.componentlist_purge(self)
510 def recover(self, *args, **kwargs):
511 """
512 recover(self, _log) -> bool
516 Summary:
517 Obtain removed components.
519 Description:
522 The recover function appends components to the end of the list
523 that have been deleted with the remove function. This does not
524 include components that were removed before the purge function was
525 last executed.
528 Input Parameters:
529 log Send a message to the logger
531 Example:
533 cl.open('crux.cl')
534 cl.remove(1)
535 cl.recover()
537 --------------------------------------------------------------------------------
539 """
540 return _componentlist.componentlist_recover(self, *args, **kwargs)
543 def length(self):
544 """
545 length(self) -> long
549 Summary:
550 Find the number of components in the list.
552 Description:
555 The length function returns a non-negative integer that
556 indicates how many components the list currently contains.
559 Example:
561 cl.open('crux.cl')
562 n = cl.length()
564 --------------------------------------------------------------------------------
566 """
567 return _componentlist.componentlist_length(self)
570 def indices(self):
571 """
572 indices(self) -> std::vector< long >
576 Summary:
577 Return a vector of indices. (Not implemented yet)
579 Description:
582 The indices function will returns a vector of non-negative
583 integers that can be used to index through the list. This vector
584 always contains the integers starting at one and increasing
585 sequentially to the length of the list. Its main use is in for
586 loops as is illustrated in the example below.
589 --------------------------------------------------------------------------------
591 """
592 return _componentlist.componentlist_indices(self)
595 def sort(self, *args, **kwargs):
596 """
597 sort(self, _criteria, _log) -> bool
601 Summary:
602 Sort the components in a list
604 Description:
607 The sort function can sort all the components in a list using a
608 variety of criteria. Currently the following criteria are
609 available:
610 Flux: Sorts the list so that the brightest components,
611 as defined by Stokes I, are at the beginning of the list.
612 Position: Sorts the list so that components that are
613 closest to a reference position, which is currently fixed at
614 (ra,dec)=(0,0), are at the beginning of the list.
615 Polarization: Sorts the list so that components with the
616 largest fractional polarization, sqrt(Q**2+U**2+V**2)/I, are
617 at the front of the list. Components where I=0 are placed at
618 the end of the list.
619 The parsing of the string containg the sorting criteria is case
620 insensitive. You cannot sort a list that has been opened read only.
623 Input Parameters:
624 criteria a string containg the criteria to use to sort the list
625 log Send a message to the logger
627 Example:
629 cl.open('crux.cl')
630 cl.sort('Polarization')
632 --------------------------------------------------------------------------------
634 """
635 return _componentlist.componentlist_sort(self, *args, **kwargs)
638 def isphysical(self, *args, **kwargs):
639 """
640 isphysical(self, _which) -> bool
644 Summary:
645 Check if a component is physically plausible
647 Description:
650 The isphysical function is used to check if the specified
651 components meet a number of criteria that must be true if the
652 component could be used to model a physical process. These
653 criteria are:
654 1. I >= sqrt(Q**2 + U**2 + V**2)
655 2. That the flux, when represented using the Stokes
656 representation, has a zero imaginary value.
658 The ``Flux properties'' section of the ComponentModels module
659 documentation describes how it is possible to generate a
660 component which has non-zero imaginary value in the Stokes
661 representation.
663 It is possible to check a number of components at once by
664 specifying the indicies of all the components. The returned value
665 will only be True if all the specified components are physical.
669 Input Parameters:
670 which A vector of indices Indices must be between 0 and one less than the list length, inclusively
672 Example:
674 cl2 = cltool()
675 cl2.simulate(2)
676 cl2.setflux(1, value=[10, 1+3j, 1-4j, 0], polarization='linear');
677 print cl2.isphysical([0,1])
679 --------------------------------------------------------------------------------
681 """
682 return _componentlist.componentlist_isphysical(self, *args, **kwargs)
685 def sample(self, *args, **kwargs):
686 """
687 sample(self, _direction, _pixellatsize, _pixellongsize, _frequency) -> std::vector< double >
691 Summary:
692 Sample the flux of the list in a specified direction. (Not implemented yet)
694 Description:
698 The sample function will returns a vector containing the flux in
699 Janskys/pixel of all the components in the list, in the specified
700 direction, at the specified frequency. The returned vector always
701 contains four elements corresponding to the Stokes parameters
702 I,Q,U,V.
706 Input Parameters:
707 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'
708 pixellatsize the x-size of the in pixels to use when sampling any quantity that has angular units.
709 pixellongsize the y-size of the in pixels to use when sampling any quantity that has angular units.
710 frequency The frequency to sample at Any frequency measure
712 --------------------------------------------------------------------------------
714 """
715 return _componentlist.componentlist_sample(self, *args, **kwargs)
718 def rename(self, *args, **kwargs):
719 """
720 rename(self, _filename, _log) -> bool
724 Summary:
725 Give the list a name so it can save itself. use close to save to disk
727 Description:
731 The rename function is used to specify the name of the table
732 associated with this componentlist.
734 When a componentlist is created it is not associated with an casa
735 table. So when the componentlist is removed from memory its
736 contents are lost. But if a name is attached to the componentlist,
737 using the rename function, then its contents are saved in a table
738 with the specified name when the componentlist is closed
740 NOTE: that by just using rename the componentlist is not ensured
741 to be on disk; to be sure use close after rename
743 If the componentlist is created using the open() constructor then
744 this function will rename the table associated with the list to
745 the user specified name. You cannot rename a componentlist that
746 has been opened read only.
752 Input Parameters:
753 filename The filename of the table
754 log Send a message to the logger
756 Example:
758 cl.simulate(1);
759 cl.setshape(0, 'gaussian', '35mas', '27mas', '-10d')
760 cl.setflux(0, [1.0, 0.2, 0.1, 0.01]);
761 cl.rename('smallblob.cl');
762 cl.close();
764 cl.open('smallblob.cl')
765 n=cl.length()
767 This example starts with an empty componentlist tool and then adds
768 one component to it. The parameters of this component are then
769 modified to change the shape and flux and the list saved in the
770 casa table called 'smallblob.cl' The data is not written to
771 disk until the list is closed, and when it is the componentlist is
772 reset. So you need to reopen it if you want to interact with it.
774 --------------------------------------------------------------------------------
776 """
777 return _componentlist.componentlist_rename(self, *args, **kwargs)
780 def simulate(self, *args, **kwargs):
781 """
782 simulate(self, _howmany, _log) -> bool
786 Summary:
787 Add some simulated components to the list
789 Description:
792 The simulate function adds simulated components to the list. The
793 simulation criterion is very simple, all the components added are
794 identical! They are point sources at the J2000 north pole with a
795 flux in Stokes I of 1~Jy, and zero in the other polarizations. The
796 spectrum is constant. The 'set' functions (eg. setflux, setfreq)
797 can be used to change these parameters to desired ones.
799 The howmany argument indicates how many components to append to
800 the list.
803 Input Parameters:
804 howmany How many components to simulate, greater than zero
805 log Send a message to the logger
807 Example:
809 cl.simulate(2)
810 cl.setflux(1, [2.78, 0, 0, 0]);
811 cl.rename('test.cl');
812 cl.close();
816 This example creates a componentlist with two components. The setflux function is used to
817 modify the second component. The list is then saved on disk.
818 I use short scripts like this a lot during testing.
820 --------------------------------------------------------------------------------
822 """
823 return _componentlist.componentlist_simulate(self, *args, **kwargs)
826 def addcomponent(self, *args, **kwargs):
827 """
828 addcomponent(self, _flux, _fluxunit, _polarization, _dir, _shape, _majoraxis, _minoraxis, _positionangle, _freq, _spectrumtype, _index, _optionalparms, _label) -> bool
832 Summary:
833 Add a component to the list
835 Description:
839 The addcomponent function is a convenience function that ties
840 together the simulate function, and the various set
841 functions. This function adds a component to the end of the
842 list. For a description of the arguments see the following
843 functions.
844 [flux, fluxunit, polarization] See setflux
845 [ra, raunit, dec, decunit] See setrefdir
846 [dirframe] See setrefdirframe
847 [shape, majoraxis, minoraxis, positionangle] See setshape
848 [freq] A frequency quantity which is split into a value and
849 units and passed to the setfreq function
850 [freqframe] See setfreq
851 [spectrumtype, index] The spectral index alpha such that flux density S
852 as a function of frequency nu is: S~nu**alpha.
853 See also the setspectrum or setstokesspectrum functions.
854 [label] See setlabel
857 Input Parameters:
858 flux The flux value. A vector with four real or complex numbers
859 fluxunit The units of the flux. Any string with the same dimensions as the Jansky
860 polarization The polarization of the value field. 'Stokes', 'linear' or 'circular'
861 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
862 shape The new shape type. A string that is either 'point', 'Gaussian', or 'disk'
863 majoraxis The width (FWHM in the case of a Gaussian) of the larger axis. A quantity with angular units
864 minoraxis The width (FWHM in the case of a Gaussian) of the smaller axis. A quantity with angular units
865 positionangle The rotation of the axes with respect to the reference frame. A quantity with angular units
866 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'
867 spectrumtype The spectrum type, a string that is one of 'constant', 'spectral index', or 'plp'
868 index The spectral index or coeffecients for plp.
869 optionalparms optional parameters in vector (for future use)
870 label The label for the component
872 Example:
874 cl.open('my.cl')
875 cl.addcomponent(
876 shape='point', flux=[1.0, 0.0, 0.0, 0.0], dir='J2000 19h00m00 -20d00m00',
877 spectrumtype='plp', index=[1, 2, 3]
878 )
880 In this example, a point source with a power log polynomial
881 spectrum having the specified indices is added.
883 --------------------------------------------------------------------------------
885 """
886 return _componentlist.componentlist_addcomponent(self, *args, **kwargs)
889 def close(self, *args, **kwargs):
890 """
891 close(self, _log) -> bool
895 Summary:
896 Save the componentlist to disk and reset its state.
898 Description:
901 The close function resets the componentlist to its default state. In
902 this state it contains no components and is not associated with
903 any table.
905 This function flushes all the components in memory to disk if the
906 componentlist is associated with a table. The table is then
907 closed, and the contents of the list deleted.
909 If the list is not associated with a table its contents are still
910 deleted and memory used by the list is released.
913 Input Parameters:
914 log Send a message to the logger
916 Example:
918 See the example for the
919 rename function.
921 --------------------------------------------------------------------------------
923 """
924 return _componentlist.componentlist_close(self, *args, **kwargs)
927 def edit(self, *args, **kwargs):
928 """
929 edit(self, _which, _log) -> bool
933 Summary:
934 Start up the component editor gui (Not implemented yet)
936 Description:
942 Input Parameters:
943 which An index specifying which component. An integer between 0 and one less than the list length
944 log Send a message to the logger
946 --------------------------------------------------------------------------------
948 """
949 return _componentlist.componentlist_edit(self, *args, **kwargs)
952 def done(self):
953 """
954 done(self) -> bool
958 Summary:
959 Delete the componentlist tool
961 Description:
964 The done function frees up all the memory associated with a
965 componentlist tool. After calling this function the componentlist
966 tool cannot be used, either to manipulate the current list, or
967 to open a new one. This function does not delete the disk
968 file associated with a componentlist, but it will shut down the
969 server process if there are no other componentlist tools being used.
972 Example:
974 See the example for the rename function.
976 --------------------------------------------------------------------------------
978 """
979 return _componentlist.componentlist_done(self)
982 def select(self, *args, **kwargs):
983 """
984 select(self, _which) -> bool
988 Summary:
989 Mark components in the list
991 Description:
994 The select function is used to mark the specified components as
995 ``selected''. This function will be used in conjunction with the
996 planned graphical user interface. Other functions functions in the
997 componentlist tool will behave no differently if a component is
998 marked as ``selected''.
1000 Components are not selected when the list is initially read
1001 from disk or when a new component is added to the list using the
1002 simulate function.
1005 Input Parameters:
1006 which A vector of indices. Indices must be between 0 and one less than the list length, inclusively
1008 Example:
1010 cl.open('crux.cl')
1011 cl.select([1,3])
1013 --------------------------------------------------------------------------------
1015 """
1016 return _componentlist.componentlist_select(self, *args, **kwargs)
1019 def deselect(self, *args, **kwargs):
1020 """
1021 deselect(self, _which) -> bool
1025 Summary:
1026 Unmark components in the list
1028 Description:
1032 The deselect function is used to remove the ``selected'' mark from
1033 specified components in the list. This function wiil be used in
1034 conjunction with the planned graphical user interface and no other
1035 functions in the componentlist will behave differently if a
1036 component is marked as ``selected'' or not.
1038 Components are not selected when the list is initially read from
1039 disk or when a new component is added to the list using the
1040 simulate function. function. Deselecting a component that is
1041 already deselected is perfectly valid and results in no change.
1044 Input Parameters:
1045 which A vector of indices Indices must be between 0 and one less than the list length, inclusively
1047 Example:
1049 cl.open('crux.cl')
1050 cl.select([1,3])
1051 cl.deselect([2,3])
1053 --------------------------------------------------------------------------------
1055 """
1056 return _componentlist.componentlist_deselect(self, *args, **kwargs)
1059 def selected(self):
1060 """
1061 selected(self) -> std::vector< long >
1065 Summary:
1066 Determine which components are selected
1068 Description:
1071 The selected function is used to determine which components in a
1072 list are selected. It returns a vector with indices that indicate
1073 which components are selected. A zero length vector is returned if
1074 no components are selected.
1076 Components are marked as selected using the
1077 select
1078 function. This function will be used in conjunction with the
1079 graphical user interface and other functions in the componentlist
1080 tool will behave no differently if a component is marked as
1081 ``selected'' or not.
1085 Example:
1087 cl.open('crux.cl')
1088 cl.select([1,3])
1089 cl.deselect([2,3])
1090 cl.selected()
1092 --------------------------------------------------------------------------------
1094 """
1095 return _componentlist.componentlist_selected(self)
1098 def getlabel(self, *args, **kwargs):
1099 """
1100 getlabel(self, _which) -> string
1104 Summary:
1105 Get the label of the specified component
1107 Description:
1110 The getlabel function returns the label associated with the specified
1111 component. The label is an arbitrary text string that can be used
1112 to tag a component.
1115 Input Parameters:
1116 which An index specifying which component. An integer between 0 and one less than the list length, inclusively
1118 Example:
1120 cl.open('crux.cl')
1121 cl.getlabel(1)
1123 --------------------------------------------------------------------------------
1125 """
1126 return _componentlist.componentlist_getlabel(self, *args, **kwargs)
1129 def setlabel(self, *args, **kwargs):
1130 """
1131 setlabel(self, _which, _value, _log) -> bool
1135 Summary:
1136 Set the label of the specified components
1138 Description:
1141 The setlabel function is used to reassign the label (an arbitrary
1142 text string) of the specified components to
1143 a new value.
1146 Input Parameters:
1147 which An index specifying the component to modify. An integer between 0 and one less than the list length, inclusively
1148 value The label for the specified components
1149 log Send a message to the logger
1151 Example:
1153 cl.open('centarusA.cl')
1154 cl.setlabel(1, 'Core')
1156 --------------------------------------------------------------------------------
1158 """
1159 return _componentlist.componentlist_setlabel(self, *args, **kwargs)
1162 def getfluxvalue(self, *args, **kwargs):
1163 """
1164 getfluxvalue(self, _which) -> std::vector< double >
1168 Summary:
1169 Get the flux value of the specified component
1171 Description:
1174 The getfluxvalue function returns the value of the flux of the
1175 specified component using the current units and the current
1176 polarization representation. The functions
1177 getfluxunit &
1178 getfluxpol &
1179 can be used to get the units and polarization
1180 representation that corresponds to the supplied value.
1183 Input Parameters:
1184 which An index specifying which component. An integer between 0 and one less than the list length, inclusively
1186 Example:
1188 cl.open('crux.cl');
1189 flux = cl.getfluxvalue(1);
1190 unit = cl.getfluxunit(1);
1193 This example returns the values, units, polarization and error of the
1194 first component in the list.
1196 --------------------------------------------------------------------------------
1198 """
1199 return _componentlist.componentlist_getfluxvalue(self, *args, **kwargs)
1202 def getfluxunit(self, *args, **kwargs):
1203 """
1204 getfluxunit(self, _which) -> string
1208 Summary:
1209 Get the flux unit of the specified component
1211 Description:
1214 The getfluxunit function returns the units of the flux of the
1215 specified component. The actual values are obtained using the
1216 getfluxvalue function.
1219 Input Parameters:
1220 which An index specifying which component. An integer between 0 and one less than the list length, inclusively
1222 Example:
1224 See the example for the
1225 getfluxvalue function.
1227 --------------------------------------------------------------------------------
1229 """
1230 return _componentlist.componentlist_getfluxunit(self, *args, **kwargs)
1233 def getfluxpol(self, *args, **kwargs):
1234 """
1235 getfluxpol(self, _which) -> string
1239 Summary:
1240 Get the polarization representation for the flux of the specified component {bf (Not implmented yet)}
1242 Description:
1245 The getfluxunit function returns the polarization representation
1246 of the flux of the specified component. The actual values are
1247 obtained using the
1248 getfluxvalue
1249 function.
1252 Input Parameters:
1253 which An index specifying which component. An integer between 0 and one less than the list length, inclusively
1255 --------------------------------------------------------------------------------
1257 """
1258 return _componentlist.componentlist_getfluxpol(self, *args, **kwargs)
1261 def getfluxerror(self, *args, **kwargs):
1262 """
1263 getfluxerror(self, _which) -> std::vector< double >
1267 Summary:
1268 Get the error in the flux of the specified component
1270 Description:
1273 The getfluxerror function returns the error in the flux of the
1274 specified component using the current units and the current
1275 polarization representation. The functions
1276 getfluxvalue &
1277 getfluxunit &
1278 getfluxpol &
1279 can be used to get the value, units and polarization
1280 representation that corresponds to the specified error.
1282 No error calculations are done by this tool. The error can be
1283 stored and retreived and if any of the parameters of the flux
1284 change the user is responsible for updating the errors.
1287 Input Parameters:
1288 which Index specifying which component. An integer between 0 and one less than the list length, inclusively
1290 --------------------------------------------------------------------------------
1292 """
1293 return _componentlist.componentlist_getfluxerror(self, *args, **kwargs)
1296 def setflux(self, *args, **kwargs):
1297 """
1298 setflux(self, _which, _value, _unit, _polarization, _error, _log) -> bool
1302 Summary:
1303 Set the flux of the specified components
1305 Description:
1308 The setflux function is used to reassign the flux of the
1309 specified components to a new value. The flux value, unit and
1310 polarization can be specified and any number of components can be
1311 set to the new value. (Currently, the parameter, error is
1312 ignored.)
1315 Input Parameters:
1316 which A vector of indices specifying the components to modify. A vector with indices between 0 and one less than the list length, inclusively
1317 value The flux values for the specified components A vector with four real or complex numbers
1318 unit The units of the flux. Any string with the same dimensions as the Jansky
1319 polarization The polarization of the value field
1320 error The error in the value field. A complex vector of length four.
1321 log Send a message to the logger
1323 Example:
1325 cl.open('crux.cl');
1326 cl.setflux(0, [1,0,0,0], unit='jy',
1327 polarization='Stokes', error=[.3, 0, 0, 0])
1329 --------------------------------------------------------------------------------
1331 """
1332 return _componentlist.componentlist_setflux(self, *args, **kwargs)
1335 def convertfluxunit(self, *args, **kwargs):
1336 """
1337 convertfluxunit(self, _which, _unit) -> bool
1341 Summary:
1342 Change (convert) the flux units of the specified components
1344 Description:
1347 The convertfluxunit function is used to convert the flux to another
1348 unit. The units emph{must} have the same dimensions as the Jansky.
1351 Input Parameters:
1352 which A vector of indices specifying the components to modify. A vector with indices between 0 and one less than the list length, inclusively
1353 unit The units of the flux. Any string with the same dimensions as the Jansky
1355 Example:
1357 cl.open('crux.cl')
1358 print cl.getfluxvalue(1)
1359 cl.convertflux(1, 'WU')
1360 print cl.getfluxvalue(1)
1362 --------------------------------------------------------------------------------
1364 """
1365 return _componentlist.componentlist_convertfluxunit(self, *args, **kwargs)
1368 def convertfluxpol(self, *args, **kwargs):
1369 """
1370 convertfluxpol(self, _which, _polarization) -> bool
1374 Summary:
1375 Change (convert) the polarization representation of the specified components
1377 Description:
1380 The convertfluxpol function is used to convert the flux to another
1381 polarization representation. There are are three representations
1382 used, namely , 'Stokes', 'linear' & 'circular'
1385 Input Parameters:
1386 which A vector of indices specifying the components to modify. A vector with indices between 0 and one less than the list length, inclusively
1387 polarization The new polarization representation
1389 Example:
1391 cl.open('centarusA.cl')
1392 print cl.getfluxvalue(1)
1393 cl.convertfluxpol(1, 'linear')
1394 print cl.getfluxvalue(1)
1396 --------------------------------------------------------------------------------
1398 """
1399 return _componentlist.componentlist_convertfluxpol(self, *args, **kwargs)
1402 def getrefdir(self, *args, **kwargs):
1403 """
1404 getrefdir(self, _which) -> record *
1408 Summary:
1409 Return the reference direction
1411 Description:
1414 The getrefdir function returns, as a direction measure, the
1415 reference direction for the specified component. The reference
1416 direction is for all the currently supported component shapes the
1417 direction of the centre of the component.
1420 Input Parameters:
1421 which An index specifying which component. An integer between 0 and one less than the list length, inclusively
1423 Example:
1425 cl.open('crux.cl')
1426 dir = cl.getrefdir(1)
1428 --------------------------------------------------------------------------------
1430 """
1431 return _componentlist.componentlist_getrefdir(self, *args, **kwargs)
1434 def getrefdirra(self, *args, **kwargs):
1435 """
1436 getrefdirra(self, _which, _unit, _precision) -> string
1440 Summary:
1441 Get the RA of the reference direction. (Not implemented not)
1443 Description:
1449 Input Parameters:
1450 which An index specifying which component. An integer between 0 and one less than the list length, inclusively
1451 unit The angular unit of the returned value. Any string containing an angular unit or 'angle' or 'time'
1452 precision The number of digits in the returned string. Numbers between 1 and 16 make the most sense
1454 --------------------------------------------------------------------------------
1456 """
1457 return _componentlist.componentlist_getrefdirra(self, *args, **kwargs)
1460 def getrefdirdec(self, *args, **kwargs):
1461 """
1462 getrefdirdec(self, _which, _unit, _precision) -> string
1466 Summary:
1467 Get the declination of the reference direction.(Not implemented yet)
1469 Description:
1473 The getrefdirdec function returns the declination of the reference
1474 direction of the component as a formatted string. If the reference
1475 frame is something other than J2000 or B1950 the value returned is
1476 the longitude or the altitude.
1478 See the getrefdirra function for a description of the unit and
1479 precision arguments.
1483 Input Parameters:
1484 which An index specifying which component. An integer between 0 and one less than the list length, inclusively
1485 unit The angular unit of the returned value. Any string containing an angular unit or 'angle' or 'time'
1486 precision The number of digits in the returned string. Numbers between 1 and 16 make the most sense
1488 Example:
1490 See the example for the
1491 getrefdirra function.
1493 --------------------------------------------------------------------------------
1495 """
1496 return _componentlist.componentlist_getrefdirdec(self, *args, **kwargs)
1499 def getrefdirframe(self, *args, **kwargs):
1500 """
1501 getrefdirframe(self, _which) -> string
1505 Summary:
1506 Get the reference frame of the reference direction.
1508 Description:
1511 The getrefdirframe function returns the reference frame of the reference
1512 direction of the component as a string. The returned string is
1513 always in upper case. Common frames are, 'J2000', 'B1950' and 'GALACTIC'.
1517 Input Parameters:
1518 which An index specifying which component. An integer between 0 and one less than the list length, inclusively
1520 Example:
1522 See the example for the
1523 getrefdirra function.
1525 --------------------------------------------------------------------------------
1527 """
1528 return _componentlist.componentlist_getrefdirframe(self, *args, **kwargs)
1531 def setrefdir(self, *args, **kwargs):
1532 """
1533 setrefdir(self, _which, _ra, _dec, _log) -> bool
1537 Summary:
1538 Set the reference direction
1540 Description:
1543 The setrefdir function sets the reference direction of the
1544 specified components to a new value. The direction is defined by
1545 separately specifying the right ascension and the declination.
1547 The right ascension is specified as a string or a real number
1549 Ra can be in standard angle units 'deg', 'rad', or time formatted as such 'HH:MM:SS.sss'
1550 eg., '19:34:63.8' or angle formatted as such '+DDD.MM.SS.sss' eg.,
1551 '127.23.12.37'.
1553 Similarly the declination is specified as a string or a real
1554 number and the decunit can be any angular unit or 'angle' or
1555 'time'.
1558 Input Parameters:
1559 which A vector of indices specifying the components to modify. A vector with indices between 0 and one less than the list length, inclusively
1560 ra The RA of the new direction, A formatted string or a number
1561 dec The declination of the new direction. A formatted string or a number
1562 log Send a message to the logger
1564 Example:
1566 cl.simulate(3)
1567 cl.setrefdir(0, '12:26:35.9', '-63.5.56')
1568 cl.setrefdir(1, '12h26m35.9', '-63d5m56')
1569 cl.setrefdir(2, '-173.35deg', '-1.10128rad')
1570 cl.rename('testcls.cl')
1571 cl.close() # write to disk
1573 --------------------------------------------------------------------------------
1575 """
1576 return _componentlist.componentlist_setrefdir(self, *args, **kwargs)
1579 def setrefdirframe(self, *args, **kwargs):
1580 """
1581 setrefdirframe(self, _which, _frame, _log) -> bool
1585 Summary:
1586 Set the reference frame for the direction
1588 Description:
1592 The setrefdirframe function sets the reference frame for the
1593 reference direction of the specified components (what a mouthful)!
1595 Currently the reference frame does not include additional
1596 information like when and where the observation took place. Hence
1597 only reference frames that are independent of this information can be
1598 used. This includes the common ones of 'J2000', 'B1950', and
1599 'Galactic'. The measures module contains a
1600 complete listing of all possible reference frames. The parsing of
1601 the reference frame string is case-insensitive.
1605 Input Parameters:
1606 which A vector of indices specifying the components to modify. A vector with indices between 0 and one less than the list length, inclusively
1607 frame The new reference frame, A string like 'B1950', 'J2000' or 'galactic'
1608 log Send a message to the logger
1610 Example:
1612 cl.open('crux.cl');
1613 cl.setrefdirframe(0, 'B1950');
1615 --------------------------------------------------------------------------------
1617 """
1618 return _componentlist.componentlist_setrefdirframe(self, *args, **kwargs)
1621 def convertrefdir(self, *args, **kwargs):
1622 """
1623 convertrefdir(self, _which, _frame) -> bool
1627 Summary:
1628 Convert the reference direction to a new frame
1630 Description:
1633 The convertrefdir function changes the specified components to use a
1634 new direction reference frame. Using this function will change the
1635 right-ascension and declination of the component(s), unlike the
1636 setrefdirframe which does not.
1638 Please see the
1639 setrefdirframe
1640 function for a description of what frames are allowed.
1644 Input Parameters:
1645 which A vector of indices specifying the components to modify. A vector with indices between 0 and one less than the list length, inclusively
1646 frame The new reference frame A string like 'B1950', 'J2000' or 'galactic'
1648 Example:
1650 cl.open('crux.cl');
1651 cl.convertrefdirframe(0, 'J2000');
1653 --------------------------------------------------------------------------------
1655 """
1656 return _componentlist.componentlist_convertrefdir(self, *args, **kwargs)
1659 def shapetype(self, *args, **kwargs):
1660 """
1661 shapetype(self, _which) -> string
1665 Summary:
1666 Returns the shape type of the component
1668 Description:
1671 The shapetype function returns the current shape of the specified
1672 component. The shape defines how the flux of the component varies
1673 with direction on the sky. Currently there are three shapes
1674 available. These are 'Point', 'Gaussian', and 'Disk'. This
1675 function returns one of these four strings.
1679 Input Parameters:
1680 which An index specifying which component. An integer between 0 and one less than the list length, inclusively
1682 Example:
1684 cl.open('crux.cl')
1685 print 'The first component has a', cl.shapetype(0), ' shape'
1687 --------------------------------------------------------------------------------
1689 """
1690 return _componentlist.componentlist_shapetype(self, *args, **kwargs)
1693 def getshape(self, *args, **kwargs):
1694 """
1695 getshape(self, _which) -> record *
1699 Summary:
1700 Return the shape parameters the component
1702 Description:
1706 The getshape function returns the shape parameters of a component
1707 in a record. As different shapes can have a differing number and
1708 type of parameters the shape parameters are returned in a record
1709 with fields that correspond to parameters relevant to the current
1710 shape.
1712 For a point shape there are only two fields; type and
1713 direction. These are the shape type, and the reference
1714 direction. These values are also returned by the
1715 shapetype and
1716 getrefdir
1717 functions.
1719 For both the Gaussian and disk shapes there are three additional
1720 fields; majoraxis, minoraxis, positionangle. These are angular
1721 quantities, and hence are records with a value
1722 and a unit.
1726 Input Parameters:
1727 which An index specifying which component. An integer between 0 and one less than the list length, inclusively
1729 Example:
1731 See the examples for the
1732 setshape and
1733 convertshape
1734 functions.
1736 --------------------------------------------------------------------------------
1738 """
1739 return _componentlist.componentlist_getshape(self, *args, **kwargs)
1742 def setshape(self, *args, **kwargs):
1743 """
1744 setshape(self, _which, _type, _majoraxis, _minoraxis, _positionangle, _majoraxiserror, _minoraxiserror, _positionangleerror, _optionalparms, _log) -> bool
1748 Summary:
1749 Change the shape of the component
1751 Description:
1754 The setshape function changes the shape of the specified components
1755 to the user specified shape.
1757 The type argument defines what the sort of new shape to use. This
1758 can be either 'point', 'Gaussian', or 'disk'.
1759 The parsing of this string is case insensitive.
1762 If the shape type is 'point' then the remaining arguments in this
1763 function are ignored. There are no other parameters needed to
1764 specify a point shape.
1766 But if the shape is 'Gaussian', or 'disk',
1767 the remaining arguments are needed to fully specify the shape.
1768 The majoraxis, minoraxis and positionangle arguments are quantities (see the
1769 quanta module for a definition of a
1770 quantity). Hence they can be specified either as with string eg.,
1771 '1arcsec' or with a record eg., [value=1, unit='deg'].
1773 The major axis is the width of the larger axis. For the Gaussian
1774 shape this is the full width at half maximum. And the minor axis
1775 is the width of the orthogonal axis. The positionangle is the
1776 specifies the rotation of these two axes with respect to a line
1777 connecting the poles of the current direction reference frame. If
1778 the angle is positive the the north point of the component moves
1779 in the eastern direction.
1783 Input Parameters:
1784 which A vector of indices specifying the components to modify. A vector with indices between 0 and one less than the list length, inclusively
1785 type The new shape type. A string that is either 'point', 'Gaussian', or 'disk'
1786 majoraxis The width of the larger axis. A quantity with angular units
1787 minoraxis The width of the smaller axis. A quantity with angular units
1788 positionangle The rotation of the axes with respect to the reference frame. A quantity with angular units
1789 majoraxiserror Error of width of the larger axis. A quantity with angular units
1790 minoraxiserror Error of the width of the smaller axis. A quantity with angular units
1791 positionangleerror Error of the rotation of the axes with respect to the reference frame. A quantity with angular units
1792 optionalparms optional parameters in a vector (for future use)
1793 log Send a message to the logger
1795 Example:
1797 cl.open('crux.cl', nomodify=False)
1798 cl.setshape(3, 'disk', '45mas', '45mas')
1799 print cl.getshape(3)['majoraxis']
1801 --------------------------------------------------------------------------------
1803 """
1804 return _componentlist.componentlist_setshape(self, *args, **kwargs)
1807 def convertshape(self, *args, **kwargs):
1808 """
1809 convertshape(self, _which, _majoraxis, _minoraxis, _positionangle) -> bool
1813 Summary:
1814 Change the units of the shape parameters (Not implemented yet)
1816 Description:
1822 Input Parameters:
1823 which A vector of indices specifying the components to modify. A vector with indices between 0 and one less than the list length, inclusively
1824 majoraxis The units to use on the larger axis. A string with angular units
1825 minoraxis The units to use on the smaller axis. A string with angular units
1826 positionangle The units to use for the rotation of these axes. A string with angular units
1828 --------------------------------------------------------------------------------
1830 """
1831 return _componentlist.componentlist_convertshape(self, *args, **kwargs)
1834 def spectrumtype(self, *args, **kwargs):
1835 """
1836 spectrumtype(self, _which) -> string
1840 Summary:
1841 Returns the spectral shape of the component
1843 Description:
1846 The spectrumtype function returns the current spectral shape of the
1847 specified component. The spectral shape defines how the flux of
1848 the component varies with frequency. Returns one of 'Constant',
1849 'Spectral Index', 'Tabular Spectrum', and 'Power Logarithmic Polynomial'.
1853 Input Parameters:
1854 which An index specifying which component. An integer between 0 and one less than the list length, inclusively
1856 Example:
1858 cl.open('crux.cl')
1859 print 'The first component has a', cl.spectrumtype(1), ' spectrum'
1861 --------------------------------------------------------------------------------
1863 """
1864 return _componentlist.componentlist_spectrumtype(self, *args, **kwargs)
1867 def getspectrum(self, *args, **kwargs):
1868 """
1869 getspectrum(self, _which) -> record *
1873 Summary:
1874 Return the spectral parameters the component
1876 Description:
1880 The getspectrum function returns the spectral parameters of a
1881 component in a record. As different spectral shapes can have a
1882 differing number and type of parameters the spectral parameters
1883 are returned in a record with fields that correspond to parameters
1884 relevant to the current spectral shape.
1886 For a constant spectrum there are only two fields; type and
1887 frequency. These are the spectral type, and the reference
1888 frequency. These values are also returned by the
1889 spectrumtype and
1890 getfreq
1891 functions.
1893 For the spectral index spectral shape there is also an index
1894 field. This contains a vector with four numbers, these are the
1895 spectral indicies for the I,Q,U,V components of the flux.
1897 The dictionary associated with a power log polynomial spectrum has the following structure:
1899 {
1900 'coeffs': array([ 1., 2., 3.]),
1901 'frequency': {
1902 'type': 'frequency',
1903 'm0': {'value': 1.4200000000000002, 'unit': 'GHz'},
1904 'refer': 'LSRK'
1905 },
1906 'type': 'Power Logarithmic Polynomial',
1907 'error': array([ 0., 0., 0.])
1908 }
1910 The 'error' value is currently not used.
1915 Input Parameters:
1916 which An index specifying which component. An integer between 0 and one less than the list length, inclusively
1918 Example:
1920 See the examples for the
1921 setspectrum and
1922 getspectrum
1923 functions.
1925 --------------------------------------------------------------------------------
1927 """
1928 return _componentlist.componentlist_getspectrum(self, *args, **kwargs)
1931 def setstokesspectrum(self, *args, **kwargs):
1932 """
1933 setstokesspectrum(self, _which, _type, _index, _tabularfreqs, _tabulari, _tabularq, _tabularu, _tabularv, _reffreq, _frame) -> bool
1937 Summary:
1938 Change the spectrum of the component
1940 Description:
1943 The setstokesspectrum function changes the spectrum of the specified components
1944 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
1946 The type argument defines what the sort of new spectrum to use. This
1947 can be either 'constant' or 'spectral index' or 'tabular'. The parsing of this
1948 string is case insensitive.
1950 If the spectrum type is 'constant' then the remaining arguments in
1951 this function are ignored. There are no other parameters needed to
1952 specify a constant spectrum.
1954 But if the spectrum is 'spectral index', the 'index' argument is
1955 needed. It is a 4 element vector.
1957 The first element ($alpha_0$) is the spectral index of stokes I ($ I(nu)=I(nu_0)({{nu}over{nu_0}})^{alpha_0} $)
1959 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.
1961 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$.
1963 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}$
1965 If the spectrum is 'tabular', then {tt index} is ignored but the six parameters
1966 {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.
1967 The Stokes parameters of the source is interpolated from these values. Extrappolation outside the range given in {tt tabularfreqs} is not done.
1968 {tt tabularfreqs} should be float values in 'Hz'
1969 {tt tabulari, tabularq, tabularu, tabularv} should be float values in 'Jy'
1972 You should ensure that the reference
1973 frequency is set to the value you desire, using the
1974 setfreq
1975 function if you change to the spectral index shape.
1979 Input Parameters:
1980 which The index specifying the component to modify. A value between 0 and one less than the list length, inclusively
1981 type The new spectrum type. A string that is either 'constant or 'spectral index' or 'tabular'
1982 index The spectral index.
1983 tabularfreqs The frequencies of for the tabular values, in Hz
1984 tabulari tabular Stokes I values, in Jy (same length as tabularfreqs)
1985 tabularq tabular Stokes Q values, in Jy (same length as tabularfreqs)
1986 tabularu tabular Stokes U values, in Jy (same length as tabularfreqs)
1987 tabularv tabular Stokes V values, in Jy (same length as tabularfreqs)
1988 reffreq The reference frequency for spectral index
1989 frame The frame for which the frequencies given are in
1991 Example:
1993 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.
1994 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.
1996 cl.addcomponent(shape='point', flux=[10.0, 0.4, -0.2, 0.1], dir='J2000 19h00m00 -20d00m00')
1997 cl.setstokesspectrum(which=0, type='spectral index', index=[1.0, 0.4, 0, 0.4], reffreq='2.0GHz')
1998 cl.rename('my19hcomp.cl')
1999 cl.done()
2003 In this example a componentlist is created from scratch and 2 sources are added
2004 One whose spectral variation is defined by a spectral index and the other one as
2005 tabular values. Both components have full Stokes parameters spectral variation
2006 defined.
2008 cl.done() ### effectively resets state of cl tool
2009 ###add first component
2010 cl.addcomponent(flux=[10, 0.5, -0.3, 0.2], dir='J2000 15h22m00 5d04m00')
2011 cl.setstokesspectrum(which=0, type='spectral index', index=[1.0, 0.4, 0, 0.4], reffreq='2.0GHz')
2012 ###adding second component; flux value is unimportant as the tabular values will
2013 ###will set it
2014 cl.addcomponent(flux=[1.0, 0, 0, 0],dir='J2000 15h22m30 5d05m00')
2015 ##define the IQUV flux variation as tabular values at different frequencies.
2016 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])
2017 ###saving the componentlist to disk
2018 cl.rename('two_comp.cl')
2019 cl.done() ###done is needed to sync to disk
2021 --------------------------------------------------------------------------------
2023 """
2024 return _componentlist.componentlist_setstokesspectrum(self, *args, **kwargs)
2027 def setspectrum(self, *args, **kwargs):
2028 """
2029 setspectrum(self, _which, _type, _index, _tabularfreqs, _tabularflux, _tabularframe) -> bool
2033 Summary:
2034 Change the spectrum of the component
2036 Description:
2039 The setspectrum function changes the spectrum of the specified components
2040 to the user specified spectrum.
2042 The type argument defines what the sort of new spectrum to use. This
2043 can be one of 'constant', 'tabular', 'plp', or 'spectral index'. Minimal
2044 match, case insensitive.
2046 If the spectrum type is 'constant' then the remaining arguments in
2047 this function are ignored. There are no other parameters needed to
2048 specify a constant spectrum. The reference frequency is set to be
2049 the same value as the component being replaced. Although this is
2050 unimportant for a constant spectrum, it may be important if
2051 the spectral model of the component in question is changed again
2052 later. See rules to how the reference frequencies of various spectral
2053 models are set in the description below.
2055 If the spectrum is 'spectral index', the 'index' argument is
2056 needed to fully specify the spectrum by using the index argument. The
2057 index parameter may be in the form of a single numerical value, or
2058 an array containing a numerical value. In the case of the array containing
2059 multiple values, the zeroth value is used as the value of index, while
2060 subsequent values are tacitly ignored. The functional form of this model
2061 is
2063 R = x^(alpha)
2065 where R = I_nu/I_nu0 is the ratio of the intensities at observed frequency nu
2066 and the reference frequency nu_0, x = nu/nu_0, and alpha is the specified
2067 spectral index. The reference frequency is tacitly set to that of the component
2068 being replaced. and can be changed by a subsequent call to setfreq().
2070 If spectrum = 'plp', then the spectral model is set to a power log polynomial.
2071 The functional form of this model is
2073 R = x^(c_0 + c_1*(ln(x)) + c_2*(ln(x))^2 + c_3*(ln(x))^3 + ... + c_n*(ln(x))^n)
2075 where R = I_nu/I_nu0 is the ratio of the intensities at observed frequency nu
2076 and the reference frequency nu_0, x = nu/nu_0, ln is the natural logarithm, and
2077 c_0 ... c_n are the coefficients specified by index. In this case, index should
2078 be an array of numerical values, and the array length is unconstrained. The
2079 reference frequency is tacitly set to that of the component being replaced, and
2080 can be changed by a subsequent call to setfreq().
2082 If the spectrum is 'tabular', then 'index' is ignored but the
2083 three parameters 'tabularfreqs', 'tabularflux' and 'tabularframe'
2084 are considered. 'tabularfreqs' and 'tabularflux' have to be list
2085 of same lengths and larger than 2. You need at least 2 samples to
2086 interpolate the spectral value in between. The flux of the source
2087 is interpolated from these values. Extrapolation outside the range
2088 given in 'tabularfreqs' is not done.
2089 'tabularfreqs' should be float values in 'Hz'
2090 'tabularflux' should be float values in 'Jy'
2091 The reference frequency is chosen to be the zeroth element of tabularfreqs.
2095 You should ensure that the reference
2096 frequency is set to the value you desire, using the
2097 setfreq
2098 function if you change to the spectral index shape.
2102 Input Parameters:
2103 which The index specifying the component to modify. A value between 0 and one less than the list length, inclusively
2104 type The new spectrum type. A string that is one of 'constant', 'spectral index' 'tabular', or 'plp' (caseless, minimum match)
2105 index The spectral index or coefficients for plp.
2106 tabularfreqs The frequencies of for the tabular values, in Hz
2107 tabularflux tabular flux density values, in Jy (same length as tabularfreqs)
2108 tabularframe For tabular models, the frame of the provided frequencies.
2110 Example:
2112 cl.open('centarusA.cl')
2113 cl.setspectrum(2, 'spectral index', -0.5)
2114 print cl.getcomponent(2)['spectrum']['index']
2115 cl.done()
2117 This example revises the model for Centaurus-A changing the
2118 spectral index of all the components in the left lobe. The
2119 output from the print statement is '[-0.5 0 0 0]'
2121 cl.addcomponent(shape='point', flux=[1.0, 0.0, 0.0, 0.0], dir='J2000 19h00m00 -20d00m00')
2122 cl.setspectrum(which=0, type='tabular', tabularfreqs=[1.0e9, 1.1e9, 1.4e9], tabularflux=[1.0, 0.9, 0.75])
2123 cl.rename('my19hcomp.cl')
2124 cl.done()
2126 In this example a component is created from scratch as a point
2127 source The spectrum is set to, say, measured values at 3
2128 frequencies (1GHz, 1.1GHz and 1.4GHz) to 1.0Jy, 0.9Jy, 0.75Jy
2129 respectively. Any frequency in between the range 1 to 1.4 GHz
2130 the flux will be estimated by interpolation.
2132 cl.open('my.cl')
2133 cl.addcomponent(shape='point', flux=[1.0, 0.0, 0.0, 0.0], dir='J2000 19h00m00 -20d00m00')
2134 cl.setspectrum(which=0, type='plp', index=[1, 2, 3])
2136 In this example, the initial component's spectrum is modified to a power log polynomial
2137 with the specified indices.
2139 --------------------------------------------------------------------------------
2141 """
2142 return _componentlist.componentlist_setspectrum(self, *args, **kwargs)
2145 def getfreq(self, *args, **kwargs):
2146 """
2147 getfreq(self, _which) -> record *
2151 Summary:
2152 Get the reference frequency (Not implemented yet)
2154 Description:
2160 Input Parameters:
2161 which An index specifying which component. An integer between 0 and one less than the list length, inclusively
2163 --------------------------------------------------------------------------------
2165 """
2166 return _componentlist.componentlist_getfreq(self, *args, **kwargs)
2169 def getfreqvalue(self, *args, **kwargs):
2170 """
2171 getfreqvalue(self, _which) -> double
2175 Summary:
2176 Get the reference frequency value (Not implemeted yet)
2178 Description:
2184 Input Parameters:
2185 which An index specifying which component. An integer between 0 and one less than the list length, inclusively
2187 --------------------------------------------------------------------------------
2189 """
2190 return _componentlist.componentlist_getfreqvalue(self, *args, **kwargs)
2193 def getfrequnit(self, *args, **kwargs):
2194 """
2195 getfrequnit(self, _which) -> string
2199 Summary:
2200 Get the reference frequency unit (Not implemeted yet)
2202 Description:
2208 Input Parameters:
2209 which An index specifying which component. An integer between 0 and one less than the list length, inclusively
2211 Example:
2213 See the example for the
2214 getfreqvalue function.
2216 --------------------------------------------------------------------------------
2218 """
2219 return _componentlist.componentlist_getfrequnit(self, *args, **kwargs)
2222 def getfreqframe(self, *args, **kwargs):
2223 """
2224 getfreqframe(self, _which) -> string
2228 Summary:
2229 Get the reference frequency frame (Not implemeted yet)
2231 Description:
2238 Input Parameters:
2239 which An index specifying which component. An integer between 0 and one less than the list length, inclusively
2241 Example:
2243 See the example for the
2244 getfreqvalue function.
2246 --------------------------------------------------------------------------------
2248 """
2249 return _componentlist.componentlist_getfreqframe(self, *args, **kwargs)
2252 def setfreq(self, *args, **kwargs):
2253 """
2254 setfreq(self, _which, _value, _unit, _log) -> bool
2258 Summary:
2259 Set the reference frequency
2261 Description:
2265 The setfreq function sets the reference frequency of the specified
2266 components to a new value. The frequency is defined by separately
2267 specifying the value and its units. Use the
2268 setfreqframe
2269 function to set the frequency reference frame
2273 Input Parameters:
2274 which An index specifying the component to modify An integer between 0 and one less than the list length, inclusively
2275 value The new frequency value. A number
2276 unit The units of the frequency. Any string with the same dimensions as the 'Hz'
2277 log Send a message to the logger
2279 Example:
2281 cl.open('centarusA.cl')
2282 cl.setfreq(1, 1.415, 'GHz')
2284 --------------------------------------------------------------------------------
2286 """
2287 return _componentlist.componentlist_setfreq(self, *args, **kwargs)
2290 def setfreqframe(self, *args, **kwargs):
2291 """
2292 setfreqframe(self, _which, _frame, _log) -> bool
2296 Summary:
2297 Set the reference frame for the frequency
2299 Description:
2303 The setfreqframe function sets the reference frame for the
2304 reference frequency of the specified components.
2306 Currently the reference frame does not include additional
2307 information like when are where the observation took place. Hence
2308 no conversion between reference frames is available. In the
2309 interim I recommend you always use the same frame.
2313 Input Parameters:
2314 which An index specifying the component to modify. An integer between 0 and one less than the list length, inclusively
2315 frame The new reference frame, A string like 'LSRK', 'LSRD', 'GEO' or 'TOPO
2316 log Send a message to the logger
2318 Example:
2320 cl.open('centarusA.cl')
2321 cl.setfreqframe(0, 'LSRK')
2323 --------------------------------------------------------------------------------
2325 """
2326 return _componentlist.componentlist_setfreqframe(self, *args, **kwargs)
2329 def convertfrequnit(self, *args, **kwargs):
2330 """
2331 convertfrequnit(self, _which, _unit) -> bool
2335 Summary:
2336 Convert the reference frequency to a new unit
2338 Description:
2342 The convertfrequnit function changes the specified components to use
2343 a new unit for the reference frequency. Using this function will
2344 change the frequency value also so that the overall reference
2345 frequency is not changed. It will affect the values and units
2346 obtained with
2347 setfreqvalue
2348 function.
2350 Any unit can be used that has the same dimensions as the 'Hz'.
2354 Input Parameters:
2355 which An index specifying the component to modify. An integer between 0 and one less than the list length, inclusively
2356 unit The new frequency unit. Any string with the same dimensions as the 'Hz'
2358 Example:
2360 cl.open('centarusA.cl');
2361 cl.convertfrequnit(1, 'kHz');
2363 --------------------------------------------------------------------------------
2365 """
2366 return _componentlist.componentlist_convertfrequnit(self, *args, **kwargs)
2369 def getcomponent(self, *args, **kwargs):
2370 """
2371 getcomponent(self, _which, _iknow) -> record *
2375 Summary:
2376 Extract a component from the list.
2378 Description:
2382 The component function returns a record, showing the current state
2383 of the specified component in the list.
2385 Modifying the record that is returned by this function does not
2386 modify the component in the list. To do this you must remove the
2387 component from the list, using the
2388 remove function,
2389 and add the modified component using the
2390 add function, or use
2391 the replace object
2392 function. This function will be removed in a future release of
2393 and you are urged to use the get functions to extract
2394 information about a component.
2398 Input Parameters:
2399 which index of which component to extract. integers between 0 and one less than the length of the list, inclusively
2400 iknow Suppress the warning message
2402 --------------------------------------------------------------------------------
2404 """
2405 return _componentlist.componentlist_getcomponent(self, *args, **kwargs)
2408 def add(self, *args, **kwargs):
2409 """
2410 add(self, _thecomponent, _iknow) -> bool
2414 Summary:
2415 Add a component to the list.
2417 Description:
2420 The add function adds a component to the component
2421 list. You cannot add components to a list that has been opened
2422 read only. To use this function you need to know the details of
2423 the record format. however this has been deprecated and you are
2424 urged to use the set functions, in conjunction with the simulate
2425 function to add a component to the list.
2429 Input Parameters:
2430 thecomponent A record that represents a component. any record that contains the required fields
2431 iknow Suppress the warning message
2433 --------------------------------------------------------------------------------
2435 """
2436 return _componentlist.componentlist_add(self, *args, **kwargs)
2439 def replace(self, *args, **kwargs):
2440 """
2441 replace(self, _which, _list, _whichones) -> bool
2445 Summary:
2446 Replace components in the list. {bf (Not implemented yet) }
2448 Description:
2452 The replace function replaces the components from the list with
2453 the specified components from another list. The source list can be
2454 opened readonly and the length of the vectors in the first and
2455 third arguments must the the name.
2457 You cannot replace components in a list that has been opened read
2458 only.
2462 Input Parameters:
2463 which A vector of indices specifying the components to replace. A vector with indices between 0 and one less than the list length, inclusively
2464 list The list containing the components to copy. A componentlist tool
2465 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
2467 --------------------------------------------------------------------------------
2469 """
2470 return _componentlist.componentlist_replace(self, *args, **kwargs)
2473 def summarize(self, *args, **kwargs):
2474 """
2475 summarize(self, _which) -> bool
2479 Summary:
2480 Summarize the specified component to the logger
2482 Description:
2485 The summarize function summarizes the contents of the specified components to the logger.
2488 Input Parameters:
2489 which An index specifying which component. Unset or an integer between 0 and one less than the list length, inclusive
2491 --------------------------------------------------------------------------------
2493 """
2494 return _componentlist.componentlist_summarize(self, *args, **kwargs)
2497 def iscomponentlist(self, *args, **kwargs):
2498 """
2499 iscomponentlist(self, _tool) -> bool
2503 Summary:
2504 Is the argument a componentlist tool? (Not implemented yet)
2506 Description:
2509 This global function can be used to determine if the supplied
2510 argument is a componentlist tool. If so it returns True, otherwise
2511 it returns False.
2514 Input Parameters:
2515 tool The variable that you wish to test
2517 --------------------------------------------------------------------------------
2519 """
2520 return _componentlist.componentlist_iscomponentlist(self, *args, **kwargs)
2522 __swig_destroy__ = _componentlist.delete_componentlist
2523 __del__ = lambda self: None
2524componentlist_swigregister = _componentlist.componentlist_swigregister
2525componentlist_swigregister(componentlist)
2527# This file is compatible with both classic and new-style classes.