Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatools/__casac__/calibrater.py: 53%
166 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-31 17:39 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-31 17:39 +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, '_calibrater')).lstrip('.')
13 try:
14 return importlib.import_module(mname)
15 except ImportError:
16 return importlib.import_module('_calibrater')
17 _calibrater = 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('_calibrater', [dirname(__file__)])
26 except ImportError:
27 import _calibrater
28 return _calibrater
29 try:
30 _mod = imp.load_module('_calibrater', fp, pathname, description)
31 finally:
32 if fp is not None:
33 fp.close()
34 return _mod
35 _calibrater = swig_import_helper()
36 del swig_import_helper
37else:
38 import _calibrater
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 calibrater(_object):
99 """Proxy of C++ casac::calibrater class."""
101 __swig_setmethods__ = {}
102 __setattr__ = lambda self, name, value: _swig_setattr(self, calibrater, name, value)
103 __swig_getmethods__ = {}
104 __getattr__ = lambda self, name: _swig_getattr(self, calibrater, name)
105 __repr__ = _swig_repr
107 def __init__(self):
108 """__init__(self) -> calibrater"""
109 this = _calibrater.new_calibrater()
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, _compress, _addcorr, _addmodel) -> bool
121 Summary:
122 Attach MeasurementSet to the calibrater tool
124 Description:
127 Attaches a MeasurementSet to the {tt calibrater} tool for further processing with
128 other methods.
130 Input Parameters:
131 filename MeasurementSet file name. No default
132 compress Compress calibration columns?
133 addcorr Add scratch columns?
134 addmodel Add MODEL_DATA column along with CORRECTED_DATA ?
136 Example:
138 cb.open('ngc5921.ms');
140 --------------------------------------------------------------------------------
142 """
143 return _calibrater.calibrater_open(self, *args, **kwargs)
146 def selectvis(self, *args, **kwargs):
147 """
148 selectvis(self, _time, _spw, _scan, _field, _intent, _observation, _baseline, _uvrange, _chanmode, _nchan, _start, _step, _mstart, _mstep, _msselect) -> bool
152 Summary:
153 Set the data selection for subsequent processing
155 Description:
159 This function provids for selection of the visibility data from the MS
160 which will be treated by subsequent execution of the {stfaf solve} and
161 {stfaf correct} functions. Note that data selection is not cumulative, i.e.,
162 any selection made in a previous call to {stfaf selectvis} will be overridden
163 by the the current call.
165 Most of the {stfaf selectvis} parameters use the standardized MS Selection
166 syntax.
168 The parameters are described below. The selected data will satisfy the
169 logical AND of all non-trivially specified parameters. Note that the
170 old-fashioned strided channel selection parameters are deprecated (and
171 will soon be removed); use spw instead. Running {stfaf selectvis} with
172 no specified parameters restores selection of the entire MS.
175 begin{description}
176 item[time] is used to specify time ranges in a stardard format
178 item[spw] is used to specify spectral window and channel selection. Currently,
179 only a single channel range can be specified per spw.
181 item[scan] is used to specify scan numbers and ranges
183 item[observation] is used to specify observation ID(s).
185 item[field] is used to specify field names or indices
187 item[baseline] is used to specify antenna and baseline combinations
189 item[uvrange] is used to specify baseline length ranges
191 item[chanmode] is deprecated (use spw)
192 item[nchan] is deprecated (use spw)
193 item[start] is deprecated (use spw)
194 item[step] is deprecated (use spw)
195 item[mstart] is deprecated (use spw)
196 item[mstep] is deprecated (use spw)
198 item[msselect] is used to specify a subselection of data according to
199 Measurement Set columns in conditional combinations not possible
200 with the standard parameters above. This parameter should be specified
201 as a valid htmladdnormallink{TaQL}{../../notes/199/199.html} expression.
202 If both msselect and the standard selection parameter are used together,
203 they are combined with a logical AND, i.e., the data must jointly satisfy
204 all {stfaf selectvis} parameters.
206 end{description}
208 Input Parameters:
209 time Select on time
210 spw Select on spectral window
211 scan Select on scan
212 field Select on field
213 intent Select on intent or state
214 observation Select by observation ID(s)
215 baseline Select on antennas/baselines
216 uvrange Select by uvrange
217 chanmode Type of data selection: channel or velocity
218 nchan Number of channels to select (mode='channel')
219 start Start channel (0-relative) (mode='channel')
220 step Step in channel number (mode='channel')
221 mstart Start velocity (e.g. '20Km/s')
222 mstep Step in velocity (e.g. '100m/s')
223 msselect TAQL selection string. Default (empty) is no specific selection.
225 Example:
227 Open and select a field:
230 cb.open('ngc5921.ms');
231 cb.selectvis(field='N5921_2'); # by complete name
232 cb.selectvis(field='N5921*'); # with wildcard
233 cb.selectvis(field='2'); # by index
236 Select a field and a channel range:
239 cb.selectvis(spw='0:10~40',field='N5921*');
242 Select using all MS Selection parameters (these parameters are
243 over-specified somewhat, i.e., scan 6 contains only field N5921_2,
244 etc.):
247 cb.selectvis(time='>1995/04/13/10:40:00', # times greater than this
248 spw='0:20~40', # channels 20-40 in spw 0
249 scan='6', # scan 6 only
250 field='N59*', # fields matching N59*
251 baseline='1 & *', # baselines to antenna 1
252 uvrange='>0.0klambda') # baselines greater than zero length
256 Reset selection to the entire dataset
259 cb.selectvis()
261 --------------------------------------------------------------------------------
263 """
264 return _calibrater.calibrater_selectvis(self, *args, **kwargs)
267 def setmodel(self, *args, **kwargs):
268 """
269 setmodel(self, _modelimage) -> bool
273 Summary:
274 Set the sky model used to compute the model visibilities
276 Description:
279 Name of the model image to be used as a sky model for model visibility
280 computations. For now, this is used only by EP-Jones solver.
282 Input Parameters:
283 modelimage Name of the model image.
285 Example:
287 cb.setmodel('mymodel');
289 --------------------------------------------------------------------------------
291 """
292 return _calibrater.calibrater_setmodel(self, *args, **kwargs)
295 def setptmodel(self, *args, **kwargs):
296 """
297 setptmodel(self, _stokes) -> bool
301 Summary:
302 Set the point source model Stokes parameters to be used to compute the model visibilities
304 Description:
307 Set a global point source model Stokes parameters to use in solving operations.
309 Input Parameters:
310 stokes Vector of Stokes parameters.
312 Example:
314 cb.setmodel([1,1,0,0]);
316 --------------------------------------------------------------------------------
318 """
319 return _calibrater.calibrater_setptmodel(self, *args, **kwargs)
322 def setapply(self, *args, **kwargs):
323 """
324 setapply(self, _type, _t, _table, _field, _interp, _select, _calwt, _spwmap, _opacity) -> bool
328 Summary:
329 Arrange to apply calibration
331 Description:
335 This function is used to specify the calibration components which should be
336 applied during subsequent execution of the {stfaf solve} and
337 {stfaf correct} functions. This function should be executed as many
338 times as necessary to specify all desired calibration components.
340 Each calibration component represents a separate calibration matrix
341 correction included in the measurement equation. The different types
342 correspond to different instrumental and atmospheric effects.
343 Calibration components are available as calibration tables generated
344 by previous {stfaf solve} executions (types 'B','BPOLY','G','GSPLINE',
345 'D','DF','T','M','MF','X'), or are calculated analytically on
346 the fly (types 'P', 'TOPAC', 'GAINCURVE'). Upon execution
347 of {stfaf solve} or {stfaf correct}, the group of specified
348 calibration components will be applied in the order prescribed
349 by the Measurement Equation formalism.
351 The parameters are as follows:
353 begin{description}
355 item[type] The calibration type being specified. This is only required
356 for analytic types ('P','TOPAC','GAINCURVE'). When specifying an existing
357 pre-solved calibration table, it is not necessary to explicitly specify the
358 {stfaf type}; this will be discerned from the table. (Specifying the
359 {stfaf type} as well as the {stfaf table} will force a check that the
360 table contains solutions of the specified type.
362 For {stfaf type='GAINCURVE'}, an elevation-dependent correction
363 will be applied using parameters read from the data repository.
364 Currently, this is only supported for the VLA.
366 item[t] This parameter will be used in a future release to control
367 the range of applicability of the specified calibration. Currently,
368 it is ignored.
370 item[table] For pre-solved calibration, the file name of the table
371 to apply.
373 item[field] The fields to select from the specified table, using
374 MS Selection syntax (as in selectvis).
376 item[interp] The desired type of time-dependent interpolation. Use
377 {stfaf interp='nearest'} to calibrate each datum with the calibration
378 value nearest in time. Use {stfaf interp='linear'} to calibrate each
379 datum with calibration phases and amplitudes linearly interpolated
380 from neighboring (in time) values. In the case of phase, this mode
381 will assume that phase jumps greater than 180 degrees between neighboring
382 points indicate a cycle slip, and the interpolated value will follow
383 this change in cycle accordingly (i.e., the implied rate will always
384 be less than 180 degrees per sample). Use {stfaf interp='aipslin'}
385 to emulate the basic interpolation mode used in classic AIPS, i.e.,
386 linearly interpolated amplitudes, with phases derived from linear
387 interpolation of the complex calibration values. While this method
388 avoids having to track cycle slips (which is unstable for solutions
389 with very low SNR), it will yield a phase interpolation which becomes
390 increasingly non-linear as the spanned phase difference increases. The
391 non-linearity mimics the behavior of {stfaf interp='nearest'} as
392 the spanned phase difference approaches 180 degrees (the phase of the
393 interpolated complex calibration value initially changes very slowly,
394 then rapidly jumps to the second value at the midpoint of the interval).
395 If the uncalibrated phase is changing this rapidly, a 'nearest' interpolation
396 is not desirable. Usually, {stfaf interp='linear'} is the best choice.
397 The {stfaf interp} parameter is applicable to any calibration type,
398 as long as there are sufficient solutions available to perform the
399 interpolation. Note that calibration solutions which have been
400 determined for only one timestamp will default to 'nearest'. More
401 interpolation options (e.g., 'cubic') will be added in the future.
403 item[select] Used to specify general selection of a subset of
404 calibration measurements from the table to be applied to the
405 visibility data. Arbitrary cross-calibration is possible by combining
406 this function with the {stfaf setdata} function. The string
407 specified must be a valid htmladdnormallink{TaQL}{../../notes/199/199.html}
408 expression.
410 item[spwmap] This parameter is used to indicate how solutions
411 derived from different spectral windows should be applied to other
412 spectral windows. Nominally, data in each spectral window will be
413 corrected by solutions derived from the same spectral window. This is
414 the default behavior of {stfaf spwmap}, i.e., if {stfaf spwmap} is
415 not specified, calibrater will insist that data be corrected by
416 solutions from the same spw. Otherwise, {stfaf spwmap} takes a
417 vector of integers indicating which spectral window {em solutions} to
418 apply to which spectral window {em data}, such that {tt spwmap[j]=i}
419 causes solutions derived from the i-th spectral window to be used to
420 correct the j-th spectral window. For example, if (say) bandpass
421 solutions are available for spws 0 & 2, and it is desired that these
422 be applied to spws 1 & 3 (as well as 0 & 2), respectively, use
423 {stfaf spwmap=[0,0,2,2]}. Even if some spws do not require an
424 explicit {stfaf spwmap} setting, yet one or more does, it is safest
425 to specify it explicitly for all, e.g., {stfaf spwmap=[0,1,3,3]}
426 indicates that spw 2 will be corrected with solutions from spw 3, and
427 the others will behave nominally. Note that if no solutions exist
428 for any of the spws specified in {stfaf spwmap}, an error message
429 will result.
431 item[calwt] If set True, the data weights will be calibrated
432 along with the data. This is usually desirable.
434 item[opacity] For {stfaf type='TOPAC'}, an elevation-dependent
435 opacity correction will be applied according to the zenith opacity value
436 supplied in the {stfaf opacity} parameter. Currently, only one zenith
437 opacity value can be supplied, and it is used for all antennas.
439 end{description}
441 Use the {stfaf state} function to review the list of calibration
442 components that have been set for application.
444 Pending improvements:
446 begin{itemize}
447 item Enable variety of interpolation modes and timescales
448 item Allow for antenna- and time-dependent opacities
449 end{itemize}
451 Input Parameters:
452 type Component type
453 t Interpolation interval (seconds)
454 table Calibration table name
455 field Select on field
456 interp Interpolation type (in time)
457 select TAQL selection string. Default is no selection.
458 calwt Calibrate weights?
459 spwmap Spectral windows to apply
460 opacity Array-wide zenith opacity per antenna (for type='TOPAC')
462 Example:
464 cb.open('ngc5921.ms')
465 cb.selectvis(field='N5921*')
466 cb.setapply (type='G', table='gcal', field='1445*')
467 cb.setapply (type='P')
468 cb.correct();
469 cb.close();
472 In this example, we apply parallactic angle corrections and a gain
473 calibration derived from a field whose name matches '1445*' in a caltable
474 called 'gcal' to data for a field matching 'N5921*'
476 --------------------------------------------------------------------------------
478 """
479 return _calibrater.calibrater_setapply(self, *args, **kwargs)
482 def setcallib(self, *args, **kwargs):
483 """
484 setcallib(self, _callib) -> bool
488 Summary:
489 Arrange to apply calibration via a Cal Library
491 Description:
495 TBD
497 Input Parameters:
498 callib A calibration library record
500 Example:
502 TBD
504 --------------------------------------------------------------------------------
506 """
507 return _calibrater.calibrater_setcallib(self, *args, **kwargs)
510 def validatecallib(self, *args, **kwargs):
511 """
512 validatecallib(self, _callib) -> bool
516 Summary:
517 Validate a Cal Library record
519 Description:
523 TBD
525 Input Parameters:
526 callib A calibration library record
528 Example:
530 TBD
532 --------------------------------------------------------------------------------
534 """
535 return _calibrater.calibrater_validatecallib(self, *args, **kwargs)
538 def setsolve(self, *args, **kwargs):
539 """
540 setsolve(self, _type, _t, _table, _append, _preavg, _phaseonly, _apmode, _refant, _refantmode, _minblperant, _solnorm, _normtype, _minsnr, _combine, _fillgaps, _cfcache, _painc, _fitorder, _fraction, _numedge, _radius, _smooth, _zerorates, _globalsolve, _niter, _corrcomb, _delaywindow, _ratewindow, _paramactive, _concatspws, _solmode, _rmsthresh) -> bool
544 Summary:
545 Arrange to solve for calibration
547 Description:
550 This function specifies the calibration component that will be solved for
551 by the {stff solve} function. Currently, only one type can
552 be solved for at one time.
554 Each calibration component represents a separate calibration matrix
555 correction included in the measurement equation. The different types
556 correspond to different instrumental and atmospheric effects.
557 Currently, the solvable calibration components are types 'G','T','B', 'D'
558 and 'DF', which are antenna-based, and, 'M' and 'MF', which are
559 baseline-based. Arrange to pre-apply any existing calibration components (of
560 types other than the solved-for one) using the {stfaf setapply}
561 function.
563 The parameters are:
565 begin{description}
566 item[type] Specify the calibration type you want to solve for, from
567 'G','T','B','D','DF','M','MF'.
569 item[t] Specify the solution interval. This can be specified as an
570 integer (units of seconds assumed) or as a string containing a value
571 and units (e.g., '30s', '45min', '2h') or 'inf' (infinite) or 'int'
572 (per data integration). A solution interval of 0 (with or without
573 units) is the same as 'int' (per integration), and negative solution
574 intervals are treated as 'inf' (infinite).
576 item[table] Specify the output calibration table name in which to
577 store the calibration solve result. Existing tables will be
578 deleted and replaced.
580 item[append] Append the solutions to an existing table.
582 item[preavg] Specify the amount of pre-average (in time) within
583 the solution interval. By default, data are averaged up to
584 the solution interval (or up to 5 minutes for 'D' solving).
586 item[phaseonly] This parameter is deprecated, use apmode.
588 item[apmode] Control generation of amplitude-only ('a'),
589 phase-only ('p'), or amplitude-and-phase ('ap', the default) solutions.
591 item[refant] Specify an antenna (using data selection syntax)
592 for referencing the solutions.
594 item[solnorm] Normalize the solutions by their mean post-solve. For
595 'B', and 'MF', this is a complex normalization per solution spectrum.
596 For other types, this is a global (per-spw) normalization of the
597 amplitudes only.
599 item[minsnr] Specify the SNR below which solution are rejected.
601 item[combine] Specify which data axes (spw, field, scan, or some
602 combination) on which the data should be combined to generate
603 a single solution. E.g., combine='spw' will force combination
604 of many spws to form a single solution (per solution interval).
605 Similarly, combine='scan' with a long solution interval
606 will force the combination of scans to yield individual solutions
607 (per field and spw). Ordinarily, solutions are always broken
608 at scans boundaries. Separate multiple combine options with
609 commas.
611 item[fillgaps] For 'B' solutions, specify the largest solution
612 channel gap (which arise due to flagged data) that will be filled
613 post-solve via interpolation. Such solution gaps remain flagged
614 by default.
616 end{description}
618 Pending improvements:
620 begin{itemize}
621 item{Change t to solint?}
622 item{Permit flexible specification of preavg (as for t)}
623 end{itemize}
625 Input Parameters:
626 type Component type
627 t Solution interval (units optional)
628 table Output calibration table name
629 append Append to existing table?
630 preavg Pre-averaging interval (in sec)
631 phaseonly Solve only for phase?
632 apmode Solve for 'AP', 'A' (amp-only) or 'P' (phase-only)
633 refant Reference antenna. Default is none.
634 refantmode Reference antenna mode
635 minblperant Minimum number of baselines per ant for solving
636 solnorm Normalize solution after solve
637 normtype Solution normalization type
638 minsnr SNR threshold for accepting solutions
639 combine Data axes on which to combine solving (scan, spw, and/or field)
640 fillgaps
641 cfcache Name of the directory to be used for convolution function disk cache. This is used when type=EP.
642 painc Parallactic Angle increment used to trigger computation of a new convolution function. This is used when type=EP. Default value implies that only one convolution function will be computed for the entire range of observation.
643 fitorder Order of the polynomial fit, used when type='A'.
644 fraction [SINGLE-DISH SPECIFIC] Edge detection parameter for otfraster/otf calibration. This is a number of edge points as a fraction of total number of points.
645 numedge [SINGLE-DISH SPECIFIC] Edge detection parameter for otfraster calibration. This is a number of edge points. The value specified here comes before fraction. Note that edge points will be detected from both side of each raster row so that number of edge points is effectively twice of the specified value in each raster row. Default (-1) is to use fraction.
646 radius [SINGLE-DISH SPECIFIC] Specifies radius of the central region of double circle gain calibration for fast scanning data. The value must be either empty or quantum string (numeric value with unit). Default ('') is to use a radius of primary beam.
647 smooth [SINGLE-DISH SPECIFIC] Whether or not applying smoothing during double circle gain calibration for fast scanning data. Default is True.
648 zerorates [FRINGE-FIT SPECIFIC] Zero delay-rates in fringe fitting solution tables.
649 globalsolve [FRINGE-FIT SPECIFIC] Use global least-squares solver to improve fringe-fitting parameter estimates
650 niter [FRINGE-FIT SPECIFIC] Maximum number of iterations for global least-squares solver
651 corrcomb [FRINGE-FIT SPECIFIC] Combine correlations (currently supported values are 'none' and 'all')
652 delaywindow [FRINGE-FIT SPECIFIC] Constrain FFT delay search to a window; a two-element list, units of nanoseconds
653 ratewindow [FRINGE-FIT SPECIFIC] Constrain FFT rate search to a window; a two-element list, units of seconds per second
654 paramactive An array of three booleans to control whether to sove for delay, fringe-rate and dispersive delay
655 concatspws A flag to control multiband FFT behaviour in fringefit task.
656 solmode Solving mode: '', 'L1'; add 'R' for iterative outlier excision.
657 rmsthresh RMS threshold sequence.
659 Example:
661 cb.open('ngc5921.ms');
662 cb.setapply (type='P');
663 cb.setsolve (type='G',t='300s', refant=3, table='gcal');
664 cb.solve();
665 cb.close();
668 In this example, analytic (non-solvable) parallactic angle corrections
669 are pre-applied before G solutions are obtained on a timescale of 300
670 seconds. The resulting solutions are phase-referenced to antenna 3,
671 and stored in a calibration table called 'gcal'.
674 cb.reset();
675 cb.setapply (type='P',t=5.0);
676 cb.setapply (type='G',table='gcal');
677 cb.setsolve (type='D',t=86400.0, preavg=60.0, refant=3, table='dcal');
678 cb.solve();
679 cb.close();
682 In this example, the solve/apply state of the calibrater tool is reset
683 and then the P and G corrections (from above) are applied before
684 solving for D solutions on a diurnal timescale. Note that the data
685 will be averaged only to 60 seconds before the solution. The resulting
686 D solutions are stored in a table called 'dcal'.
688 --------------------------------------------------------------------------------
690 """
691 return _calibrater.calibrater_setsolve(self, *args, **kwargs)
694 def setsolvegainspline(self, *args, **kwargs):
695 """
696 setsolvegainspline(self, _table, _append, _mode, _splinetime, _preavg, _npointaver, _phasewrap, _refant) -> bool
700 Summary:
701 Specialization of setsolve for cubic spline G (time-dependent gain) solving
703 Description:
707 This function is a specialization of the {stfaf setsolve} method which
708 should be used when cubic spline G solutions are desired, e.g., when
709 SNR on calibrators is very low. Currently, this solving mode treats
710 dual polarization data on a per-polarization basis. The option to
711 obtain a joint solution (a la 'T') will be provided in the future.
713 The visibility data are averaged in frequency (for multi-channel data)
714 prior to the solution.
716 This method uses many of the basic parameters as the generic
717 {stfaf setsolve}. Parameters unique to the spline solver are:
719 begin{description}
721 item[mode] For phase solutions only, use {stfaf mode='PHAS'}. For
722 amplitude solutions only, use {stfaf mode='AMP'}. If both are
723 desired, use {stfaf mode='PHASAMP'}, and both will be solved for
724 using the same spline timescale (this mode also assumes that all
725 calibrators have the correct relative flux densities). If solving for
726 phase and amplitude separately (usually in this order), it is usually
727 desirable to apply the first one when solving for the second
728 one. Spline solution so obtained will be stored in separate
729 calibration tables. In the near future, the {stfaf mode} parameter
730 will be consolidated with the generic {stfaf apmode} parameter.
732 item[splinetime] The spline timescale (time between knots) is
733 specified here. The default is 10800 seconds (3 hours). In future
734 this parameter will be consolidated with the generic {stfaf t}
735 parameter. The {stfaf preavg} parameter should be set to a value at
736 least 4X shorter than the spline time (an error will occur if there is
737 insufficient sampling within the {stfaf splinetime} timescale), and
738 consistent with the expected coherence. Consistent with these constraints,
739 use the largest possible value for {stfaf preavg} to optimize the SNR of
740 the pre-solve phase-tracking algorithm.
742 item[npointaver and phasewrap] These parameters tune the
743 phase-unwrapping algorithm when {stfaf mode $=$ 'PHAS'}. Cycle slips
744 are detected (and removed before the spline solve) when the median
745 phase a sequence of length {stfaf npointaver} (in integrations)
746 differs by more than {stfaf phasewrap} degrees from the previous
747 sequence.
749 end{description}
751 Pending improvements:
753 begin{itemize}
754 item Consolidate more parameters with the generic {stfaf setsolve}
755 item Introduce the generic combine options
756 item Improve phase-tracking algorithm
757 end{itemize}
759 Input Parameters:
760 table Output calibration table name
761 append Append to existing table?
762 mode Phase or Amplitude mode?
763 splinetime Spline timescale (sec)
764 preavg Pre-averaging interval (in sec)
765 npointaver
766 phasewrap
767 refant Reference antenna. Default is none.
769 Example:
771 cb.open('ngc5921.ms')
772 cb.selectvis(field='1445*')
773 cb.setsolvegainspline (table='gcalph',mode='PHAS',splinetime=3600.0,preavg=60.0)cb.solve()
775 cb.setsolvegainspline (table='gcalamp',mode='AMP',splinetime=10800.0);
776 cb.solve();
777 cb.close();
780 In this example, a spline solution is first found for phase on a hourly timescale, then for amplitude on a three-hour timescale.
782 --------------------------------------------------------------------------------
784 """
785 return _calibrater.calibrater_setsolvegainspline(self, *args, **kwargs)
788 def setsolvebandpoly(self, *args, **kwargs):
789 """
790 setsolvebandpoly(self, _table, _append, _t, _combine, _degamp, _degphase, _visnorm, _solnorm, _maskcenter, _maskedge, _refant) -> bool
794 Summary:
795 Specialization of setsolve for polynomial B (bandpass) solving
797 Description:
801 This function is a specialization of the {stfaf setsolve} method
802 which should be used to arrange for bandpass solving when polynomial
803 solutions for B are desired, e.g., when per-channel SNR on calibrators
804 is too low to obtain a useful sampled bandpass.
806 Prior to the solution, the visibility data are averaged in time,
807 and the solution is performed for both phase and amplitude.
809 This method uses most of the same parameters as the generic
810 {stfaf setsolve}, with a few unique additions:
812 begin{description}
814 item[degamp and degphase] The parameters permit specification
815 of the polynomial order to use in amp and phase. Specifying
816 0 (zero) yields constant solutions.
818 item[visnorm] This parameter is used to normalize the assembled
819 spectral data, in a per baseline manner. If set True, this will have
820 the effect of removing any non-frequency-dependent closure errors
821 (e.g., as caused by source structure, or introduced by the instrument)
822 from the data, and should be used with caution. The resulting
823 solutions will be effectively normalized as well. When {stfaf
824 visnorm=F} is used, closure errors in the data (as supplied to the
825 solver) may be visible in the form of offsets between the data and
826 solutions. For bandpass calibration, this is usually ok, as the {em
827 shape} of the bandpass is the most important aspect of the solution.
828 In future this parameter will be generalized and made available
829 for other solve types. (NB: Use of {stfaf solnorm=True} still
830 provides for post-solve normalization of the solutions.)
832 item[maskcenter and maskedge] These parameters control how many
833 channels are ignored on-the-fly, at the center and edges of each input
834 spectral window, respectively. To avoid edge channels, it is almost
835 always better to flag these channels directly, or select against them
836 in {stfaf setdata}. Aggressive use of maskedge (large values), will
837 yield polynomial solutions which will tend to diverge at the edges
838 (especially when the polynomial degree is also high), because maskedge
839 does not change the frequency domain of the solutions. Such solutions
840 should be used with caution in subsequent operations. (It is best to
841 avoid use of maskedge.)
842 end{description}
844 The BPOLY solution is performed for both phase and amplitude, and the
845 result will be stored in the same table. The frequency domain of the
846 solutions is limited to only the range of frequencies selected in
847 {stfaf selectvis}. When correcting data with these solutions (for
848 other solves or with {stfaf correct}), only data within this domain
849 will be corrected. Data outside (e.g., edge channels avoided in
850 {stfaf setdata} for the solve), will not be corrected. Therefore,
851 the same (or narrower) channel selection is recommended for all
852 operations using solutions produced by this function and {stfaf
853 solve()}.
855 Note that the {stfaf combine} parmaeter can be used meaningfully with
856 the BPOLY solver. When combine='spw', the data from multiple spws
857 will be combined on a common frequency axis, and a single polynomial
858 will be determined spanning them all. This is different than for
859 ordinary sampled 'B' solutions, for which combine='spw' causes the
860 bandpass to be combined on a common channel axis, effectively yielding
861 a mean bandpass for the set of spws.
863 Input Parameters:
864 table Output calibration table name
865 append Append to existing table?
866 t Solution interval (units optional)
867 combine Data axes on which to combine solving (scan, spw, and/or field)
868 degamp Polynomial degree for amplitude solution
869 degphase Polynomial degree for phase solution
870 visnorm Normalize data prior to solution
871 solnorm Normalize result?
872 maskcenter Number of channels to avoid in center of each band
873 maskedge Fraction of channels to avoid at each band edge (in %)
874 refant Reference antenna
876 Example:
878 cb.open('ngc5921.ms');
879 cb.selectvis(field='1331*')
880 cb.setsolvebandpoly(table='bpoly',degamp=5,degphase=7);
881 cb.solve();
882 cb.close();
885 In this example, amplitude (degree 5) and phase (degree 7) Chebychev
886 polynomial bandpasses are determined using the default parameters.
888 --------------------------------------------------------------------------------
890 """
891 return _calibrater.calibrater_setsolvebandpoly(self, *args, **kwargs)
894 def returndict(self):
895 """
896 returndict(self) -> record *
900 Summary:
901 Return a dictionary describing the current calibrater state
903 Description:
907 Return a dictionary containing information about the current calibrater tool state.
908 This dictionary contains the following keys: 'antennas', 'apply tables', 'field', 'intents', 'observation', 'scan', 'solve table', 'spw'.
910 Each of these keys will show which values for each of these parameters are selected. By default all of the MS is selected when opened by the calibrater tool.
912 The values of each of these keys is an array of either strings or integers.
915 Example:
917 cb.open('gaincaltest2.ms')
918 cb.selectvis(field='1')
919 cb.returndict()
921 This would return a dictionary that looks like this:
923 {'antennas': array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]),
924 'apply tables': array([], dtype='U16'),
925 'field': array([1]),
926 'intents': array(['CALIBRATE_AMPLI#ON_SOURCE', 'CALIBRATE_DELAY#ON_SOURCE',
927 'CALIBRATE_PHASE#ON_SOURCE', 'CALIBRATE_WVR#ON_SOURCE'],
928 dtype='U26'),
929 'observation': array([0]),
930 'scan': array([ 3, 5, 8, 10, 12, 15, 17, 20, 22, 24]),
931 'solve table': array([], dtype='U16'),
932 'spw': array([0, 1, 2, 3])}
934 --------------------------------------------------------------------------------
936 """
937 return _calibrater.calibrater_returndict(self)
940 def state(self):
941 """
942 state(self) -> bool
946 Summary:
947 Request the apply/solve state of the calibrater tool
949 Description:
953 Request the apply/solve state of the calibrater tool. A listing of
954 all calibration components that have been set for application or
955 solving is written to the logger.
957 Example:
959 cb.open('ngc5921.ms');
960 cb.setapply ('P', 5.0);
961 cb.setsolve ('G', 300.0, F, 3, 'gcal_1', T);
962 cb.state();
964 --------------------------------------------------------------------------------
966 """
967 return _calibrater.calibrater_state(self)
970 def reset(self, *args, **kwargs):
971 """
972 reset(self, _apply, _solve) -> bool
976 Summary:
977 Reset the selected apply and/or solve components
979 Description:
983 Resets the apply and/or solve components previously set by setapply and
984 setsolve.
986 Input Parameters:
987 apply If true, unset all apply settings
988 solve If true, unset all solve settings
990 Example:
992 cb.open('ngc5921.ms')
993 cb.setapply ('P', 5.0)
994 cb.setsolve ('G', 300.0, F, 3, 'gcal_1', T)
995 cb.state()
996 cb.reset(apply=T,solve=F);
997 cb.state()
998 cb.reset()
1000 --------------------------------------------------------------------------------
1002 """
1003 return _calibrater.calibrater_reset(self, *args, **kwargs)
1006 def initcalset(self, *args, **kwargs):
1007 """
1008 initcalset(self, _calset) -> bool
1012 Summary:
1013 Re-initialize the calibration scratch columns.
1015 Description:
1019 This function re-initializes the calibration scratch columns:
1020 MODEL_DATA to unity (in total intensity, and unpolarized), and
1021 CORRECTED_DATA to (observed) DATA.
1022 Optionally if calset is set to 1 any model saved in the MS header to for calibration
1023 purposes is deleted
1025 Input Parameters:
1026 calset if it set to 1 the model saved in the header is removed
1028 Example:
1030 cb.open('ngc5921.ms');
1031 cb.initcalset();
1032 cb.solve();
1034 --------------------------------------------------------------------------------
1036 """
1037 return _calibrater.calibrater_initcalset(self, *args, **kwargs)
1040 def delmod(self, *args, **kwargs):
1041 """
1042 delmod(self, _otf, _field, _spw, _scr) -> bool
1046 Summary:
1047 Delete model data representations in the MS.
1049 Description:
1053 This method can be used to delete the model visibility
1054 data representations in the MS. The 'otf' representation is
1055 the new (as of v3.4) 'scratch-less' model data, stored as
1056 keywords in the MS header containing model data formation
1057 instructions. It is generated by the im tool (setjy, ft, and clean
1058 methods; usescratch=F in im.open), and if present, overrides the
1059 old-fashioned MODEL_DATA column (if present). If a user
1060 wishes to use the MODEL_DATA column _after_ having operated
1061 with the 'otf' representation, this method can be used
1062 to delete the 'otf' represenatation to make the MODEL_DATA
1063 column visible. (Create the MODEL_DATA column by using
1064 usescratch=T in the im tool, or by running the cb.open
1065 with addmodel=T.)
1067 If otf=T, the user may selectively remove only a selection of fields model from the MS by specifying the field parameter. Similarly if the field parameter is specified, selected spws model for those fields may be deleted by specifying the spw.
1070 For convenience, this method also provides a means for
1071 deleting the MODEL_DATA column by setting scr=T.
1073 Input Parameters:
1074 otf If T, delete the otf model data keywords
1075 field Select on field
1076 spw Select on spw only if field is defined
1077 scr If T, delete the MODEL_DATA column
1079 Example:
1081 cb.open('ngc5921.ms');
1082 cb.delmod(otf=T,scr=F); # delete only the otf model for all fields
1083 cb.solve();
1085 cb.open('n4826.ms')
1086 cb.delmod(otf=T, field='1')
1087 #delete otf model of field 1 only, all other fields model are untouched
1088 #if present
1089 cb.open('n4826.ms')
1090 cb.delmod(otf=T, field='1', spw='2')
1091 #delete otf model of field 1 and spectralwindow 2 only.
1093 ####NOTE doing:
1094 cb.delmod(otf=T, field='', spw='2')
1096 #will delete all otf models and spw will be ignored
1098 --------------------------------------------------------------------------------
1100 """
1101 return _calibrater.calibrater_delmod(self, *args, **kwargs)
1104 def solve(self):
1105 """
1106 solve(self) -> bool
1110 Summary:
1111 Solve for the selected calibration components
1113 Description:
1116 Execution of this function initiates a solve for the calibration component
1117 specified in a previous {stfaf setsolve} execution. Existing calibration
1118 components (as specified in one or more {stfaf setapply} executions) will
1119 be appropriately applied to the observed and model data according to their
1120 position in the Measurement Equation, and their commutation properties.
1122 Example:
1124 cb.open('ngc5921.ms');
1125 cb.setapply ('P', t=10)
1126 cb.setsolve ('G', 300.0, F, 3, 'gcal_1', T);
1127 cb.solve();
1128 cb.close();
1130 --------------------------------------------------------------------------------
1132 """
1133 return _calibrater.calibrater_solve(self)
1136 def correct(self, *args, **kwargs):
1137 """
1138 correct(self, _applymode) -> bool
1142 Summary:
1143 Apply calibration information
1145 Description:
1149 This function applies the calibration components specified via one or
1150 more invocations of the {stff setapply} function to the observed
1151 visibility data and writes the result to the CORRECTED_DATA column
1152 of the Measurement Set.
1154 Input Parameters:
1155 applymode Correction cal/flag mode: ''='calflag','cal','flag','trial'
1157 Example:
1159 cb.open('ngc5921.ms');
1160 cb.selectvis(field='1445*')
1161 cb.setapply ('G', 10.0, 'gcal_1')
1162 cb.correct();
1163 cb.close();
1165 --------------------------------------------------------------------------------
1167 """
1168 return _calibrater.calibrater_correct(self, *args, **kwargs)
1171 def corrupt(self):
1172 """
1173 corrupt(self) -> bool
1177 Summary:
1178 Corrupt model with calibration tables
1180 Description:
1184 This function applies the calibration components specified via one or
1185 more invocations of the {stff setapply} function to the model
1186 visibility data and (over-)writes the result to the MODEL_DATA column of the
1187 Measurement Set.
1189 Example:
1191 cb.open('ngc5921.ms')
1192 cb.selectvis(field='1445*')
1193 cb.setapply ('G', 10.0, 'gcal_1')
1194 cb.corrupt()
1195 cb.close()
1197 --------------------------------------------------------------------------------
1199 """
1200 return _calibrater.calibrater_corrupt(self)
1203 def initweights(self, *args, **kwargs):
1204 """
1205 initweights(self, _wtmode, _dowtsp, _tsystable, _gainfield, _interp, _spwmap) -> bool
1209 Summary:
1210 Initialize MS weight info in various ways.
1212 Description:
1216 This function initializes the MS weight info in various ways.
1218 If wtmode='ones', SIGMA and WEIGHT will be initialized with 1.0,
1219 globally.
1221 If wtmode='nyq' (the default), SIGMA and WEIGHT will be initialized
1222 according to bandwidth and integration time. This is the
1223 theoretically correct mode for raw normalized visibilities.
1225 If wtmode='sigma', WEIGHT will be initialized according to the
1226 existing SIGMA column.
1228 If mode='weight', WEIGHT_SPECTRUM will be initialized according to the
1229 existing WEIGHT column; dowtspec=T must be specified in this case.
1231 For the above wtmodes, if dowtspec=T (or if the WEIGHT_SPECTRUM column
1232 already exists), the WEIGHT_SPECTRUM column will be initialized
1233 (uniformly in channel), in a manner consistent with the WEIGHT column.
1234 If the WEIGHT_SPECTRUM column does not exist, dowtsp=T will force its
1235 creation.
1237 The follow modes should be used with extreme care: If
1238 wtmode='delwtsp', the WEIGHT_SPECTRUM column will be deleted (if it
1239 exists). If wtmode='delsigsp', the SIGMA_SPECTRUM column will be
1240 deleted (if it exists). Note that creation of SIGMA_SPECTRUM is not
1241 supported via this method.
1243 Note that this method does not support any prior selection.
1244 Intialization of the weight information must currently be done
1245 globally or not at all. This is to maintain consistency.
1247 Input Parameters:
1248 wtmode Initialization mode
1249 dowtsp Initialize WEIGHT_SPECTRUM column
1250 tsystable Tsys calibration table to apply on the fly
1251 gainfield Select a subset of calibrators from Tsys caltable
1252 interp Interp type in time[,freq]. default==linear,linear
1253 spwmap Spectral windows combinations to form for gaintables(s)
1255 Example:
1257 cb.open('ngc5921.ms')
1258 cb.initweights()
1259 cb.close()
1261 --------------------------------------------------------------------------------
1263 """
1264 return _calibrater.calibrater_initweights(self, *args, **kwargs)
1267 def fluxscale(self, *args, **kwargs):
1268 """
1269 fluxscale(self, _tablein, _reference, _tableout, _transfer, _listfile, _append, _refspwmap, _gainthreshold, _antenna, _timerange, _scan, _incremental, _fitorder, _display) -> record *
1273 Summary:
1274 Bootstrap the flux density scale from standard calibrators
1276 Description:
1280 This function is used to bootstrap the amplitude scale the
1281 calibration solutions according to specified reference calibrator(s)
1282 of known flux density. This is necessary when the flux densities
1283 of some of your calibrators were unknown (and thus were assumed
1284 to be 1 Jy) during G solving.
1286 The bootstrapping is achieved by comparing the median gain norm of the
1287 calibration solutions derived for the calibrators specified in {stfaf
1288 reference} (one or more sources with known flux densities at the time
1289 of G solving) with that of the calibrators specified in {stfaf
1290 transfer}, and enforcing the assumption that the antenna gains are
1291 constant, on average. The gain solutions for the transfer sources are
1292 then re-scaled accordingly. The {stfaf reference} and {stfaf transfer}
1293 parameters may be specified using the general field selection syntax
1294 (as in {stfaf field} in {stfaf selectvis}).
1296 If no {tt transfer} fields are specified, then the solutions for
1297 all non-reference fields in {tt tablein} will be re-scaled.
1299 If no {tt tableout} is specified the input table will be overwritten
1300 with the scaled solutions. Note that the resulting table will only
1301 contain solutions for those fields implicit in the {tt reference} and
1302 {tt transfer} specifications. Use {tt append=T} to append the scaled
1303 solutions to an existing table.
1305 Use the {stfaf refspwmap} parameter to indicate how data for
1306 different spectral windows should be matched in calculating the flux
1307 density scale factor for {stfaf transfer} fields. The default
1308 behavior for {tt refspwmap} is to insist on precisely matching
1309 spectral windows for {tt reference} and {tt transfer} fields. When
1310 specified, the {stfaf refspwmap} parameter takes a vector of integers
1311 indicating which spectral window solutions to use as the reference for
1312 others, such that {tt refspwmap[j]=i} causes solutions (from reference
1313 fields) observed in the i-th spectral window to be used to reference
1314 solutions (from transfer fields) observed in the j-th spectral window.
1315 For example, for the case of a total of 4 spectral windows: if the
1316 {tt reference} fields were observed only in spw=2 & 4, and the {tt
1317 transfer} fields were observed variously in all 4 spws, specify {tt
1318 refspwmap=[2,2,4,4]}. This will ensure that {tt transfer} fields
1319 observed in spws 1,2,3,4 will be referenced to {tt reference} field
1320 data from spws 2,2,4,4, respectively. Note that if the {tt transfer}
1321 fields were observed only in spws 1 & 3, the same specification would
1322 work, but {tt refspwmap=[2,2,4]} would suffice. In this case,
1323 nothing need be specified for the 4th spw (there are no transfer
1324 fields there), and specifying 2 for the 2nd spw is actually
1325 inconsequential (though required so that the specification of 4 for spw 3
1326 is properly interpretted).
1328 The gain values used in the flux scaling determination skewed by
1329 outliers. The parameters, {tt gainthreshold} and {tt antenna} can be used
1330 to limit the input gain solutions to be included in the flux scale determination.
1331 Use the {tt gainthreshold} is a threshold in % from the median values of the
1332 gain solutions to be used. Use the {tt antenna} to select or de-selesect (using the
1333 MSSelection syntax) antenna(s). Futher refinements on the selection based on
1334 timerange and scan are possible.
1336 The derived flux densities for the transfer fields will be reported in
1337 the logger, and returned to the Python dictionary specified in {tt
1338 fluxd}. This will be an 2D array of shape [number-of-spectral-windows
1339 X number-of-fields]. When mulitple spectral windows are involved the spectral
1340 index will also be reported by fitting the determined flux densities across
1341 the freuquencies. The order of a polynomcial to be fitted can be specified with
1342 {tt fitorder}.
1344 Note that elevation-dependent gain effects may render the basic
1345 assumption used here invalid, and so should be corrected for prior to
1346 solving for G, using types 'TOPAC' or 'GAINCURVE' in {tt setapply}.
1348 Note that the visibility data itself is not used directly by this
1349 function.
1351 Pending improvements:
1353 begin{itemize}
1354 item Allow antenna and uv-distance selection to improve results for
1355 resolved calibrators
1356 item Set the visibility model according to the flux density results
1357 item An option to use the data to derive the relative flux densities
1358 end{itemize}
1360 Input Parameters:
1361 tablein Input calibration table name
1362 reference Reference calibrator field names (comma-separated)
1363 tableout Output calibration table name. Default is input calibration table name.
1364 transfer Transfer source field names (comma-separated). Default is all other fields.
1365 listfile Name of listfile that contains the fit information. Default is '' (no file).
1366 append Append to existing table?
1367 refspwmap List of alternate spw for referencing
1368 gainthreshold Threshold of gain amplitudes with respect to the median value to be used in flux scale calculation. Default: -1.0 (no threshold)
1369 antenna antenna selection/de-selection in flux scale calculation. Default: ''(include all antennas)
1370 timerange timerage sub-selection with antenna selection in flux scale calculation. Default: ''(include all)
1371 scan scan sub-selection with antenna selection in flux scale calculation. Default: ''(include all)
1372 incremental create a incremental caltable
1373 fitorder order for spectral fitting for multiple spws
1374 display display statistics of the flux ratios
1376 Example:
1378 cb.open('ngc5921.ms')
1379 cb.selectvis(field='1331*,1445*')
1380 cb.setsolve(type='G',table='gcal',t='inf')
1381 cb.solve()
1382 cb.fluxscale (tablein='gcal', tableout='flxcal',
1383 reference='1331*', transfer='1445*');
1384 cb.close();
1387 This example generates a calibration table containing {tt G}
1388 solutuions ('gcal') and then writes a re-scaled version, using
1389 1335+305 as the reference calibrator, to derive properly scaled
1390 amplitude calibration for the transfer source, 1445+099. We have
1391 assumed that 1331+305 has already had its MODEL_DATA set to
1392 the correct flux density.
1394 --------------------------------------------------------------------------------
1396 """
1397 return _calibrater.calibrater_fluxscale(self, *args, **kwargs)
1400 def accumulate(self, *args, **kwargs):
1401 """
1402 accumulate(self, _tablein, _incrtable, _tableout, _field, _calfield, _interp, _t, _spwmap) -> bool
1406 Summary:
1407 Accumulate incremental calibration solutions into a cumulative calibration table
1409 Description:
1413 This function enables cumulative calibration using {tt calibrater}.
1414 It is the analog of the task ``CLCAL'' in classic AIPS.
1416 The {tt accumulate} function is useful when:
1418 begin{itemize}
1419 item a calibration solution of a particular type already exists,
1420 item an incremental calibration solution {em of the same type} is desired
1421 (an incremental solution in this context means derived independently
1422 from, or determined with respect to, the first)
1423 item the first calibration cannot be implicitly recovered in the course
1424 of obtaining the incremental solution
1425 end{itemize}
1427 For example, a phase-only ``G'' self-calibration on a target source
1428 may be desired to tweak the full amplitude and phase ``G'' calibration
1429 already obtained from a calibrator. The initial calibration (from the
1430 calibrator) contains amplitude information, and so must be carried
1431 forward, yet the phase-only solution itself cannot (by definition)
1432 recover this information, as a full amplitude and phase
1433 self-calibration would. In this case, the initial solution must be
1434 applied while solving for the phase-only solution, then the two
1435 solutions combined to form a {em cumulative} calibration embodying
1436 the net effect of both. In terms of the Measaurement Equation, the net
1437 calibration is the {em product} of the initial and incremental
1438 solutions.
1440 The analog of {tt accumulate} in classic AIPS is the use of CLCAL to
1441 combine a series of (incremental) SN calibration tables to form
1442 successive (cumulative) CL calibration tables.
1444 Cumulative calibration tables also provide a means of generating
1445 carefully interpolated calibration, on variable user-defined
1446 timescales, that can be examined prior to application to the data with
1447 {tt setapply} and {tt correct}. The solutions for different fields
1448 and/or spectral windows can be interpolated in different ways, with
1449 all solutions stored in the same table.
1451 The only difference between incremental and cumulative calibration
1452 tables is that incremental tables are generated directly from the data
1453 via {tt solve} or (in the near future) from other ancilliary data
1454 (e.g. weather information), and cumulative tables are generated from
1455 other cumulative and incremental tables via {tt accumulate}. In all
1456 other respects (internal format, application to data via {tt
1457 setapply} and {tt correct}, plotting with {tt plotcal}, etc.), they
1458 are the same, and therefore interchangable. Thus, {tt accumulate} and
1459 cumulative calibration tables need only be used when circumstances
1460 require it.
1462 The {tt accumulate} function represents a generalization on the
1463 classic AIPS CLCAL model of cumulative calibration in that its
1464 application is not limited to accumulation of ``G'' solutions (SN/CL
1465 tables classic AIPS are the analog of ``G'' (and, implicitly, ``T'')
1466 in {tt aips++}). In principle, any basic calibration type can be
1467 accumulated (onto itself), as long as the result of the accumulation
1468 (matrix product) is of the same type. This is true of all the basic
1469 types, except ``D''. Accumulation is currently supported for ``B'',
1470 ``G'', and ``T'', and, in future, ``F'' (ionospheric Faraday
1471 rotation), ``J'' (generic full-polarization calibration),
1472 fringe-fitting, and perhaps others. Accumulation of certain
1473 specialized types (e.g., ``GSPLINE'', ``TOPAC'', etc.) onto the basic
1474 types will be supported in the near future. The treatment of various
1475 calibration from ancilliary data (e.g., system temperatures, weather
1476 data, WVR, etc.), as they become available, will also make use of {tt
1477 accumulate} to achieve the net calibration.
1479 Note that accumulation only makes sense if treatment of a uniquely
1480 incremental solution is required (as described above), or if a careful
1481 interpolation or sampling of a solution is desired. In all other
1482 cases, re-solving for the type in question will suffice to form
1483 the net calibration of that type. For example, the product of
1484 an existing ``G'' solution and an amplitude and phase ``G'' self-cal
1485 (solved with the existing solution applied), is equivalent to full
1486 amplitude and phase ``G'' selfcal (with no prior solution applied),
1487 as long as the timescale of this solution is at least as short as
1488 that of the existing solution.
1490 Use of {tt accumulate} is straightforward:
1492 The {tt tablein} parameter is used to specify the existing cumulative
1493 calibration table to which an incremental table is to be applied.
1494 Initially, no such table exists, and {tt accumulate} will generate
1495 one from scratch (on-the-fly), using the timescale (in seconds)
1496 specified by the parameter {tt t}. These nominal solutions will
1497 be unit-amplitude, zero-phase (i.e., unit matrix) calibration,
1498 ready to be adjusted by accumulation. When {tt t} is negative (the
1499 default), the table name specified in {tt tablein} must exist and
1500 will be used.
1502 The {tt incrtable} parameter is used to specify the incremental table
1503 that should be applied to {tt tablein}. The calibration type of
1504 {tt incrtable} sets the type assumed in the operation, so {tt
1505 tablein} must be of the same type. If it is not, {tt accumulate}
1506 will exit with an error message. (Certain combinations of types
1507 and subtypes will be supported by accumulate in the future.)
1509 The {tt tableout} parameter is used to specify the name of the output
1510 table to write. If un-specified (or ``''), then {tt tablein} will be
1511 overwritten. Use this feature with care, since an error here will
1512 require building up the cumulative table from the most recent distinct
1513 version (if any).
1515 The {tt field} parameter specifies those field names (standard
1516 selection syntax) in {tt tablein} to which the incremental solution
1517 should be applied. The solutions for other fields will be passed to
1518 {tt tableout} unaltered. If the cumulative table was created from
1519 scratch in this run of {tt accumulate}, then these solutions will be
1520 unit-amplitude, zero-phase, as described above.
1522 The {tt calfield} parameter is used to specify the fields (standard
1523 selection syntax) to select from {tt incrtable} to use when applying
1524 to {tt tablein}. Together, use of {tt field} and {tt calfield}
1525 permit completely flexible combinations of calibration accumulation
1526 with respect to fields. Multiple runs of {tt accumulate} can be used
1527 to generate a single table with many combinations. In future, a
1528 ``self'' mode will be enabled that will simplify the accumulation of
1529 field-specific solutions.
1531 The {tt interp} parameter is used to specify the interpolation type
1532 to use on the incremental solutions, as in {tt setapply}. The
1533 currently available interpolation types are ``nearest'', ``linear'',
1534 and ``aipslin''. See the {tt setapply} URM documentation for more
1535 details.
1537 The {tt spwmap} parameter enables accumulating solutions from
1538 differing spectral windows. See {tt setapply} for details
1539 on how spwmap works.
1541 Pending improvements:
1543 begin{itemize}
1544 item Implement a ``self'' mode (independent of interpolation type),
1545 to simplify or eliminate use of the {tt field} and {tt calfield}
1546 parameters in some contexts (e.g., self-cal)
1547 item More interpolation modes, e.g., ``cubic'', and interpolation
1548 timescale (timerange to permit interpolation)
1549 item Handle propogation (or not) of bad/flagged solutions
1550 item Support of specialized types (e.g., TOPAC) onto the basic
1551 types
1552 item Smoothing (probably a separate function)
1553 end{itemize}
1555 Input Parameters:
1556 tablein Input cumulative calibration table name
1557 incrtable Input incremental calibration table name
1558 tableout Output cumulative calibration table name. Default is input table name.
1559 field List of fields (names) to update in input cumulative table. Default is all.
1560 calfield List of fields (names) in incremental table to use. Default is use all.
1561 interp Interpolation mode to use on incremental solutions
1562 t Cumulative table timescale when creating from scratch
1563 spwmap Spectral windows to apply
1565 Example:
1567 cb.open('ap366.sim');
1569 # obtain G solutions from calibrator
1570 cb.selectvis(msselect='FIELD_ID IN [9,11]');
1571 cb.setsolve(type='G',table='cal.G0',t=300);
1572 cb.solve()
1574 # obtain proper flux density scale
1575 cb.fluxscale (tablein='cal.G0', tableout='cal.G1',
1576 reference='1328+307', transfer='0917+624');
1578 # generate cumulative table for target source on 20s timescale
1579 cb.accumulate(tablein='',incrtable='cal.G1',tableout='cal.cG0',
1580 field='0957+561',calfield='0917+624',
1581 interp='linear',t=20);
1583 # apply this calibration to target
1584 cb.selectvis(msselect='FIELD_ID==10');
1585 cb.setapply(type='G',table='cal.cG0',interp='linear')
1586 cb.correct();
1588 # (image target with imager tool)
1590 # phase-selfcal target on 60s timescale
1591 cb.selectvis(msselect='FIELD_ID==10');
1592 cb.setapply(type='G',table='cal.cG0',interp='linear')
1593 cb.setsolve(type='G',table='cal.G2',t=60,phaseonly=T);
1594 cb.solve();
1596 # accumulate new solution onto existing one
1597 cb.accumulate(tablein='cal.cG0',incrtable='cal.G2',tableout='cal.cG1',
1598 field='0957+561',calfield='0957+561',
1599 interp='linear');
1601 # apply new cumulative solution to data
1602 cb.setapply(type='G',table='cal.cG1',interp='linear')
1603 cb.correct();
1605 # (another round of imaging, etc.)
1607 cb.close();
1609 --------------------------------------------------------------------------------
1611 """
1612 return _calibrater.calibrater_accumulate(self, *args, **kwargs)
1615 def activityrec(self):
1616 """
1617 activityrec(self) -> record *
1621 Summary:
1622 Returns a record containing properties of recent activity
1624 Description:
1628 This funtion enables returning generic information about recent activity.
1631 Pending improvements:
1633 begin{itemize}
1634 item ??
1635 end{itemize}
1637 Example:
1639 TBD
1641 --------------------------------------------------------------------------------
1643 """
1644 return _calibrater.calibrater_activityrec(self)
1647 def specifycal(self, *args, **kwargs):
1648 """
1649 specifycal(self, _caltable, _time, _spw, _antenna, _pol, _caltype, _parameter, _infile, _uniform) -> bool
1653 Summary:
1654 Externally specify calibration of various types
1656 Description:
1660 This function enables specifying calibration parameters externally.
1662 Input Parameters:
1663 caltable The calibration table name
1664 time Calibration timestamp
1665 spw Calibration spw(s)
1666 antenna Calibration antenna(s)
1667 pol Calibration polarization
1668 caltype Calibration timestamp
1669 parameter Calibration parameters
1670 infile Ancillary input file
1671 uniform Assume uniform calibration values across the array
1673 Example:
1675 cb.open('ap366.sim');
1677 (TBD)
1679 cb.close();
1681 --------------------------------------------------------------------------------
1683 """
1684 return _calibrater.calibrater_specifycal(self, *args, **kwargs)
1687 def smooth(self, *args, **kwargs):
1688 """
1689 smooth(self, _tablein, _tableout, _field, _smoothtype, _smoothtime) -> bool
1693 Summary:
1694 Produce a smoothed calibration table
1696 Description:
1700 This function provides for time-dependent smoothing of sampled
1701 calibration solutions. Currently supported types are 'G', 'B', and 'T'.
1702 (Smoothing on the frequency axis for 'B' will be supported in the near
1703 future.)
1705 Two (sliding) smoothing types are currenlty supported: 'median' or
1706 'mean', one of these options should be specified in {stfaf
1707 smoothtype}. The full width (in seconds) of the smoothing filter
1708 should be specified in {stfaf smoothtime}. Amplitude and
1709 (ambiguity-corrected) phase are smoothed separately.
1711 Use {stfaf field} to limit the smoothing operation to a subset of the
1712 fields (standard selection syntax) found in the calibration table
1713 (other fields will pass to the output table unsmoothed). If {stfaf
1714 field} is left blank, all fields in the table will be smoothed.
1716 The smoothing is always done independently for each field, but
1717 scan boundaries are not observed. Thus, if the {stfaf smoothtime}
1718 is large enough, smoothing may occur over many boundaries.
1720 Flagged solutions in the input table will not participate in the
1721 smoothing calculation, but will be replaced with smoothed values
1722 if the smoothing window covers one or more unflagged solutions when
1723 centered on the flagged point.
1725 Pending improvements:
1727 begin{itemize}
1728 item Add other smoothtypes?
1729 item Add spw and other selection on input table
1730 item Add A/P toggle
1731 end{itemize}
1733 Input Parameters:
1734 tablein Input calibration table
1735 tableout Output calibration table
1736 field Limit smoothing to these fields (default is all fields)
1737 smoothtype The smoothing type: 'mean' or 'median'
1738 smoothtime Smoothing filter time constant (sec)
1740 Example:
1742 cb.open('ngc5921.ms');
1743 cb.smooth(tablein='in.gcal',tableout='out.gcal',
1744 smoothtype='median',smoothtime=60);
1745 cb.close();
1748 In this example, 'G' solutions for all fields in the table 'in.gcal' are
1749 smoothed using a median filter with a full-width of 60 seconds,
1750 and the result written to 'out.gcal'.
1752 --------------------------------------------------------------------------------
1754 """
1755 return _calibrater.calibrater_smooth(self, *args, **kwargs)
1758 def rerefant(self, *args, **kwargs):
1759 """
1760 rerefant(self, _tablein, _tableout, _refantmode, _refant) -> bool
1764 Summary:
1765 Apply a new reference antenna
1767 Description:
1771 TBD
1773 Pending improvements:
1775 begin{itemize}
1776 item TBD
1777 end{itemize}
1779 Input Parameters:
1780 tablein Input calibration table
1781 tableout Output calibration table
1782 refantmode The refant application mode
1783 refant Reference antenna. Default is none.
1785 Example:
1787 cb.open('ngc5921.ms');
1788 cb.rerefant(tablein='in.gcal',tableout='out.gcal',
1789 refantmode='median',refant='4')
1790 cb.close();
1792 --------------------------------------------------------------------------------
1794 """
1795 return _calibrater.calibrater_rerefant(self, *args, **kwargs)
1798 def listcal(self, *args, **kwargs):
1799 """
1800 listcal(self, _caltable, _field, _antenna, _spw, _listfile, _pagerows) -> bool
1804 Summary:
1805 List the contents of a calibration table
1807 Description:
1811 calibrater.listcal() lists antenna gain solutions in tabular
1812 form. The table is organized as follows. Solutions are output by
1813 begin{enumerate}
1814 item Spectral window,
1815 item Antenna,
1816 item Time,
1817 item Channel,
1818 item and Polarization.
1819 end{enumerate}
1820 The inner-most loop is over polarization.
1821 A ``Spw Header'' row is printed each time the spectral window changes.
1822 In addition to listing the spectral window ID (SpwID), the Spw Header
1823 also lists the date of observation (Date), the calibration table name (CalTable), and the measurement
1824 set name (MS name). A lower-level ``antenna header'' is printed each time the antenna
1825 names change or every `pagerows' of output, whichever comes first.
1826 The antenna header column are described here:
1828 begin{tabular}{ll}
1829 hline hline
1830 Column Name & Description
1831 hline
1832 Ant & Antenna name
1833 Time & Visibility timestamp corresponding to gain solution
1834 Field & Field name
1835 Chn & Channel number
1836 Amp & Complex solution amplitude
1837 Phs & Complex solution phase
1838 F & Flag
1839 hline hline
1840 end{tabular}
1842 Elements of the ``F'' column contain an `F' when the datum is flagged,
1843 and ` ' (whitespace) when the datum is not flagged.
1845 Presently, the polarization mode names (for example: R, L)
1846 are not given, but the ordering of the polrization modes (left-to-right) is
1847 equivalent to the order output by task listobs (see ``Feeds'' in listobs output).
1849 Input Parameters:
1850 caltable Calibration table to list
1851 field Field names or indices to list: ''==>all
1852 antenna Antenna/Baseline to list: ''==>all
1853 spw Spectral windows and channels: ''==>all, spw='10:8~20'
1854 listfile Send output to file: ''==>send to terminal)
1855 pagerows Rows per page
1857 Example:
1859 Input:
1861 The following example imports a UVFITS file, performs a bandpass calibration,
1862 and displays a subset of the resulting calibration table.
1864 pathname=os.environ.get('CASAPATH').split()[0] # Get path to CASA home dir
1865 fitsdata=pathname+'/data/demo/NGC5921.fits' # Select uv-data (FITS) file
1866 msdata='NGC5921.ms' # MS name; write to current directory
1867 importuvfits(fitsfile=fitsdata, vis=msdata) # import FITS data to MS
1868 setjy(vis=msdata) # Create model data for flux calibrator
1869 caldata=msdata+'.bcal' # Calibration table name
1870 bandpass(vis=msdata, caltable=caldata) # Bandpass calibration
1871 cb.open(msdata) # Open MS in cb
1872 cb.listcal(caltable=caldata, field='N5921_2, 0, 1', antenna='1~5;10~13;20~22', spw='0:4~6', pagerows=0) # List a subset of calibration factors
1874 Output:
1876 SpwID = 0, Date = 1995/04/13, CalTable = NGC5921.ms.bcal (B Jones), MS name = /users/jcrossle/NRAO/casa/NGC5921.ms
1877 -------------------------------------------------------------------------------------------------------------------------------------------------------
1878 | Ant = 1 | Ant = 2 | Ant = 3 | Ant = 4 |
1879 Time Field Chn| Amp Phs F Amp Phs F| Amp Phs F Amp Phs F| Amp Phs F Amp Phs F| Amp Phs F Amp Phs F|
1880 ----------|---------------|---|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|
1881 09:21:46.0 1331+30500002_0 4|0.294 5.3 0.264 3.5 0.296 105.9 0.287 -111.9 0.276 -66.0 0.264 -24.5 0.269 165.8 0.281 -108.6
1882 09:21:46.0 1331+30500002_0 5|0.303 5.3 0.279 0.6 0.305 107.0 0.298 -111.6 0.283 -64.2 0.274 -23.3 0.280 166.8 0.291 -108.9
1883 09:21:46.0 1331+30500002_0 6|0.307 5.6 0.287 -1.6 0.309 107.5 0.303 -111.5 0.287 -63.2 0.280 -22.6 0.284 167.8 0.296 -108.8
1884 10:05:27.9 1445+09900002_0 4|0.467 7.6 0.419 2.7 0.473 107.7 0.455 -112.3 0.437 -63.5 0.413 -24.8 0.427 168.2 0.446 -108.8
1885 10:05:27.9 1445+09900002_0 5|0.472 7.3 0.440 0.0 0.486 109.1 0.471 -111.8 0.451 -62.6 0.436 -23.1 0.435 169.4 0.453 -108.5
1886 10:05:27.9 1445+09900002_0 6|0.486 8.4 0.453 -2.4 0.482 110.0 0.478 -111.4 0.452 -60.7 0.443 -23.1 0.446 169.6 0.468 -108.6
1887 10:09:05.3 N5921_2 4|0.082 50.0 0.074 34.7 0.097 -74.5 0.083 54.4 0.070 131.3 0.080 150.7 0.085 81.0 0.095 150.6
1888 10:09:05.3 N5921_2 5|0.074 62.7 0.084 24.3 0.114 -73.1 0.093 47.3 0.066 119.9 0.069 154.9 0.099 81.2 0.085 147.4
1889 10:09:05.3 N5921_2 6|0.079 44.4 0.081 21.7 0.092 -66.3 0.101 48.0 0.089 125.6 0.060 154.0 0.099 83.1 0.097 152.7
1890 | Ant = 5 | Ant = 10 | Ant = 11 | Ant = 12 |
1891 Time Field Chn| Amp Phs F Amp Phs F| Amp Phs F Amp Phs F| Amp Phs F Amp Phs F| Amp Phs F Amp Phs F|
1892 ----------|---------------|---|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|
1893 09:21:46.0 1331+30500002_0 4|0.261 -26.0 0.285 -107.1 0.279 -149.5 0.263 2.9 0.274 -102.5 0.257 -7.0 0.289 174.3 0.309 -139.2
1894 09:21:46.0 1331+30500002_0 5|0.269 -26.1 0.295 -107.2 0.288 -148.8 0.274 2.3 0.283 -100.9 0.271 -6.8 0.307 173.1 0.319 -138.2
1895 09:21:46.0 1331+30500002_0 6|0.272 -26.1 0.300 -107.0 0.293 -148.7 0.281 2.0 0.287 -99.7 0.280 -6.7 0.312 171.2 0.326 -137.2
1896 10:05:27.9 1445+09900002_0 4|0.416 -24.0 0.450 -106.4 0.437 -147.3 0.414 3.2 0.433 -99.6 0.412 -6.8 0.456 175.9 0.477 -140.0
1897 10:05:27.9 1445+09900002_0 5|0.421 -22.6 0.478 -106.1 0.453 -147.4 0.433 2.0 0.453 -98.1 0.433 -6.7 0.481 174.4 0.491 -138.9
1898 10:05:27.9 1445+09900002_0 6|0.436 -22.7 0.478 -106.7 0.459 -146.6 0.443 2.4 0.457 -97.1 0.450 -7.0 0.486 173.5 0.510 -137.7
1899 10:09:05.3 N5921_2 4|0.074 95.0 0.085 -4.2 0.083 109.6 0.084 -116.6 0.081 63.2 0.071 131.2 0.050 -55.4 0.083 -27.4
1900 10:09:05.3 N5921_2 5|0.071 96.8 0.084 -13.7 0.086 104.3 0.100 -116.4 0.099 61.7 0.084 145.1 0.091 -76.1 0.087 -33.6
1901 10:09:05.3 N5921_2 6|0.082 84.9 0.078 -5.3 0.101 109.1 0.102 -109.9 0.087 60.1 0.107 130.4 0.085 -75.5 0.080 -31.2
1902 | Ant = 13 | Ant = 20 | Ant = 21 | Ant = 22 |
1903 Time Field Chn| Amp Phs F Amp Phs F| Amp Phs F Amp Phs F| Amp Phs F Amp Phs F| Amp Phs F Amp Phs F|
1904 ----------|---------------|---|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|
1905 09:21:46.0 1331+30500002_0 4|0.285 -169.5 0.277 -90.4 0.254 -36.0 0.290 70.9 0.286 -97.8 0.305 108.8 0.273 -84.6 0.224 -124.2
1906 09:21:46.0 1331+30500002_0 5|0.296 -168.9 0.287 -90.5 0.269 -38.6 0.300 71.0 0.296 -97.8 0.317 108.2 0.284 -85.8 0.243 -127.6
1907 09:21:46.0 1331+30500002_0 6|0.301 -168.7 0.291 -90.3 0.278 -39.9 0.306 70.9 0.302 -97.8 0.326 107.2 0.289 -86.6 0.255 -129.7
1908 10:05:27.9 1445+09900002_0 4|0.448 -167.2 0.434 -90.7 0.401 -34.4 0.456 70.8 0.457 -95.5 0.485 108.9 0.431 -82.1 0.361 -123.9
1909 10:05:27.9 1445+09900002_0 5|0.466 -166.5 0.457 -91.1 0.423 -36.6 0.470 70.8 0.471 -96.6 0.506 108.1 0.448 -83.2 0.393 -126.7
1910 10:05:27.9 1445+09900002_0 6|0.473 -166.9 0.464 -91.1 0.436 -37.8 0.485 70.2 0.476 -96.6 0.521 108.0 0.447 -83.2 0.410 -130.0
1911 10:09:05.3 N5921_2 4|0.097 83.0 0.087 143.5 0.080 43.1 0.094 144.2 0.087 168.7 0.092 1.4 0.111 76.1 0.079 18.9
1912 10:09:05.3 N5921_2 5|0.100 87.4 0.094 137.0 0.061 54.7 0.098 153.3 0.094 178.6 0.096 -3.7 0.101 64.6 0.091 9.5
1913 10:09:05.3 N5921_2 6|0.099 93.3 0.122 140.5 0.077 51.3 0.090 151.7 0.083 -179.6 0.100 2.2 0.095 61.3 0.108 0.4
1915 Listed 108 antenna solutions.
1917 --------------------------------------------------------------------------------
1919 """
1920 return _calibrater.calibrater_listcal(self, *args, **kwargs)
1923 def posangcal(self, *args, **kwargs):
1924 """
1925 posangcal(self, _posangcor, _tablein, _tableout) -> bool
1929 Summary:
1930 Apply position angle calibration to an existing cal table
1932 Description:
1936 This function is used to apply position angle calibration for
1937 observations made using circularly polarized feeds. According to the
1938 Measurement Equation formalism, this correction should be applied to a
1939 {tt D} (instrumental polarization) calibration table.
1941 If no {tt D} calibration is performed (and thus no such table is
1942 available), the correction can be applied to a {tt G} table, but it
1943 should NEVER be applied to both, and always applied to a {tt D} table
1944 if one is available. An input table must be specified. If no output
1945 table is specified, then the input table will be modified in place.
1947 Specify, as a vector of values, a position angle adjustment (in degrees)
1948 for each spectral window. If only one value is specified, it will be
1949 duplicated to all spectral windows; otherwise, the number of values
1950 specified must match the number of spectral windows. The sign
1951 convention for the position angle adjustment is such that the specified
1952 value is the that which, when added to the position angle implied by the
1953 data, will yield the correct position angle. For example, if {tt G-},
1954 {tt D-}, and {tt P-}calibrated data for 3c286 suggests a position
1955 angle of 45 degrees, the posangcor value should be -12 degrees as this
1956 will yield the correct position angle of 33 degrees when added. In
1957 general, posangcor equals correct position angle minus observed position
1958 angle.
1960 A future version of this function will have an option to recognize
1961 standard position angle calibrators and determine the correction
1962 automatically.
1964 (NB: It may be desirable to use solutions for 'X' to handle
1965 position angle calibration, rather than this method.)
1967 Input Parameters:
1968 posangcor Position angle corrections (degrees)
1969 tablein Input calibration table name
1970 tableout Output calibration table name. Default is input table name.
1972 Example:
1974 cb.open('polcal.ms');
1975 cb.posangcal(tablein='3C286.dcal', tableout='3C286.dpacal',
1976 posangcor=[-12.0, 54.0]);
1977 cb.close();
1980 This example takes an existing calibration table containing {tt D}
1981 Jones matrices, and applies a position angle calibration of 45 and 54
1982 degrees to spectral windows 1 & 2, respectively, writing the result
1983 to a new table. The observed position angles for 3C286 must have been
1984 45 and -21 degrees; the corrections specified yield the correct value
1985 of 33 degrees when added to the observed values.
1987 --------------------------------------------------------------------------------
1989 """
1990 return _calibrater.calibrater_posangcal(self, *args, **kwargs)
1993 def linpolcor(self, *args, **kwargs):
1994 """
1995 linpolcor(self, _tablein, _tableout, _fields) -> bool
1999 Summary:
2000 Correct the gain table for linear polarization of the calibrator
2002 Description:
2006 THIS METHOD IS CURRENTLY DISABLED.
2008 This function can be used to correct the gains derived from secondary
2009 calibrators with unknown or variable polarization. It should only be
2010 used for arrays with linear (X/Y) feeds and an Alt-Az mount for which
2011 the observed polarization varies with feed position angle on the sky.
2013 The function fits the gains with a sine and cosine term in feed position
2014 angle and extracts the Q and U components of the secondary calibrator.
2015 This is only possible if there is sufficient range in the position angle
2016 (i.e., minimum of about 6 scans spanning at least 90 degrees in position
2017 angle). Check the error of the fit to judge if the fit was succesfull,
2018 it should generally be smaller than 0.5%.
2020 Use the {stfaf fields} argument to select calibrator fields to be
2021 fitted. The function takes a calibration table as input, and can write
2022 the adjusted gain solutions to the same table on output, or create a new
2023 table containing these results. The function also prints the derived
2024 polarization for each field for each spectral window.
2026 Input Parameters:
2027 tablein Input calibration table name
2028 tableout Output calibration table name
2029 fields Calibrator field names
2031 Example:
2033 cb.open('atca.ms');
2034 cb.linpolcor(tablein='atca.gcal', tableout='atca.gcal2',
2035 fields='2254-367');
2036 cb.close();
2039 This example takes an existing calibration table containing {tt G}
2040 Jones matrices, and writes a corrected output table, correcting only
2041 gains derived from 2254-367 for linear polarization.
2043 --------------------------------------------------------------------------------
2045 """
2046 return _calibrater.calibrater_linpolcor(self, *args, **kwargs)
2049 def plotcal(self, *args, **kwargs):
2050 """
2051 plotcal(self, _antennas, _fields, _spwids, _plottype, _tablename, _polarization, _multiplot, _nx, _ny, _psfile) -> bool
2055 Summary:
2056 Plot a calibration table
2058 Description:
2062 This function plots a calibration table either to a plotter or
2063 to a file.
2065 The argument {stfaf plottype} can take the following values
2066 for all types of solutions:
2067 begin{description}
2068 item[AMP] Gain Amplitude vs. Time
2069 item[1/AMP] Inverse Gain Amplitude vs. Time (useful for
2070 comparing with classic AIPS)
2071 item[PHASE] Gain Phase vs. Time
2072 item[RI] Gain Real vs. Imaginary
2073 item[RLPHASE] Right/Left Gain phase difference (if polarizations are R,L)
2074 item[XYPHASE] X/Y Gain phase difference (if polarizations are X,Y)
2075 end{description}
2077 The argument {stfaf plottype} can take the following values
2078 for D tables
2080 begin{description}
2081 item[DAMP] Cross-polarized Gain Amplitude vs. Time
2082 item[DPHASE] Cross-polarized Gain Phase vs. Time
2083 item[DRI] Cross-polarized Gain Real vs. Imaginary
2084 end{description}
2086 The quality of the solutions can be examined with the following
2087 {stfaf plottype} choices:
2088 begin{description}
2089 item[FIT] Fit per spectral window
2090 item[FITWGT] Fit weight per spectral window
2091 item[TOTALFIT] Total fit
2092 end{description}
2094 By default, all antennas (as specified in the antennas argument) will
2095 appear on the same plot. Separate plots (all with the same scale)
2096 for each antenna can be activated by setting multiplot=T. The multiplot
2097 argument only separates plots by antenna (not, e.g., by the field_id(s)
2098 specified in the fields argument). If multiplot=T, the nx and ny
2099 arguments can be used to specify the number of plots per page.
2101 At the moment, only one polarization can be plotted per execution.
2102 This restriction will be relaxed in the near future.
2104 For B solutions, the plotting will loop over timestamps (if more than
2105 one).
2107 A hardcopy plot can be created by specifying the texttt{psfile}
2108 argument (which is especially useful for batch processing when a
2109 display screen is not available). This will cause the plot to be
2110 written to a PostScript file which can be subsequently sent to a
2111 printer.
2113 Input Parameters:
2114 antennas Antennas to plot. Default is none.
2115 fields Fields to plot. Default is none.
2116 spwids Spectral windows id.'s to plot. Default is none.
2117 plottype Plot type
2118 tablename Calibration table name
2119 polarization Polarization to plot
2120 multiplot Turn on separate antenna plots
2121 nx If multiplot=T, number of plots on horizontal axis
2122 ny If multiplot=T, number of plots on vertical axis
2123 psfile Name of output PostScript file to write plot to. Default is to send plot to the screen.
2125 Example:
2127 cb.open('ngc5921.ms');
2128 cb.plotcal(plottype='PHASE', tablename='gcal', antennas=[1,3], polarization=2);
2129 cb.close();
2131 --------------------------------------------------------------------------------
2133 """
2134 return _calibrater.calibrater_plotcal(self, *args, **kwargs)
2137 def modelfit(self, *args, **kwargs):
2138 """
2139 modelfit(self, _vary, _niter, _compshape, _par, _file) -> std::vector< double >
2143 Summary:
2144 Model fitting
2146 Description:
2150 This method fits single-component models (points, elliptical Gaussians or elliptical Disks_
2151 to the CORRECTED_DATA of the selected field. A first guess for the component
2152 parameters may be specified in the {stfaf par} parameter.
2154 Input Parameters:
2155 vary If specified where T, let this parameter (in par) vary in fit
2156 niter Number of non-linear fitting iterations
2157 compshape Component shape, P=point G=gaussian
2158 par Initial guess for fit parameters (default is for 'P)'I flux, rel RA, rel Dec, 1,0, 0.0, 0.0 are defaults
2159 file If specified, output componentslist file name, if empty don't write componentslist file
2161 Example:
2163 cb.open('ngc5921.ms');
2164 cb.selectvis(field='1331*')
2165 cb.modelfit(compshape='P',par=[15.0,0.0,0.0])
2166 cb.close();
2169 This example fits a point source mode using 15.0 Jy at the origin (phase center)
2170 as a first guess.
2174 cb.open('ngc5921.ms');
2175 cb.selectvis(field='1331*')
2176 cb.modelfit(compshape='G',par=[15.0,0.0,0.0,2.0,1.0,0.0])
2177 cb.close();
2180 This example fits a Guassian model with a starting
2181 guess of 15 Jy at the phase center (0,0), with 2.0 arcsec major axis,
2182 1.0 axial ratio, at position angle 0.0 deg.
2184 --------------------------------------------------------------------------------
2186 """
2187 return _calibrater.calibrater_modelfit(self, *args, **kwargs)
2190 def createcaltable(self, *args, **kwargs):
2191 """
2192 createcaltable(self, _caltable, _partype, _caltype, _singlechan) -> bool
2196 Summary:
2197 Create an empty calibration table
2199 Description:
2202 Creates an empty calibration table that can subsequently be filled
2203 with by using the table tool.
2205 Input Parameters:
2206 caltable Calibration table name
2207 partype Parameter type name
2208 caltype Calibration type name
2209 singlechan Create a calibration table with frequency-independent parameters?
2211 Example:
2213 cb.open('ngc5921.ms',F,F,F) # don't add MODEL_DATA, etc.
2214 cb.createcaltable('ngc5921.gcal', 'Complex', 'G Jones', True)
2215 cb.close()
2217 --------------------------------------------------------------------------------
2219 """
2220 return _calibrater.calibrater_createcaltable(self, *args, **kwargs)
2223 def updatecaltable(self, *args, **kwargs):
2224 """
2225 updatecaltable(self, _caltable) -> bool
2229 Summary:
2230 Caltable modernizer.
2232 Description:
2235 This method can be used to update a caltable (from v3.4 or later)
2236 to the current version of CASA.
2238 The following updates are currently supported.
2240 o At CASA v4.1.0, the OBSERVATION subtable and OBSERVATION_ID column
2241 were added to caltables. This method adds trivial versions of
2242 these elements to pre-v4.1 caltables.
2244 Input Parameters:
2245 caltable Name of the caltable.
2247 Example:
2249 cb.updatecaltable('mycaltable');
2251 --------------------------------------------------------------------------------
2253 """
2254 return _calibrater.calibrater_updatecaltable(self, *args, **kwargs)
2257 def close(self):
2258 """
2259 close(self) -> bool
2263 Summary:
2264 Close the calibrater tool
2266 Description:
2269 Close the {tt calibrater} tool, which is hardly ever necessary.
2271 Example:
2273 cb.open('ngc5921.ms');
2274 cb.close();
2276 --------------------------------------------------------------------------------
2278 """
2279 return _calibrater.calibrater_close(self)
2282 def done(self):
2283 """
2284 done(self) -> bool
2288 Summary:
2289 Destroy the calibrater tool
2291 Description:
2294 This function is redundant with the {stfaf close} method.
2296 Example:
2298 cb.open('ngc5921.ms');
2299 cb.done();
2301 --------------------------------------------------------------------------------
2303 """
2304 return _calibrater.calibrater_done(self)
2307 def parsecallibfile(self, *args, **kwargs):
2308 """
2309 parsecallibfile(self, _filein) -> record *
2313 Summary:
2314 Bootstrap the flux density scale from standard calibrators
2316 Description:
2320 TBD
2322 Input Parameters:
2323 filein Input cal library file name
2325 Example:
2327 TBD
2329 --------------------------------------------------------------------------------
2331 """
2332 return _calibrater.calibrater_parsecallibfile(self, *args, **kwargs)
2335 def setcorrdepflags(self, *args, **kwargs):
2336 """
2337 setcorrdepflags(self, _corrdepflags) -> bool
2341 Summary:
2342 Control use of correlation-dependent flags
2344 Description:
2348 TBD
2350 Input Parameters:
2351 corrdepflags Turn correlation dependent flags on/off (true/false)
2353 Example:
2355 TBD
2357 --------------------------------------------------------------------------------
2359 """
2360 return _calibrater.calibrater_setcorrdepflags(self, *args, **kwargs)
2363 def setvi(self, *args, **kwargs):
2364 """
2365 setvi(self, _old, _quiet) -> bool
2369 Summary:
2370 TEMPORARY method to control use of new VI2 regime
2372 Description:
2375 Use this method to control whether the modern (old=False) or old-style (old=True)
2376 VisibilityIterator is used by the calibration application. General users should
2377 avoid use of this function unless they understand what this means.
2379 This method will be removed from the calibrater tool in v5.1.
2381 Input Parameters:
2382 old Use old-style VI, if old=True, else use new VI2
2383 quiet Warn in logger, if quiet=False
2385 Example:
2387 cb.setvi(True)
2388 cb.open('ngc5921.ms')
2390 --------------------------------------------------------------------------------
2392 """
2393 return _calibrater.calibrater_setvi(self, *args, **kwargs)
2395 __swig_destroy__ = _calibrater.delete_calibrater
2396 __del__ = lambda self: None
2397calibrater_swigregister = _calibrater.calibrater_swigregister
2398calibrater_swigregister(calibrater)
2400# This file is compatible with both classic and new-style classes.