Coverage for /wheeldirectory/casa-6.7.0-11-py3.10.el8/lib/py/lib/python3.10/site-packages/casatools/__casac__/synthesisutils.py: 40%
124 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-23 15:54 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-23 15:54 +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, '_synthesisutils')).lstrip('.')
13 try:
14 return importlib.import_module(mname)
15 except ImportError:
16 return importlib.import_module('_synthesisutils')
17 _synthesisutils = 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('_synthesisutils', [dirname(__file__)])
26 except ImportError:
27 import _synthesisutils
28 return _synthesisutils
29 try:
30 _mod = imp.load_module('_synthesisutils', fp, pathname, description)
31 finally:
32 if fp is not None:
33 fp.close()
34 return _mod
35 _synthesisutils = swig_import_helper()
36 del swig_import_helper
37else:
38 import _synthesisutils
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 synthesisutils(_object):
99 """Proxy of C++ casac::synthesisutils class."""
101 __swig_setmethods__ = {}
102 __setattr__ = lambda self, name, value: _swig_setattr(self, synthesisutils, name, value)
103 __swig_getmethods__ = {}
104 __getattr__ = lambda self, name: _swig_getattr(self, synthesisutils, name)
105 __repr__ = _swig_repr
107 def __init__(self):
108 """__init__(self) -> synthesisutils"""
109 this = _synthesisutils.new_synthesisutils()
110 try:
111 self.this.append(this)
112 except __builtin__.Exception:
113 self.this = this
115 def contdatapartition(self, *args, **kwargs):
116 """
117 contdatapartition(self, _selpars, _npart) -> record *
121 Summary:
122 Partition data selection parameters for continuum imaging
124 Input Parameters:
125 selpars All selection parameters for one or more MSs
126 npart Number of partitions
128 --------------------------------------------------------------------------------
130 """
131 return _synthesisutils.synthesisutils_contdatapartition(self, *args, **kwargs)
134 def advisechansel(self, *args, **kwargs):
135 """
136 advisechansel(self, _freqstart, _freqend, _freqstep, _freqframe, _ephemtable, _msname, _fieldid, _getfreqrange, _spwselection) -> record *
140 Summary:
141 Advise on spw and chan selection optimal for the image frequency range wanted
143 Description:
146 It is a helper function, for cube imaging, that allows you to
147 determine the spectral window data selection you may need to cover a
148 given range of frequencies.
150 In the mode with getfreqrange=False, the freqstep can be used (i.e., set to the channel width) to achieve the extra padding needed for data selection at the beginning and end of the desired cube range in order to retrieve all channels that will potentially contribute to the edge channels of the cube (to maximize S/N). If freqstep is not specified, it is taken as zero, and the output channel range will typically be slightly smaller.
152 The meaning of freqframe parameter is dependent on the value of getfreqrange.
153 When getfreqrange=False, frequency parameters are considered as input parameters that are known to be in the frame specified by freqframe; but when getfreqrange=True, the frequency parameters are output parameters that will be determined in the frame specified by freqframe. In the former case, the frequencies will be converted to the frame of the data as a function of time in order to locate which channels match.
155 You need to specify the field_id for which this calculation is
156 being done.
158 If the parameter {tt getfreqrange=True} then the reverse is requested. You set {tt spwselection} to be the range of data selection you want to use and you'll get the range of frequency covered in the frame you set. The freqstart and freqend output values correspond to the frequency of the extreme edges of the requested channel range.
159 Inputs
160 ----------------
161 freqstart
162 Begining of frequency range
163 allowed: double, string, quantity
164 example: freqstart='1.0GHz'
165 Default:
166 ----------------
167 freqend
168 End of frequency range
169 allowed: double, string, quantity
170 example: freqend='2.0GHz'
171 Default:''
172 -----------------
173 freqstep
174 spectral channel resolution of intended image
175 allowed: double, string, quantity
176 example: freqstep='1.0MHz'
177 Default:''
178 -----------------
179 freqframe
180 frame in which frequency is being expressed in other parameters. For solar system moving sources if the frame of the source is intended then this parameter can be 'SOURCE'
181 allowed : one of the following strings 'LSRK', 'LSRD', 'BARY', 'GEO', 'TOPO', 'GALACTO', 'LGROUP','CMB', 'SOURCE'
182 Default: 'LSRK'
183 ----------------
184 msname
185 name of a valid measurement set.
186 allowed: string
187 Default: ''
188 -----------------
189 ephemtable
190 when freqframe='SOURCE' this parameter is used
191 name of a valid ephemeris table or 'TRACKFIELD' to use the ephemeris table attached to the FIELD subtable of the ms or one of the following solar system object: 'MERCURY', 'VENUS', 'MARS', 'JUPITER', 'SATURN', 'URANUS', 'NEPTUNE', 'PLUTO', 'SUN', 'MOON'
192 allowed: string
193 Default: ''
194 -----------------
195 fieldid
196 fieldid to use (needed to get the direction on the sky for any spectral frame conversion)
197 allowed: integer
198 Default: 0
199 -------------------
200 getfreqrange
201 if set then freqrange is returned in the frame requested for the data selected
202 allowed: bool
203 Default: False
204 -----------------
205 spwselection
206 if getfreqrange=True then this is needed to find the range of frequency in the frame requested. It should have the spectral window selection syntax as defined in the msselection (Casa memo 3)
207 allowed: string
208 Default: ''
210 Input Parameters:
211 freqstart Begining of frequency range in Hz
212 freqend End of frequency range in Hz
213 freqstep spectral channel resolution of intended image in Hz
214 freqframe frame in which frequency is being expressed in other parameters
215 ephemtable valid ephemeris table name or TRACKFIELD (use ephemeris in FIELD subtable) if freqframe is SOURCE
216 msname name of an ms, if empty string it will use the ms's used in selectvis
217 fieldid fieldid to use when msname is not empty otherwise ignored and field selected in selectvis is used
218 getfreqrange if set then freqrange is returned in the frame requested for the data selected
219 spwselection if getfreqrange=True then this is needed to find the range of frequency in the frame requested
221 Example:
223 Example 1
224 In this example, we are interested in an image cube which span 20.0682GHz to 20.1982 in LSRK which will have a channel resolution of 3.9MHz. The field we are interested the one with fieldid=4
226 #############################
227 >>> from casatools import synthesisutils
228 >>> syut=synthesisutils()
229 >>> syut.advisechansel(freqstart='20.0682GHz', freqend='20.1982GHz', freqstep='3.9kHz', freqframe='LSRK', msname='test1.ms')
230 {'nchan': array([109, 23], dtype=int32), 'spw': array([4, 5], dtype=int32),
231 'start': array([19, 0], dtype=int32)}
232 # implies 108 channels of spw 4 starting channel 19 and 23 channels of spw 5 starting at channel 0 would contribute data to the frequency range under consideration
233 #############################
235 Example 2
237 To determine what is the frequency range in a given frame is covered by a given spwselection of the ms
239 ##############
240 >>> syut.advisechansel(msname='test3.ms', freqframe='LSRK', getfreqrange=True, spwselection='0:20~210')
242 {'freqend': {'unit': 'Hz', 'value': 362746224619.3091}, 'freqstart': {'unit': 'Hz', 'value': 362512788988.5036}}
244 ##############
246 Example 3:
248 Same as Example 1 but with a solar system moving source and the frequency range provided is in the frame of the source. We are using the ephemeris table attached to the FIELD subtable of the ms.
250 ##########
251 >>> syut.advisechansel(msname='uid___A002_Xc05f54_X142a_target.spw31.contsub.ms', freqstart='362.5145206GHz', freqend='362.7476643GHz', freqstep='122.064714kHz', fieldid=3, freqframe='SOURCE', ephemtable='TRACKFIELD')
252 ###########
253 Now one can do the same with a valid ephemeris table
254 ###########
255 >>> syut.advisechansel(msname='uid___A002_Xc05f54_X142a_target.spw31.contsub.ms', freqstart='362.5145206GHz', freqend='362.7476643GHz', freqstep='122.064714kHz', fieldid=3, freqframe='SOURCE', ephemtable='EPHEM0_Titan_57889.1.tab')
256 ###########
258 Or if we want it in the frame of a solar system source known by casa, e.g 'SATURN'
259 ############
260 >>> syut.advisechansel(msname='uid___A002_Xc05f54_X142a_target.spw31.contsub.ms', freqstart='362.5145206GHz', freqend='362.7476643GHz', freqstep='122.064714kHz', fieldid=3, freqframe='SOURCE', ephemtable='SATURN')
261 ############
263 Example 4:
265 Same as Example 2 but with a solar system moving source and the frequency range we want to find is in the frame of the source.
267 ############
268 >>> syut.advisechansel(msname='uid___A002_Xc05f54_X142a_target.spw31.contsub.ms', fieldid=3, freqframe='SOURCE', ephemtable='TRACKFIELD', getfreqrange=True, spwselection='31:9~1919')
269 #############
270 similarly if we want it in the frame of a solar system source known casa e.g saturn
271 #############
272 >>> syut.advisechansel(msname='uid___A002_Xc05f54_X142a_target.spw31.contsub.ms', fieldid=3, freqframe='SOURCE', ephemtable='SATURN', getfreqrange=True, spwselection='31:9~1919')
273 #############
275 --------------------------------------------------------------------------------
277 """
278 return _synthesisutils.synthesisutils_advisechansel(self, *args, **kwargs)
281 def cubedatapartition(self, *args, **kwargs):
282 """
283 cubedatapartition(self, _selpars, _npart, _fstart, _fend, _frame) -> record *
287 Summary:
288 Partition data selection parameters for CUBE imaging
290 Description:
293 returns a dictionary with data spectral parttiion that maps data to nparts
294 of the input range frequency... usually to be used for doing data selection
295 when imaging a cube from fstart to fend in npart subcubes
297 Input Parameters:
298 selpars All selection parameters for one or more MSs
299 npart Number of partitions
300 fstart start frequency of cube image
301 fend end frequency of cube image
302 frame frame of fstart and fend
304 Example:
306 ##make a synthesisutils tool
307 siu=casac.synthesisutils()
308 ### define first ms parameters
309 msrec={'msname':'ngc5921.ms.contsub', 'field':'0', 'spw':'0'}
310 pars={'ms0':msrec}
311 ## can add ms1, ms2 etc for multiple ms into dictionary pars
313 ##now get the data selections for 20 subpart of a cube that
314 ## spans from 1.412787GHz to 1.413287GHz
315 siu.cubedatapartition(selprs=pars, npart=20, fstart='1.412787GHz', fend='1.413287GHz', frame='LSRK')
317 --------------------------------------------------------------------------------
319 """
320 return _synthesisutils.synthesisutils_cubedatapartition(self, *args, **kwargs)
323 def cubeimagepartition(self, *args, **kwargs):
324 """
325 cubeimagepartition(self, _impars, _npart) -> record *
329 Summary:
330 Partition image cube parameters for CUBE deconvolution
332 Input Parameters:
333 impars All imaging parameters for one or more image fields
334 npart Number of partitions
336 --------------------------------------------------------------------------------
338 """
339 return _synthesisutils.synthesisutils_cubeimagepartition(self, *args, **kwargs)
342 def cubedataimagepartition(self, *args, **kwargs):
343 """
344 cubedataimagepartition(self, _selpars, _incsys, _npart, _nchannel) -> record *
348 Summary:
349 Partition data/image cube parameters for CUBE deconvolution
351 Input Parameters:
352 selpars All selection parameters for one or more MSs
353 incsys input coordinate system
354 npart Number of partitions
355 nchannel Number of channels
357 --------------------------------------------------------------------------------
359 """
360 return _synthesisutils.synthesisutils_cubedataimagepartition(self, *args, **kwargs)
363 def checkselectionparams(self, *args, **kwargs):
364 """
365 checkselectionparams(self, _selpars) -> record *
369 Summary:
370 Check and Fix Selection Parameters for one MS
372 Input Parameters:
373 selpars All selection parameters for one MS
375 --------------------------------------------------------------------------------
377 """
378 return _synthesisutils.synthesisutils_checkselectionparams(self, *args, **kwargs)
381 def checkimageparams(self, *args, **kwargs):
382 """
383 checkimageparams(self, _impars) -> record *
387 Summary:
388 Check and Fix Imaging Parameters for one field
390 Input Parameters:
391 impars All imaging parameters for one image-field
393 --------------------------------------------------------------------------------
395 """
396 return _synthesisutils.synthesisutils_checkimageparams(self, *args, **kwargs)
399 def checkgridparams(self, *args, **kwargs):
400 """
401 checkgridparams(self, _gridpars) -> record *
405 Summary:
406 Check and Fix Gridding/FTM Parameters for one field
408 Input Parameters:
409 gridpars All gridding/ftm parameters for one image-field
411 --------------------------------------------------------------------------------
413 """
414 return _synthesisutils.synthesisutils_checkgridparams(self, *args, **kwargs)
417 def updateimpars(self, *args, **kwargs):
418 """
419 updateimpars(self, _impars) -> record *
423 Summary:
424 check the consistency between the csys record and other impars and update/modify impars if necessary
426 Input Parameters:
427 impars All image parameters of one image-field
429 --------------------------------------------------------------------------------
431 """
432 return _synthesisutils.synthesisutils_updateimpars(self, *args, **kwargs)
435 def getOptimumSize(self, *args, **kwargs):
436 """
437 getOptimumSize(self, _size) -> long
441 Summary:
442 Get Optimum Image size
444 Input Parameters:
445 size Input size
447 --------------------------------------------------------------------------------
449 """
450 return _synthesisutils.synthesisutils_getOptimumSize(self, *args, **kwargs)
453 def fitPsfBeam(self, *args, **kwargs):
454 """
455 fitPsfBeam(self, _imagename, _nterms, _psfcutoff) -> bool
459 Summary:
460 Fit a restoring beam to the PSF, and save it in the PSF image.
462 Input Parameters:
463 imagename Image Prefix name
464 nterms Single or Multi-Term (to pick namng conventions)
465 psfcutoff A fractional cut-off level to determine what part of the PSF is sent to the beam fitter
467 --------------------------------------------------------------------------------
469 """
470 return _synthesisutils.synthesisutils_fitPsfBeam(self, *args, **kwargs)
473 def taylor_coeffs_to_cube(self, *args, **kwargs):
474 """
475 taylor_coeffs_to_cube(self, _cubename, _mtname, _nterms, _reffreq) -> bool
479 Summary:
480 Convert Taylor-coefficient images to a Cube
482 Input Parameters:
483 cubename Cube Image Name prefix
484 mtname Multi-Term Image Name Prefix
485 nterms Single or Multi-Term (to pick naming conventions)
486 reffreq Reference Frequency to use for the Taylor expansion
488 --------------------------------------------------------------------------------
490 """
491 return _synthesisutils.synthesisutils_taylor_coeffs_to_cube(self, *args, **kwargs)
494 def cube_to_taylor_sum(self, *args, **kwargs):
495 """
496 cube_to_taylor_sum(self, _cubename, _mtname, _nterms, _reffreq, _imtype, _pblimit) -> bool
500 Summary:
501 Convert Cube images to Taylor Weighted averages across frequency
503 Input Parameters:
504 cubename Cube Image Name prefix
505 mtname Multi-Term Image Name Prefix
506 nterms Single or Multi-Term (to pick naming conventions)
507 reffreq Reference Frequency to use for the Taylor expansion
508 imtype 0 : Collapse the PSF cube to 2nterms-1 images. 1 : Collapse the residual cube to nterms images. 2 : Collapse the pb cube to a single .tt0 image
509 pblimit pblimit
511 --------------------------------------------------------------------------------
513 """
514 return _synthesisutils.synthesisutils_cube_to_taylor_sum(self, *args, **kwargs)
517 def remove_freq_dep_pb(self, *args, **kwargs):
518 """
519 remove_freq_dep_pb(self, _cubename, _mtname, _pblimit) -> bool
523 Summary:
524 Divide by the frequency dependent PB and multiply by an avg PB
526 Input Parameters:
527 cubename Cube Image Name prefix
528 mtname mt-prefix for average PB to apply after removing the frequency dependent PB
529 pblimit pblimit
531 --------------------------------------------------------------------------------
533 """
534 return _synthesisutils.synthesisutils_remove_freq_dep_pb(self, *args, **kwargs)
537 def apply_freq_dep_pb(self, *args, **kwargs):
538 """
539 apply_freq_dep_pb(self, _cubename, _mtname, _pblimit) -> bool
543 Summary:
544 Divide by the avgPB and multiply by the frequency dependent PB
546 Input Parameters:
547 cubename Cube Image Name prefix
548 mtname mt-prefix for average PB to remove before applying the frequency dependent PB
549 pblimit pblimit
551 --------------------------------------------------------------------------------
553 """
554 return _synthesisutils.synthesisutils_apply_freq_dep_pb(self, *args, **kwargs)
557 def done(self):
558 """
559 done(self) -> bool
563 Summary:
564 Close the tool
566 --------------------------------------------------------------------------------
568 """
569 return _synthesisutils.synthesisutils_done(self)
571 __swig_destroy__ = _synthesisutils.delete_synthesisutils
572 __del__ = lambda self: None
573synthesisutils_swigregister = _synthesisutils.synthesisutils_swigregister
574synthesisutils_swigregister(synthesisutils)
576# This file is compatible with both classic and new-style classes.