Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatasks/flagdata.py: 100%
27 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-31 19:53 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-31 19:53 +0000
1##################### generated by xml-casa (v2) from flagdata.xml ##################
2##################### 4f26e57fc00d2ca604825e5f4b7fac4a ##############################
3from __future__ import absolute_import
4import numpy
5from casatools.typecheck import CasaValidator as _val_ctor
6_pc = _val_ctor( )
7from casatools.coercetype import coerce as _coerce
8from casatools.errors import create_error_string
9from .private.task_flagdata import flagdata as _flagdata_t
10from casatasks.private.task_logging import start_log as _start_log
11from casatasks.private.task_logging import end_log as _end_log
12from casatasks.private.task_logging import except_log as _except_log
14class _flagdata:
15 """
16 flagdata ---- All-purpose flagging task based on data-selections and flagging modes/algorithms.
19 This task can flag a Measurement Set or a calibration table. It has
20 two main types of operation. One type will read the parameters from
21 the interface and flag using any of the various available modes. The
22 other type will read the commands from a text file, a list of files or
23 a Python list of strings, containing a list of flag commands.
25 It is also possible to only save the parameters set in the interface
26 without flagging. The parameters can be saved in the FLAG_CMD
27 sub-table or in a text file. Note that when saving to an external
28 file, the parameters will be appended to the given file.
30 The current flags can be automatically backed up before applying new
31 flags if the parameter flagbackup is set. Previous flag versions can
32 be recovered using the flagmanager task.
34 Flagdata can also flag many types of calibration tables. For detailed
35 information, see the task pages of flagdata in CASA Docs
36 (https://casa.nrao.edu/casadocs/)
38 --------- parameter descriptions ---------------------------------------------
40 vis Name of input visibility file
41 Default: none
43 Example: vis='ngc5921.ms'
44 mode Flagging mode
45 Default: 'manual'
46 Options: 'list', 'manual', 'clip', 'quack',
47 'shadow', 'elevation', 'tfcrop', 'rflag',
48 'antint', 'extend', 'unflag', 'summary'
51 \* 'list': Flag according to the data selection
52 and flag commands specified in the input
53 list. The input list may come from a text file,
54 a list of text files or from a Python list of
55 strings. Each input line may contain data
56 selection parameters and any parameter
57 specific to the mode given in the line. Default
58 values will be used for the parameters that are
59 not present in the line. Each line will be
60 taken as a command to the task. If data is
61 pre-selected using any of the selection
62 parameters, then flagging will apply only to
63 that subset of the MS.
65 For optimization and whenever possible, the
66 task will create a union of the data selection
67 parameters present in the list and select only
68 that portion of the MS.
70 NOTE1: the flag commands will be applied only
71 when action='apply'. If action='calculate' the
72 flags will be calculated, but not applied. This
73 is useful if display is set to something other
74 than 'none'. If action='' or 'none', the flag
75 commands will not be applied either. An empty
76 action is useful only to save the parameters of
77 the list to a file or to the FLAG_CMD
78 sub-table.
80 NOTE2: In list mode the parameter
81 quackincrement=True is not supported as part of
82 any quack flag command, unless it is the first
83 command of the list. See more about this in the
84 quack mode section of this help.
87 \* 'manual': Flag according to the data selection
88 specified. This is the default mode
91 \* 'clip': Clip data according to values of the
92 following subparameters. The polarization
93 expression is given by the correlation
94 parameter. For calibration tables, the
95 solutions are also given by the correlation
96 parameter.
99 \* 'quack': Option to remove specified part of
100 scan beginning/end.
103 \* 'shadow': Option to flag data of shadowed
104 antennas. This mode is not available for cal
105 tables.
107 All antennas in the antenna-subtable of the MS
108 (and the corresponding diameters) will be
109 considered for shadow-flag calculations. For a
110 given timestep, an antenna is flagged if any of
111 its baselines (projected onto the uv-plane) is
112 shorter than radius_1 + radius_2 -
113 tolerance. The value of 'w' is used to
114 determine which antenna is behind the
115 other. The phase-reference center is used for
116 antenna-pointing direction.
119 \* 'elevation': Option to flag based on antenna
120 elevation. This mode is not available for cal
121 tables.
124 \* 'tfcrop': Flag using the TFCrop autoflag
125 algorithm.
127 For each field, spw, timerange (specified by
128 ntime), and baseline,
129 (1) Average visibility amplitudes along time
130 dimension to form an average spectrum
131 (2) Calculate a robust piece-wise polynomial
132 fit for the band-shape at the base of RFI
133 spikes. Calculate 'stddev' of (data - fit).
134 (3) Flag points deviating from the fit by more
135 than N-stddev
136 (4) Repeat (1-3) along the other dimension.
138 This algorithm is designed to operate on
139 un-calibrated data (step (2)), as well as
140 calibrated data. It is recommended to extend
141 the flags after running this algorithm. See the
142 sub-parameter extendflags below.
145 \* 'rflag': Detect outliers based on the RFlag
146 algorithm (ref. E.Greisen, AIPS, 2011). The
147 polarization expression is given by the
148 correlation parameter.
150 Iterate through the data in chunks of time.
151 For each chunk, calculate local statistics, and
152 apply flags based on user supplied (or
153 auto-calculated) thresholds.
155 Step 1 : Time analysis (for each channel)
156 -- calculate local rms of real and imag
157 visibilities, within a sliding time window
158 -- calculate the median rms across time
159 windows, deviations of local rms from this
160 median, and the median deviation
161 -- flag if local rms is larger than
162 timedevscale x (medianRMS + medianDev)
164 Step 2 : Spectral analysis (for each time)
165 -- calculate avg of real and imag
166 visibilities and their rms across channels
167 -- calculate the deviation of each channel
168 from this avg, and the median-deviation
169 -- flag if deviation is larger than
170 freqdevscale x medianDev
172 It is recommended to extend the flags after
173 running this algorithm. See the sub-parameter
174 extendflags below.
176 Note that by default the flag implementation in
177 CASA is able to calculate the thresholds and
178 apply them on-the-fly (OTF). There is a
179 significant performancegain with this approach,
180 as the visibilities don't have to be read
181 twice,and therefore is highly
182 recommended. Otherwise it is possible
183 toreproduce the AIPS usage pattern by doing a
184 first run with 'calculate' mode and a second
185 run with 'apply' mode. The advantage of this
186 approach is that the thresholdsare calculated
187 using the data from all scans, instead of
188 calculating them for one scan only.
190 For more information and examples of 'rflag',
191 see the task pages of rflag in CASA Docs
192 (https://casa.nrao.edu/casadocs/)
195 \* 'antint': Flag integrations if all baselines to
196 a specified antenna are flagged
198 This mode flag all integrations in which a
199 specified antenna is flagged. This mode
200 operates for an spectral window. It flags any
201 integration in which all baselines to a
202 specified antenna are flagged, but only if this
203 condition is satisfied in a fraction of
204 channels within the spectral window of interest
205 greater than a nominated fraction. For
206 simplicity, it assumes that all polarization
207 products must be unflagged for a baseline to be
208 deemed unflagged. The antint mode implements
209 the flagging approach introduced in
210 'antintflag'
211 (https://doi.org/10.5281/zenodo.163546)
213 The motivating application for introducing this
214 mode is removal of data that will otherwise
215 lead to changes in reference antenna during
216 gain calibration, which will in turn lead to
217 corrupted polarization.
220 \* 'extend': Extend and/or grow flags beyond what
221 the basic algorithms detect. This mode will
222 extend the accumulated flags available in the
223 MS, regardless of which algorithm created them.
225 It is recommended that any autoflag (tfcrop,
226 rflag) algorithm be followed up by a flag
227 extension.
229 Extensions will apply only within the selected
230 data, according to the settings of
231 extendpols,growtime,growfreq,growaround,
232 flagneartime,flagnearfreq.
234 Note : Runtime summary counts in the logger can
235 sometimes report larger flag percentages than
236 what is actually flagged. This is because
237 extensions onto already-flagged data-points are
238 counted as new flags. An accurate flag count
239 can be obtained via the summary mode.
242 \* 'unflag': Unflag according to the data
243 selection specified.
246 \* 'summary': List the number of rows and flagged
247 data points for the MS's meta-data. The
248 resulting summary will be returned as a Python
249 dictionary.
250 autocorr Flag only the auto-correlations?
251 Subparameter of mode='manual'
252 Default: False
253 Options: False|True
255 NOTE: this parameter is only active when set to
256 True. If set to False it does NOT mean "do not
257 flag auto-correlations". When set to True, it
258 will only flag data from a processor of type
259 CORRELATOR.
260 inpfile Input ASCII file, list of files or Python list of strings
261 with flag commands.
262 Subparameter of mode='list'
263 Default: ''
264 Options: [] with flag commands or
265 [] with filenames or
266 '' with a filename.
268 The parser will be strict and accept only valid
269 flagdata parameters in the list. The parser
270 evaluates the commands in the list and considers
271 only existing Python types.It will check each
272 parameter name and type and exit with an error if
273 any of them is wrong.
275 NOTE: There should be no whitespace between
276 KEY=VALUE since the parser first breaks command
277 lines on whitespace, then on "=". Use only one
278 whitespace to separate the parameters (no
279 commas).
280 reason Select flag commands based on REASON(s)
281 Subparameter of mode='list'
282 Default: 'any' (all flags regardless of reason)
283 Can be a string, or list of strings
285 Examples:
286 reason='FOCUS_ERROR'
287 reason=['FOCUS_ERROR','SUBREFLECTOR_ERROR']
289 If inpfile is a list of files, the reasons given
290 in this parameter will apply to all the files.
292 NOTE: what is within the string is literally
293 matched, e.g. reason='' matches only blank
294 reasons, and reason =
295 'FOCUS_ERROR,SUBREFLECTOR_ERROR' matches this
296 compound reason string only.
297 tbuff A time buffer or list of time buffers to pad the
298 timerange parameters in flag commands.
299 Subparameter of mode='list'
300 Default: 0.0 (it will not apply any time padding)
302 When a list of 2 time buffers is given, it will
303 subtract the first value from the lower time and
304 the second value will be added to the upper time
305 in the range. The 2 time buffer values can be
306 different, allowing to have an irregular time
307 buffer padding to time ranges. If the list
308 contains only one time buffer, it will use it to
309 subtract from t0 and add to t1. If more than one
310 list of input files is given, tbuff will apply to
311 all of the flag commands that have timerange
312 parameters in the files. Each tbuff value should
313 be a Float number given in seconds.
315 Examples:
316 tbuff=[0.5, 0.8]
317 inpfile=['online.txt','userflags.txt']
319 The timeranges in the online.txt file are
320 first converted to seconds. Then, 0.5 is
321 subtracted from t0 and 0.8 is added to t1,
322 where t0 and t1 are the two intervals given in
323 timerange. Similarly, tbuff will be applied to
324 any timerange in userflags.txt.
326 IMPORTANT: This parameter assumes that timerange
327 = t0 ~ t1, therefore it will not work if only t0
328 or t1 is given.
330 NOTE: The most common use-case for tbuff is to
331 apply the online flags that are created by
332 importasdm when savecmds=True. The value of a
333 regular time buffer should be
334 tbuff=0.5\*max(integration time).
335 spw Select spectral window/channels
336 Default: '' (all spectral windows and channels)
338 Examples:
339 spw='0~2,4'; spectral windows 0,1,2,4 (all channels)
340 spw='<2'; spectral windows less than 2 (i.e. 0,1)
341 spw='0:5~61'; spw 0, channels 5 to 61
342 spw='0,10,3:3~45'; spw 0,10 all channels, spw
343 3 - chans 3 to 45.
344 spw='0~2:2~6'; spw 0,1,2 with channels 2
345 through 6 in each.
346 spw = '\*:3~64' channels 3 through 64 for all sp id's
347 spw = ' :3~64' will NOT work.
349 NOTE: For modes clip, tfcrop and rflag,
350 channel-ranges can be excluded from flagging by
351 leaving them out of the selection range. This is
352 a way to protect known spectral-lines from being
353 flagged by the autoflag algorithms. For example,
354 if spectral-lines fall in channels 6~9, set the
355 selection range to spw='0:0~5;10~63'.
356 field Select field using field id(s) or field name(s)
357 Default: '' (all fields)
359 Use 'go listobs' to obtain the list id's or
360 names. If field string is a non-negative integer,
361 it is assumed a field index, otherwise, it is
362 assumed a field name.
364 Examples:
365 field='0~2'; field ids 0,1,2
366 field='0,4,5~7'; field ids 0,4,5,6,7
367 field='3C286,3C295'; field named 3C286 and
368 3C295
369 field = '3,4C\*'; field id 3, all names
370 starting with 4C
371 antenna Select data based on antenna/baseline
372 Subparameter of selectdata=True
373 Default: '' (all)
375 If antenna string is a non-negative integer, it
376 is assumed an antenna index, otherwise, it is
377 assumed as an antenna name
379 Examples:
380 antenna='5&6'; baseline between antenna
381 index 5 and index 6.
382 antenna='VA05&VA06'; baseline between VLA
383 antenna 5 and 6.
384 antenna='5&6;7&8'; baselines with
385 indices 5-6 and 7-8
386 antenna='5'; all baselines with antenna index
387 5
388 antenna='05'; all baselines with antenna
389 number 05 (VLA old name)
390 antenna='5,6,10'; all baselines with antennas
391 5,6,10 index numbers
393 NOTE: for some antenna-based calibration tables,
394 selecting baselines with the & syntax do not
395 apply.
396 uvrange Select data by baseline length.
397 Default = '' (all)
399 Examples:
400 uvrange='0~1000klambda'; uvrange from 0-1000 kilo-lambda
401 uvrange='>4klambda';uvranges greater than 4 kilo-lambda
402 uvrange='0~1000km'; uvrange in kilometers
404 NOTE: uvrange selection is not supported for cal tables.
405 timerange Select data based on time range
406 Subparameter of selectdata=True
407 Default = '' (all)
409 Examples:
410 timerange =
411 'YYYY/MM/DD/hh:mm:ss~YYYY/MM/DD/hh:mm:ss'
412 (Note: if YYYY/MM/DD is missing date defaults
413 to first day in data set.)
414 timerange='09:14:0~09:54:0' picks 40 min on
415 first day
416 timerange= '25:00:00~27:30:00' picks 1 hr to 3
417 hr 30min on NEXT day
418 timerange='09:44:00' pick data within one
419 integration of time
420 timerange='>10:24:00' data after this time
421 correlation Select data based on correlation
422 Default: '' ==> all
423 Options: Any of 'ABS', 'ARG', 'REAL', 'IMAG',
424 'NORM' followed by any of 'ALL', 'I', 'XX', 'YY',
425 'RR', 'LL', 'WVR' ('WVR' = water vapour
426 radiometer of ALMA data).
428 Example: correlation="XX,YY".
430 For modes clip, tfcrop or rflag, the default
431 means ABS_ALL.
432 If the input is cal table that does not contain
433 a complex data column, the default will fall back
434 to REAL_ALL.
435 For calibration tables, the solutions are:
436 'Sol1', 'Sol2', Sol3, Sol4.
437 When using the 'ARG' option, the values of
438 parameters such as clipminmax are expeced in
439 units of radians.
441 NOTE: correlation selection is not supported for
442 modes other than clip, tfcrop or rflag in cal
443 tables.
444 scan Scan number range
445 Subparameter of selectdata=True
446 Default: '' = all
447 intent Select observing intent
448 Default: '' (no selection by intent)
450 Example: intent='\*BANDPASS\*' (selects data
451 labelled with BANDPASS intent)
453 NOTE: intent selection is not supported for cal
454 tables.
455 array Selection based on the antenna array
456 Default: '' (all)
458 NOTE: array selection is not supported for cal
459 tables.
460 observation Select by observation ID(s)
461 Subparameter of selectdata=True
462 Default: '' = all
464 Example: observation='0~2,4'
465 feed Selection based on the feed: Not yet implemented
466 clipminmax Range to use for clipping
467 Subparameter of mode='clip'
468 Default: [] (it will flag only NaN and Infs)
470 It will always flag the NaN/Inf data, even when a range is specified.
472 Example: [0.0,1.5]
473 datacolumn Data column to image (data or observed, corrected)
474 Subparameter of mode='clip|tfcrop|rflag'
475 Default:'corrected'
476 Options: data, corrected, model, weight, etc.
478 If 'corrected' does not exist, it will use 'data'
479 instead
480 clipoutside Clip outside the range?
481 Subparameter of mode='clip'
482 Default: True
483 Options: True|False
484 channelavg Pre-average data across channels before analyzing
485 visibilities for flagging
486 Subparameter of mode='clip|tfcrop|rflag'
487 Default: False
488 Options: False|True
490 Pre-average data across channels before analyzing
491 visibilities for flagging. Partially flagged data
492 is not be included in the average unless all
493 data contributing to a given output channel is
494 flagged. If present, WEIGHT_SPECTRUM /
495 SIGMA_SPECTRUM are used to compute a weighted
496 average (WEIGHT_SPECTRUM for CORRECTED_DATA and
497 SIGMA_SPECTRUM for DATA).
499 NOTE: Pre-average across channels is not
500 supported for calibration tables
501 chanbin Bin width for channel average in number of input channels
502 Subparameter of mode='clip|tfcrop|rflag'
503 Default: 1
505 Bin width for channel average in number of input
506 channels. If a list is given, each bin applies to
507 one of the selected SPWs. When chanbin is set to
508 1 all input channels are used for the average
509 to produce a single output channel, this
510 behaviour aims to preserve backwards
511 compatibility with the previous pre-averaging
512 feature of clip mode.
513 timeavg Pre-average data across time before analyzing
514 visibilities for flagging.
515 Subparameter of mode='clip|tfcrop|rflag'
516 Default: False
517 Options: False|True
519 Pre-average data across time before analyzing
520 visibilities for flagging. Partially flagged data
521 is not be included in the average unless all
522 data contributing to a given output channel is
523 flagged. If present, WEIGHT_SPECTRUM /
524 SIGMA_SPECTRUM are used to compute a weighted
525 average (WEIGHT_SPECTRUM for CORRECTED_DATA and
526 SIGMA_SPECTRUM for DATA). Otherwise WEIGHT/SIGMA
527 are used to average together data from different
528 integrations.
530 NOTE: Pre-average across time is not
531 supported for calibration tables
532 timebin Bin width for time average in seconds
533 Subparameter of mode='clip|tfcrop|rflag'
534 Default: '0s'
535 clipzeros Clip zero-value data
536 Subparameter of mode='clip'
537 Default: False
538 Options: False|True
539 quackinterval Time in seconds from scan beginning or end to flag.
540 Subparameter of mode='quack'
541 Default: 1.0
543 Note: Make time slightly smaller than the desired
544 time.
545 quackmode Quack mode flags the region of the scan given by one of the
546 options below using the time set at quackinterval.
547 Subparameter of mode='quack'
548 Default: 'beg'
549 Options:
550 'beg' : flag an interval at the beginning of scan
551 'endb': flag an interval at the end of scan
552 'tail': flag all but an interval at the beginning of scan
553 'end' : flag all but an interval at end of scan
555 Visual representation of quack mode flagging one
556 scan with 1s duration. The following diagram
557 shows what is flagged for each quack mode when
558 quackinterval is set to 0.25s. The flagged part
559 is represented by crosses (+++++++++)
561 scan with 1s duration
562 --------------------------------------------
563 beg
564 +++++++++++---------------------------------
565 endb
566 ---------------------------------+++++++++++
567 tail
568 -----------+++++++++++++++++++++++++++++++++
569 end
570 +++++++++++++++++++++++++++++++++-----------
571 quackincrement Increment quack flagging in time taking into account
572 flagged data or not.
573 Subparameter of mode='quack'
574 Default: False
575 Options: False|True
577 False: the quack interval is counted from the
578 scan boundaries, as determined by the quackmode
579 parameter, regardless of if data has been flagged
580 or not.
581 True: the quack interval is counted from the
582 first unflagged data in the scan.
584 NOTE: on adding quack to a command in 'list'
585 mode: quackincrement = True works based on the
586 state of prior flagging, and unless it is the
587 first item in the list the agent doing the
588 quacking in list mode doesn't know about the
589 state of prior flags. In this case, the command
590 with quackincrement=True will be ignored and the
591 task will issue a WARNING.
592 tolerance Amount of shadowing allowed (or tolerated), in meters.
593 Subparameter of mode='shadow'
594 Default: 0.0
596 A positive number allows antennas to overlap in
597 projection. A negative number forces antennas
598 apart in projection. Zero implies a distance of
599 radius_1+radius_2 between antenna centers.
600 addantenna File name or dictionary with additional antenna names,
601 positions and diameters
602 Subparameter of mode='shadow'
603 Default: ''
605 It can be either a file name with additional
606 antenna names, positions and diameters, or a
607 Python dictionary with the same information. You
608 can use the flaghelper functions to create the
609 dictionary from a file.
611 To create a dictionary inside casapy.
612 > import flaghelper as fh
613 > antdic = fh.readAntennaList(antfile)
615 Where antfile is a text file in disk that
616 contains information such as:
617 name=VLA01
618 diameter=25.0
619 position=[-1601144.96146691, -5041998.01971858,
620 3554864.76811967]
621 name=VLA02
622 diameter=25.0
623 position=[-1601105.7664601889,
624 -5042022.3917835914, 3554847.245159178]
625 lowerlimit Lower limiting elevation (in degrees)
626 Subparameter of mode='elevation'
627 Default: 0.0
629 Lower limiting elevation in degrees. Data coming
630 from a baseline where one or both antennas were
631 pointing at a strictly lower elevation (as
632 function of time), will be flagged.
633 upperlimit Upper limiting elevation (in degrees)
634 Subparameter of mode='elevation'
635 Default: 90.0
637 Upper limiting elevation in degrees. Data coming
638 from a baseline where one or both antennas were
639 pointing at a strictly higher elevation (as
640 function of time), will be flagged.
641 ntime Timerange (in seconds or minutes) over which to buffer
642 data before running the algorithm.
643 Subparameter of mode='tfcrop|rflag|extend'
644 Default: 'scan'
645 Options: 'scan' or any other float value or
646 string containing the units.
648 The dataset will be iterated through in
649 time-chunks defined here.
651 Example: ntime='1.5min'; 1.2 (taken in
652 seconds)
654 WARNING: if ntime='scan' and combinescans=True,
655 all the scans will be loaded at once, thus
656 requesting a lot of memory depending on the
657 available spws.
658 combinescans Accumulate data across scans depending on the value of
659 ntime.
660 Subparameter of mode='tfcrop|rflag|extend'
661 Default: False
662 Options: False|True
664 This parameter should be set to True only when
665 ntime is specified as a time-interval (not
666 'scan'). When set to True, it will remove SCAN
667 from the sorting columns, therefore it will only
668 accumulate across scans if ntime is not set to
669 'scan'.
670 timecutoff Flagging thresholds in units of deviation from the fit
671 Subparameter of mode='tfcrop'
672 Default: 4.0
674 Flag all data-points further than N-stddev from
675 the fit. This threshold catches time-varying RFI
676 spikes (narrow and broad-band), but will not
677 catch RFI that is persistent in time.
679 Flagging is done in upto 5 iterations. The stddev
680 calculation is adaptive and converges to a value
681 that reflects only the data and no RFI. At each
682 iteration, the same relative threshold is applied
683 to detect flags. (Step (3) of the algorithm).
684 freqcutoff Flag threshold in frequency.
685 Subparameter of mode='tfcrop'
686 Default: 3.0
688 Flag all data-points further than N-stddev from
689 the fit. Same as timecutoff, but along the
690 frequency-dimension. This threshold catches
691 narrow-band RFI that may or may not be persistent
692 in time.
693 timefit Fitting function for the time direction (poly/line)
694 Subparameter of mode='tfcrop'
695 Default: 'line'
696 Options: line|poly
698 'line': fit is a robust straight-line fit across
699 the entire timerange (defined by 'ntime').
700 'poly': fit is a robust piece-wise polynomial fit
701 across the timerange.
703 NOTE: A robust fit is computed in upto 5
704 iterations. At each iteration, the stddev between
705 the data and the fit is computed, values beyond
706 N-stddev are flagged, and the fit and stddev are
707 re-calculated with the remaining points. This
708 stddev calculation is adaptive, and converges to
709 a value that reflects only the data and no RFI.
710 It also provides a varying set of flagging
711 thresholds, that allows deep flagging only when
712 the fit best represents the true data.
714 Choose 'poly' only if the visibilities are
715 expected to vary significantly over the timerange
716 selected by 'ntime', or if there is a lot of
717 strong but intermittent RFI.
718 freqfit Fitting function for the frequency direction (poly/line)
719 Subparameter of mode='tfcrop'
720 Default: 'poly'
721 Options: line|poly
723 Same as for the 'timefit' parameter.
725 Choose 'line' only if you are operating on
726 bandpass-corrected data, or residuals,and expect
727 that the bandshape is linear. The 'poly' option
728 works better on uncalibrated bandpasses with
729 narrow-band RFI spikes.
730 maxnpieces Number of pieces in the polynomial-fits (for "freqfit" or
731 "timefit" = "poly")
732 Subparameter of mode='tfcrop'
733 Default: 7
734 Options: 1-9
736 This parameter is used only if 'timefit' or
737 'freqfit' are chosen as 'poly'. If there is
738 significant broad-band RFI, reduce this
739 number. Using too many pieces could result in the
740 RFI being fitted in the 'clean' bandpass. In
741 later stages of the fit, a third-order polynomial
742 is fit per piece, so for best results, please
743 ensure that nchan/maxnpieces is at-least 10.
744 flagdimension Choose the directions along which to perform flagging
745 Subparameter of mode='tfcrop'
746 Default: 'freqtime' (first flag along frequency,
747 and then along time)
748 Options: 'time', 'freq', 'timefreq', 'freqtime'
750 For most cases, 'freqtime' or 'timefreq' are
751 appropriate, and differences between these
752 choices are apparant only if RFI in one dimension
753 is significantly stronger than the other. The
754 goal is to flag the dominant RFI first.
755 If there are very few (less than 5) channels of
756 data, then choose 'time'. Similarly for 'freq'.
757 usewindowstats Use sliding-window statistics to find additional flags.
758 Subparameter of mode='tfcrop'
759 Default: 'none'
760 Options: 'none', 'sum', 'std', 'both'
762 NOTE: This is experimental!
763 The 'sum' option chooses to flag a point, if the
764 mean-value in a window centered on that point
765 deviates from the fit by more than N-stddev/2.0.
767 NOTE: stddev is calculated between the data and
768 fit as explained in Step (2). This option is an
769 attempt to catch broad-band or time-persistent
770 RFI that the above polynomial fits will
771 mistakenly fit as the clean band. It is an
772 approximation to the sumThreshold method found to
773 be effective by Offringa et.al (2010) for LOFAR
774 data. The 'std' option chooses to flag a point,
775 if the 'local' stddev calculated in a window
776 centered on that point is larger than
777 N-stddev/2.0. This option is an attempt to catch
778 noisy RFI that is not excluded in the polynomial
779 fits, and which increases the global stddev, and
780 results in fewer flags (based on the N-stddev
781 threshold).
782 halfwin Half-width of sliding window to use with "usewindowstats"
783 (1,2,3).
784 Subparameter of mode='tfcrop'
785 Default: 1 (a 3-point window size)
786 Options: 1, 2, 3
788 NOTE: This is experimental!
789 extendflags Extend flags along time, frequency and correlation.
790 Subparameter of mode='tfcrop|rflag'
791 Default: True
792 Options: True|False
794 NOTE: It is usually helpful to extend the flags
795 along time, frequency, and correlation using this
796 parameter, which will run the "extend" mode after
797 "tfcrop" and extend the flags if more than 50% of
798 the timeranges are already flagged, and if more
799 than 80% of the channels are already flagged. It
800 will also extend the flags to the other
801 polarizations. The user may also set extendflags
802 to False and run the "extend" mode in a second
803 step within the same flagging run:
805 Example: cmd=["mode='tfcrop' freqcutoff=3.0
806 usewindowstats='sum' extendflags=False",
807 "mode='extend' extendpols=True growtime=50.0
808 growaround=True"]
809 flagdata(vis, mode='list', inpfile=cmd)
810 winsize Number of timesteps in the sliding time window ( fparm(1)
811 in AIPS )
812 Subparameter of mode='rflag'
813 Default: 3
814 timedev Time-series noise estimate ( noise in AIPS )
815 Subparameter of mode='rflag'
816 Default: []
818 Examples:
819 timedev = 0.5 : Use this noise-estimate to
820 calculate flags. Do not recalculate.
821 timedev = [ [1,9,0.2], [1,10,0.5] ] : Use
822 noise-estimate of 0.2 for field 1, spw 9, and
823 noise-estimate of 0.5 for field 1, spw 10.
824 timedev = [] : Auto-calculate noise
825 estimates.
826 'tdevfile.txt' : Auto-calculate noise
827 estimates and write them into a file with the
828 name given (any string will be interpreted as
829 a file name which will be checked for
830 existence).
831 freqdev Spectral noise estimate ( scutoff in AIPS )
832 Subparameter of mode='rflag'
833 Default: []
835 This step depends on having a relatively-flat
836 bandshape. Same parameter-options as 'timedev'.
837 timedevscale Threshold scaling for timedev( fparm(9) in AIPS ).
838 For Step 1 (time analysis), flag a point if local
839 rms around it is larger than 'timedevscale' x
840 'timedev' (fparm(0) in AIPS)
841 Subparameter of mode='rflag'
842 Default: 5.0
844 This scale parameter is only applied when
845 flagging (action='apply') and displaying reports
846 (display option). It is not used when the
847 thresholds are simply calculated and saved into
848 files (action='calculate', as in the two-passes
849 usage pattern of AIPS)
850 freqdevscale Threshold scaling for freqdev (fparm(10) in AIPS ).
851 For Step 2 (spectral analysis), flag a point if
852 local rms around it is larger than 'freqdevscale'
853 x 'freqdev' (fparm(10) in AIPS)
854 Subparameter of mode='rflag'
855 Default: 5.0
857 Similarly as with timedevscale, freqdevscale is
858 used when applying flags and displaying
859 reports. It is not used when the thresholds are
860 simply calculated and saved into files
861 (action='calculate', as in the two-passes usage
862 pattern of AIPS)
863 spectralmax Flag whole spectrum if 'freqdev' is greater than
864 spectralmax ( fparm(6) in AIPS )
865 Subparameter of mode='rflag'
866 Default: 1E6
867 spectralmin Flag whole spectrum if 'freqdev' is less than spectralmin
868 ( fparm(5) in AIPS )
869 Subparameter of mode='rflag'
870 Default: 0.0
871 antint_ref_antenna Antenna of interest. Baselines with this antenna will be
872 checked for flagged channels.
873 Subparameter of mode='antint'
875 Note that this is not the same as the general
876 'antenna' parameter of flagdata. The parameter
877 antint_ref_antenna is mandatory with the 'antint'
878 mode and chooses the antenna for which the
879 fraction of channels flagged will be checked.
880 minchanfrac Minimum fraction of flagged channels required for a
881 baseline to be deemed as flagged
882 Subparameter of mode='antint'
883 Takes values between 0-1 (float).
885 In this mode flagdata does the following for
886 every point in time. It checks the fraction of
887 channels flagged for any of the polarization
888 products and for every baseline to the antenna of
889 interest. If the fraction is higher than this
890 'minchanfrac' threshold then the data are flagged
891 for this pont in time (this includes all the rows
892 selected with the flagdata command that have that
893 timestamp).
894 This parameter will be ignored if spw specifies a
895 channel.
896 verbose Print timestamps of flagged integrations to the log
897 Subparameter of mode='antint'
899 Examples:
900 flagdata(vis, ..., spw='9',
901 antint_ref_antenna='ea01')
902 flagdata(vis, ..., spw='9',
903 antint_ref_antenna='ea01', minchanfrac=0.3,
904 verbose=True) ==> reduce the fraction of
905 channels that are required to be flagged, and
906 print information for every integration that
907 is flagged.
908 extendpols Extend flags to all selected correlations
909 Subparameter of mode='extend'
910 Default: True
911 Options: True|False
913 For example, to extend flags from RR to only
914 RL and LR, a data-selection of
915 correlation='RR,LR,RL' is required along with
916 extendpols=True.
917 growtime For any channel, flag the entire timerange in the current
918 2D chunk (set by 'ntime') if more than X% of the timerange is already
919 flagged.
920 Subparameter of mode='extend'
921 Default: 50.0
922 Options: 0.0 - 100.0
924 This option catches the low-intensity parts of
925 time-persistent RFI.
926 growfreq For any timestep, flag all channels in the current 2D
927 chunk (set by data-selection) if more than X% of the channels are
928 already flagged.
929 Subparameter of mode='extend'
930 Default: 50.0
931 Options: 0.0 - 100.0
933 This option catches broad-band RFI that is
934 partially identified by earlier steps.
935 growaround Flag a point based on the number of flagged points around it.
936 Subparameter of mode='extend'
937 Default: False
938 Options: False|True
940 For every un-flagged point on the 2D time/freq
941 plane, if more than four surrounding points are
942 already flagged, flag that point. This option
943 catches some wings of strong RFI spikes.
944 flagneartime Flag points before and after every flagged one, in the
945 time-direction.
946 Subparameter of mode='extend'
947 Default: False
948 Options: False|True
950 NOTE: This can result in excessive flagging.
951 flagnearfreq Flag points before and after every flagged one, in the
952 frequency-direction
953 Subparameter of mode='extend'
954 Default: False
955 Options: False|True
957 NOTE: This can result in excessive flagging
958 minrel Minimum number of flags (relative) to include in
959 histogram
960 Subparameter of mode='summary'
961 Default: 0.0
962 maxrel Maximum number of flags (relative) to include in
963 histogram
964 Subparameter of mode='summary'
965 Default: 1.0
966 minabs Minimum number of flags (absolute, inclusive) to include
967 in histogram
968 Subparameter of mode='summary'
969 Default: 0
970 maxabs Maximum number of flags (absolute, inclusive) to include
971 in histogram
972 Subparameter of mode='summary'
973 Default: -1
975 To indicate infinity, use any negative number.
976 spwchan List the number of flags per spw and per channel.
977 Subparameter of mode='summary'
978 Default: False
979 Options: False|True
980 spwcorr List the number of flags per spw and per correlation.
981 Subparameter of mode='summary'
982 Default: False
983 Options: False|True
984 basecnt Count the number of flags per baseline. The counts are added to the
985 return result dictionary (in the 'baseline'' key) and also printed
986 to the log. In addition, counts per antenna/scan are also reported
987 and added to the result dictionary (key 'antenna:scan').
988 Subparameter of mode='summary'
989 Default: False
990 Options: False|True
991 fieldcnt Produce a separated breakdown per field
992 Subparameter of mode='summary'
993 Default: False
994 Options: False|True
995 name Name for this summary, to be used as a key in the
996 returned Python dictionary
997 Subparameter of mode='summary'
998 Default: 'Summary'
1000 It is possible to call the summary mode multiple
1001 times in list mode. When calling the summary mode
1002 as a command in a list, one can give different
1003 names to each one of them so that they can be
1004 easily pulled out of the summary's dictionary.
1006 In summary mode, the task returns a dictionary of flagging statistics.
1008 Example 1:
1009 s = flagdata(..., mode='summary')
1010 Then s will be a dictionary which contains
1011 s['total'] : total number of data
1012 s['flagged'] : amount of flagged data
1014 Example 2:
1015 Two summary commands in list mode, intercalating a
1016 manual flagging command.
1017 s = flagdata(..., mode='list',
1018 inpfile=["mode='summary' name='InitFlags'",
1019 "mode='manual' autocorr=True", "mode='summary'
1020 name='Autocorr'"])
1022 The dictionary returned in 's' will contain two
1023 dictionaries, one for each of the two summary
1024 modes.
1025 s['report0']['name'] : 'InitFlags'
1026 s['report1']['name'] : 'Autocorr'
1027 action Action to perform in MS/cal table or in the input list of
1028 parameters.
1029 Default: 'apply'
1030 Options: 'none', 'apply','calculate'
1032 - 'apply': Apply the flags to the MS.
1033 - 'calculate': Only calculate the flags but do
1034 not write them to the MS. This is useful if
1035 used together with the display to analyse the
1036 results before writing to the MS.
1037 - '': When set to empty, the underlying tool will
1038 not be executed and no flags will be
1039 produced. No data selection will be done
1040 either. This is useful when used together with
1041 the parameter savepars to only save the current
1042 parameters (or list of parameters) to the
1043 FLAG_CMD sub-table or to an external file.
1044 display Display data and/or end-of-MS reports at runtime.
1045 Subparameter of action='apply|calculate'
1046 Default: 'none'
1047 Options: 'none', 'data', 'report', 'both'
1049 - 'none': will not display anything.
1050 - 'data': display data and flags per-chunk at
1051 run-time, within an interactive GUI.
1052 This option opens a GUI to show the 2D
1053 time-freq planes of the data with old and new
1054 flags, for all correlations per baseline.
1055 -- The GUI allows stepping through all
1056 baselines (prev/next) in the current chunk (set
1057 by 'ntime'), and stepping to the next-chunk.
1058 -- The 'flagdata' task can be quit from the
1059 GUI, in case it becomes obvious that the
1060 current set of parameters is just wrong.
1061 -- There is an option to stop the display but
1062 continue flagging.
1063 - 'report': displays end-of-MS reports on the
1064 screen.
1065 - 'both': displays data per chunk and end-of-MS
1066 reports on the screen
1067 flagbackup Automatically backup flags before the run?
1068 Default: True
1069 Options: True|False
1071 Flagversion names are chosen automatically, and
1072 are based on the mode being used.
1073 savepars Save the current parameters to the FLAG_CMD table of the
1074 MS or to an output text file?
1075 Default: False
1076 Options: False|True
1078 Note that when display is set to anything other
1079 than 'none', savepars will be disabled. This is
1080 done because in an interactive mode, the user may
1081 skip data which may invalidate the initial input
1082 parameters and there is no way to save the
1083 interactive commands. When the input is a
1084 calibration table it is only possible to save the
1085 parameters to a file.
1086 cmdreason A string containing a reason to save to the FLAG_CMD
1087 table or to an output text file given by the outfile sub-parameter.
1088 Subparameter of savepars=True
1089 Default: '' (no reason will be added to output)
1091 If the input contains any reason, they will be
1092 replaced with this one. At the moment it is not
1093 possible to add more than one reason.
1095 Example: cmdreason='CLIP_ZEROS'
1096 outfile Name of output file to save current parameters. If empty,
1097 save to FLAG_CMD
1098 Subparameter of savepars=True
1099 Default: '' (save the parameters to the FLAG_CMD
1100 table of the MS)
1102 Example: outfile='flags.txt' will save the
1103 parameters in a text file.
1104 overwrite Overwrite the existing file given in 'outfile'
1105 Default: True
1106 Options: True|False
1108 The default True will remove the existing file
1109 given in 'outfile' and save the current flag
1110 commands to a new file with the same name. When
1111 set to False, the task will exit with an error
1112 message if the file exist.
1113 writeflags Internal hidden parameter. Do not modify.
1114 [1;42mRETURNS[1;m void
1116 --------- examples -----------------------------------------------------------
1120 For more information, see the task pages of flagdata in CASA Docs:
1121 https://casadocs.readthedocs.io
1124 """
1126 _info_group_ = """flagging"""
1127 _info_desc_ = """All-purpose flagging task based on data-selections and flagging modes/algorithms."""
1129 def __call__( self, vis='', mode='manual', autocorr=False, inpfile='', reason='any', tbuff=float(0.0), spw='', field='', antenna='', uvrange='', timerange='', correlation='', scan='', intent='', array='', observation='', feed='', clipminmax=[ ], datacolumn='DATA', clipoutside=True, channelavg=False, chanbin=int(1), timeavg=False, timebin='0s', clipzeros=False, quackinterval=float(1.0), quackmode='beg', quackincrement=False, tolerance=float(0.0), addantenna='', lowerlimit=float(0.0), upperlimit=float(90.0), ntime='scan', combinescans=False, timecutoff=float(4.0), freqcutoff=float(3.0), timefit='line', freqfit='poly', maxnpieces=int(7), flagdimension='freqtime', usewindowstats='none', halfwin=int(1), extendflags=True, winsize=int(3), timedev='', freqdev='', timedevscale=float(5.0), freqdevscale=float(5.0), spectralmax=float(1E6), spectralmin=float(0.0), antint_ref_antenna='', minchanfrac=float(0.6), verbose=False, extendpols=True, growtime=float(50.0), growfreq=float(50.0), growaround=False, flagneartime=False, flagnearfreq=False, minrel=float(0.0), maxrel=float(1.0), minabs=int(0), maxabs=int(-1), spwchan=False, spwcorr=False, basecnt=False, fieldcnt=False, name='Summary', action='apply', display='', flagbackup=True, savepars=False, cmdreason='', outfile='', overwrite=True, writeflags=True ):
1130 schema = {'vis': {'type': 'cReqPath', 'coerce': _coerce.expand_path}, 'mode': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'tfcrop', 'extend', 'manualflag', 'quack', 'clip', 'manual', 'shadow', 'summary', 'antint', 'list', 'unflag', 'rflag', 'elevation' ]}, 'autocorr': {'type': 'cBool'}, 'inpfile': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'reason': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'tbuff': {'anyof': [{'type': 'cFloat', 'coerce': _coerce.to_float}, {'type': 'cFloatVec', 'coerce': [_coerce.to_list,_coerce.to_floatvec]}]}, 'spw': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'field': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'antenna': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'uvrange': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'timerange': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'correlation': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'scan': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'intent': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'array': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'observation': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cInt'}]}, 'feed': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'clipminmax': {'type': 'cFloatVec', 'coerce': [_coerce.to_list,_coerce.to_floatvec]}, 'datacolumn': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'clipoutside': {'anyof': [{'type': 'cBool'}, {'type': 'cBoolVec', 'coerce': [_coerce.to_list,_coerce.to_boolvec]}]}, 'channelavg': {'anyof': [{'type': 'cBool'}, {'type': 'cBoolVec', 'coerce': [_coerce.to_list,_coerce.to_boolvec]}]}, 'chanbin': {'anyof': [{'type': 'cInt'}, {'type': 'cIntVec', 'coerce': [_coerce.to_list,_coerce.to_intvec]}]}, 'timeavg': {'anyof': [{'type': 'cBool'}, {'type': 'cBoolVec', 'coerce': [_coerce.to_list,_coerce.to_boolvec]}]}, 'timebin': {'type': 'cStr', 'coerce': _coerce.to_str}, 'clipzeros': {'type': 'cBool'}, 'quackinterval': {'anyof': [{'type': 'cFloat', 'coerce': _coerce.to_float}, {'type': 'cFloatVec', 'coerce': [_coerce.to_list,_coerce.to_floatvec]}, {'type': 'cInt'}, {'type': 'cIntVec', 'coerce': [_coerce.to_list,_coerce.to_intvec]}]}, 'quackmode': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'quackincrement': {'anyof': [{'type': 'cBool'}, {'type': 'cBoolVec', 'coerce': [_coerce.to_list,_coerce.to_boolvec]}]}, 'tolerance': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'addantenna': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cDict'}]}, 'lowerlimit': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'upperlimit': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'ntime': {'anyof': [{'type': 'cFloat', 'coerce': _coerce.to_float}, {'type': 'cStr', 'coerce': _coerce.to_str}]}, 'combinescans': {'type': 'cBool'}, 'timecutoff': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'freqcutoff': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'timefit': {'type': 'cStr', 'coerce': _coerce.to_str}, 'freqfit': {'type': 'cStr', 'coerce': _coerce.to_str}, 'maxnpieces': {'type': 'cInt'}, 'flagdimension': {'type': 'cStr', 'coerce': _coerce.to_str}, 'usewindowstats': {'type': 'cStr', 'coerce': _coerce.to_str}, 'halfwin': {'type': 'cInt'}, 'extendflags': {'type': 'cBool'}, 'winsize': {'type': 'cInt'}, 'timedev': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'freqdev': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'timedevscale': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'freqdevscale': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'spectralmax': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'spectralmin': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'antint_ref_antenna': {'type': 'cStr', 'coerce': _coerce.to_str}, 'minchanfrac': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'verbose': {'type': 'cBool'}, 'extendpols': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'growtime': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'growfreq': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'growaround': {'type': 'cBool'}, 'flagneartime': {'type': 'cBool'}, 'flagnearfreq': {'type': 'cBool'}, 'minrel': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'maxrel': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'minabs': {'type': 'cInt'}, 'maxabs': {'type': 'cInt'}, 'spwchan': {'type': 'cBool'}, 'spwcorr': {'type': 'cBool'}, 'basecnt': {'type': 'cBool'}, 'fieldcnt': {'type': 'cBool'}, 'name': {'type': 'cStr', 'coerce': _coerce.to_str}, 'action': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'apply', 'calculate', 'none', '' ]}, 'display': {'type': 'cStr', 'coerce': _coerce.to_str}, 'flagbackup': {'type': 'cBool'}, 'savepars': {'type': 'cBool'}, 'cmdreason': {'type': 'cStr', 'coerce': _coerce.to_str}, 'outfile': {'type': 'cStr', 'coerce': _coerce.to_str}, 'overwrite': {'type': 'cBool'}, 'writeflags': {'type': 'cBool'}}
1131 doc = {'vis': vis, 'mode': mode, 'autocorr': autocorr, 'inpfile': inpfile, 'reason': reason, 'tbuff': tbuff, 'spw': spw, 'field': field, 'antenna': antenna, 'uvrange': uvrange, 'timerange': timerange, 'correlation': correlation, 'scan': scan, 'intent': intent, 'array': array, 'observation': observation, 'feed': feed, 'clipminmax': clipminmax, 'datacolumn': datacolumn, 'clipoutside': clipoutside, 'channelavg': channelavg, 'chanbin': chanbin, 'timeavg': timeavg, 'timebin': timebin, 'clipzeros': clipzeros, 'quackinterval': quackinterval, 'quackmode': quackmode, 'quackincrement': quackincrement, 'tolerance': tolerance, 'addantenna': addantenna, 'lowerlimit': lowerlimit, 'upperlimit': upperlimit, 'ntime': ntime, 'combinescans': combinescans, 'timecutoff': timecutoff, 'freqcutoff': freqcutoff, 'timefit': timefit, 'freqfit': freqfit, 'maxnpieces': maxnpieces, 'flagdimension': flagdimension, 'usewindowstats': usewindowstats, 'halfwin': halfwin, 'extendflags': extendflags, 'winsize': winsize, 'timedev': timedev, 'freqdev': freqdev, 'timedevscale': timedevscale, 'freqdevscale': freqdevscale, 'spectralmax': spectralmax, 'spectralmin': spectralmin, 'antint_ref_antenna': antint_ref_antenna, 'minchanfrac': minchanfrac, 'verbose': verbose, 'extendpols': extendpols, 'growtime': growtime, 'growfreq': growfreq, 'growaround': growaround, 'flagneartime': flagneartime, 'flagnearfreq': flagnearfreq, 'minrel': minrel, 'maxrel': maxrel, 'minabs': minabs, 'maxabs': maxabs, 'spwchan': spwchan, 'spwcorr': spwcorr, 'basecnt': basecnt, 'fieldcnt': fieldcnt, 'name': name, 'action': action, 'display': display, 'flagbackup': flagbackup, 'savepars': savepars, 'cmdreason': cmdreason, 'outfile': outfile, 'overwrite': overwrite, 'writeflags': writeflags}
1132 assert _pc.validate(doc,schema), create_error_string(_pc.errors)
1133 _logging_state_ = _start_log( 'flagdata', [ 'vis=' + repr(_pc.document['vis']), 'mode=' + repr(_pc.document['mode']), 'autocorr=' + repr(_pc.document['autocorr']), 'inpfile=' + repr(_pc.document['inpfile']), 'reason=' + repr(_pc.document['reason']), 'tbuff=' + repr(_pc.document['tbuff']), 'spw=' + repr(_pc.document['spw']), 'field=' + repr(_pc.document['field']), 'antenna=' + repr(_pc.document['antenna']), 'uvrange=' + repr(_pc.document['uvrange']), 'timerange=' + repr(_pc.document['timerange']), 'correlation=' + repr(_pc.document['correlation']), 'scan=' + repr(_pc.document['scan']), 'intent=' + repr(_pc.document['intent']), 'array=' + repr(_pc.document['array']), 'observation=' + repr(_pc.document['observation']), 'feed=' + repr(_pc.document['feed']), 'clipminmax=' + repr(_pc.document['clipminmax']), 'datacolumn=' + repr(_pc.document['datacolumn']), 'clipoutside=' + repr(_pc.document['clipoutside']), 'channelavg=' + repr(_pc.document['channelavg']), 'chanbin=' + repr(_pc.document['chanbin']), 'timeavg=' + repr(_pc.document['timeavg']), 'timebin=' + repr(_pc.document['timebin']), 'clipzeros=' + repr(_pc.document['clipzeros']), 'quackinterval=' + repr(_pc.document['quackinterval']), 'quackmode=' + repr(_pc.document['quackmode']), 'quackincrement=' + repr(_pc.document['quackincrement']), 'tolerance=' + repr(_pc.document['tolerance']), 'addantenna=' + repr(_pc.document['addantenna']), 'lowerlimit=' + repr(_pc.document['lowerlimit']), 'upperlimit=' + repr(_pc.document['upperlimit']), 'ntime=' + repr(_pc.document['ntime']), 'combinescans=' + repr(_pc.document['combinescans']), 'timecutoff=' + repr(_pc.document['timecutoff']), 'freqcutoff=' + repr(_pc.document['freqcutoff']), 'timefit=' + repr(_pc.document['timefit']), 'freqfit=' + repr(_pc.document['freqfit']), 'maxnpieces=' + repr(_pc.document['maxnpieces']), 'flagdimension=' + repr(_pc.document['flagdimension']), 'usewindowstats=' + repr(_pc.document['usewindowstats']), 'halfwin=' + repr(_pc.document['halfwin']), 'extendflags=' + repr(_pc.document['extendflags']), 'winsize=' + repr(_pc.document['winsize']), 'timedev=' + repr(_pc.document['timedev']), 'freqdev=' + repr(_pc.document['freqdev']), 'timedevscale=' + repr(_pc.document['timedevscale']), 'freqdevscale=' + repr(_pc.document['freqdevscale']), 'spectralmax=' + repr(_pc.document['spectralmax']), 'spectralmin=' + repr(_pc.document['spectralmin']), 'antint_ref_antenna=' + repr(_pc.document['antint_ref_antenna']), 'minchanfrac=' + repr(_pc.document['minchanfrac']), 'verbose=' + repr(_pc.document['verbose']), 'extendpols=' + repr(_pc.document['extendpols']), 'growtime=' + repr(_pc.document['growtime']), 'growfreq=' + repr(_pc.document['growfreq']), 'growaround=' + repr(_pc.document['growaround']), 'flagneartime=' + repr(_pc.document['flagneartime']), 'flagnearfreq=' + repr(_pc.document['flagnearfreq']), 'minrel=' + repr(_pc.document['minrel']), 'maxrel=' + repr(_pc.document['maxrel']), 'minabs=' + repr(_pc.document['minabs']), 'maxabs=' + repr(_pc.document['maxabs']), 'spwchan=' + repr(_pc.document['spwchan']), 'spwcorr=' + repr(_pc.document['spwcorr']), 'basecnt=' + repr(_pc.document['basecnt']), 'fieldcnt=' + repr(_pc.document['fieldcnt']), 'name=' + repr(_pc.document['name']), 'action=' + repr(_pc.document['action']), 'display=' + repr(_pc.document['display']), 'flagbackup=' + repr(_pc.document['flagbackup']), 'savepars=' + repr(_pc.document['savepars']), 'cmdreason=' + repr(_pc.document['cmdreason']), 'outfile=' + repr(_pc.document['outfile']), 'overwrite=' + repr(_pc.document['overwrite']), 'writeflags=' + repr(_pc.document['writeflags']) ] )
1134 task_result = None
1135 try:
1136 task_result = _flagdata_t( _pc.document['vis'], _pc.document['mode'], _pc.document['autocorr'], _pc.document['inpfile'], _pc.document['reason'], _pc.document['tbuff'], _pc.document['spw'], _pc.document['field'], _pc.document['antenna'], _pc.document['uvrange'], _pc.document['timerange'], _pc.document['correlation'], _pc.document['scan'], _pc.document['intent'], _pc.document['array'], _pc.document['observation'], _pc.document['feed'], _pc.document['clipminmax'], _pc.document['datacolumn'], _pc.document['clipoutside'], _pc.document['channelavg'], _pc.document['chanbin'], _pc.document['timeavg'], _pc.document['timebin'], _pc.document['clipzeros'], _pc.document['quackinterval'], _pc.document['quackmode'], _pc.document['quackincrement'], _pc.document['tolerance'], _pc.document['addantenna'], _pc.document['lowerlimit'], _pc.document['upperlimit'], _pc.document['ntime'], _pc.document['combinescans'], _pc.document['timecutoff'], _pc.document['freqcutoff'], _pc.document['timefit'], _pc.document['freqfit'], _pc.document['maxnpieces'], _pc.document['flagdimension'], _pc.document['usewindowstats'], _pc.document['halfwin'], _pc.document['extendflags'], _pc.document['winsize'], _pc.document['timedev'], _pc.document['freqdev'], _pc.document['timedevscale'], _pc.document['freqdevscale'], _pc.document['spectralmax'], _pc.document['spectralmin'], _pc.document['antint_ref_antenna'], _pc.document['minchanfrac'], _pc.document['verbose'], _pc.document['extendpols'], _pc.document['growtime'], _pc.document['growfreq'], _pc.document['growaround'], _pc.document['flagneartime'], _pc.document['flagnearfreq'], _pc.document['minrel'], _pc.document['maxrel'], _pc.document['minabs'], _pc.document['maxabs'], _pc.document['spwchan'], _pc.document['spwcorr'], _pc.document['basecnt'], _pc.document['fieldcnt'], _pc.document['name'], _pc.document['action'], _pc.document['display'], _pc.document['flagbackup'], _pc.document['savepars'], _pc.document['cmdreason'], _pc.document['outfile'], _pc.document['overwrite'], _pc.document['writeflags'] )
1137 except Exception as exc:
1138 _except_log('flagdata', exc)
1139 raise
1140 finally:
1141 task_result = _end_log( _logging_state_, 'flagdata', task_result )
1142 return task_result
1144flagdata = _flagdata( )