##################### generated by xml-casa (v2) from hif_rawflagchans.xml ##########
##################### 0a87bc6fdba43976ea8efb50c3ea7a84 ##############################
from __future__ import absolute_import
from casashell.private.stack_manip import find_local as __sf__
from casashell.private.stack_manip import find_frame as _find_frame
from casatools.typecheck import validator as _pc
from casatools.coercetype import coerce as _coerce
from pipeline.hif.cli import hif_rawflagchans as _hif_rawflagchans_t
from collections import OrderedDict
import numpy
import sys
import os
import shutil
[docs]def static_var(varname, value):
def decorate(func):
setattr(func, varname, value)
return func
return decorate
class _hif_rawflagchans:
"""
hif_rawflagchans ---- Flag deviant baseline/channels in raw data
hif_rawflagchans flags deviant baseline/channels in the raw data.
The flagging views used are derived from the raw data for the specified
intent - default is BANDPASS.
Bad baseline/channels are flagged for all intents, not just the
one that is the basis of the flagging views.
For each spectral window the flagging view is a 2d image with axes
'channel' and 'baseline'. The pixel for each channel, baseline is the
time average of the underlying unflagged raw data.
The baseline axis is labeled by numbers of form id1.id2 where id1 and id2
are the IDs of the baseline antennas. Both id1 and id2 run over all
antenna IDs in the observation. This means that each baseline is shown
twice but has the benefit that 'bad' antennas are easily identified by
eye.
Three flagging methods are available:
If parameter flag_hilo is set True then outliers from the median
of each flagging view will be flagged.
If parameter flag_bad_quadrant is set True then a simple 2 part
test is used to check for bad antenna quadrants and/or bad baseline
quadrants. Here a 'quadrant' is defined simply as one quarter of the
channel axis. The first part of the test is to note as 'suspect' those
points further from the view median than fbq_hilo_limit * MAD.
The second part is to flag entire antenna/quadrants if their
fraction of suspect points exceeds fbq_antenna_frac_limit.
Failing that, entire baseline/quadrants may be flagged if their
fraction of suspect points exceeds fbq_baseline_frac_limit.
Suspect points are not flagged unless as part of a bad antenna or
baseline quadrant.
Output
results -- If pipeline mode is 'getinputs' then None is returned. Otherwise
the results object for the pipeline task is returned.
--------- parameter descriptions ---------------------------------------------
vis List of input MeasurementSets.
default: [] - Use the MeasurementSets currently known to the pipeline
context.
spw The list of spectral windows and channels to which the calibration
will be applied. Defaults to all science windows in the pipeline
context.
example: spw='17', spw='11, 15'
intent A string containing the list of intents to be checked for antennas
with deviant gains. The default is blank, which causes the task to select
the 'BANDPASS' intent.
example: intent='*BANDPASS*'
flag_hilo True to flag channel/baseline data further from the view
median than fhl_limit * MAD.
fhl_limit If flag_hilo is True then flag channel/baseline data
further from the view median than fhl_limit * MAD.
fhl_minsample Do no flagging if the view median and MAD are derived
from fewer than fhl_minsample view pixels.
flag_bad_quadrant True to search for and flag bad antenna quadrants
and baseline quadrants. Here a /'quadrant/' is one
quarter of the channel axis.
fbq_hilo_limit If flag_bad_quadrant is True then channel/baselines further
from the view median than fbq_hilo_limit * MAD will be noted as
'suspect'. If there are enough of them to indicate that an antenna or
baseline quadrant is bad then all channel/baselines in that quadrant will
be flagged.
fbq_antenna_frac_limit If flag_bad_quadrant is True and the fraction of
suspect channel/baselines in a particular antenna/quadrant exceeds
fbq_antenna_frac_limit then all data for that antenna/quadrant will
be flagged.
fbq_baseline_frac_limit If flag_bad_quadrant is True and the fraction of
suspect channel/baselines in a particular baseline/quadrant exceeds
fbq_baseline_frac_limit then all data for that baseline/quadrant will
be flagged.
pipelinemode e operating mode. In 'automatic' mode the pipeline
determines the values of all context defined pipeline inputs automatically.
In interactive mode the user can set the pipeline context defined
parameters manually. In 'getinputs' mode the user can check the settings of
all pipeline parameters without running the task.
dryrun Run the commands (True) or generate the commands to be run but
do not execute (False).
acceptresults This parameter has no effect. The Tsyscal file is already
in the pipeline context and is flagged in situ.
--------- examples -----------------------------------------------------------
1. Flag bad quadrants and wild outliers, default method:
hif_rawflagchans()
equivalent to:
hif_rawflagchans(flag_hilo=True, fhl_limit=20,
flag_bad_quadrant=True, fbq_hilo_limit=8,
fbq_antenna_frac_limit=0.2, fbq_baseline_frac_limit=1.0)
"""
_info_group_ = """pipeline"""
_info_desc_ = """Flag deviant baseline/channels in raw data"""
__schema = {'vis': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'spw': {'type': 'cStr', 'coerce': _coerce.to_str}, 'intent': {'type': 'cStr', 'coerce': _coerce.to_str}, 'flag_hilo': {'type': 'cBool'}, 'fhl_limit': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'fhl_minsample': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'flag_bad_quadrant': {'type': 'cBool'}, 'fbq_hilo_limit': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'fbq_antenna_frac_limit': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'fbq_baseline_frac_limit': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'pipelinemode': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'automatic', 'interactive', 'getinputs' ]}, 'dryrun': {'type': 'cBool'}, 'acceptresults': {'type': 'cBool'}}
def __init__(self):
self.__stdout = None
self.__stderr = None
self.__root_frame_ = None
def __globals_(self):
if self.__root_frame_ is None:
self.__root_frame_ = _find_frame( )
assert self.__root_frame_ is not None, "could not find CASAshell global frame"
return self.__root_frame_
def __to_string_(self,value):
if type(value) is str:
return "'%s'" % value
else:
return str(value)
def __validate_(self,doc,schema):
return _pc.validate(doc,schema)
def __do_inp_output(self,param_prefix,description_str,formatting_chars):
out = self.__stdout or sys.stdout
description = description_str.split( )
prefix_width = 23 + 26 + 4
output = [ ]
addon = ''
first_addon = True
while len(description) > 0:
## starting a new line.....................................................................
if len(output) == 0:
## for first line add parameter information............................................
if len(param_prefix)-formatting_chars > prefix_width - 1:
output.append(param_prefix)
continue
addon = param_prefix + ' #'
first_addon = True
addon_formatting = formatting_chars
else:
## for subsequent lines space over prefix width........................................
addon = (' ' * prefix_width) + '#'
first_addon = False
addon_formatting = 0
## if first word of description puts us over the screen width, bail........................
if len(addon + description[0]) - addon_formatting + 1 > self.term_width:
## if we're doing the first line make sure it's output.................................
if first_addon: output.append(addon)
break
while len(description) > 0:
## if the next description word puts us over break for the next line...................
if len(addon + description[0]) - addon_formatting + 1 > self.term_width: break
addon = addon + ' ' + description[0]
description.pop(0)
output.append(addon)
out.write('\n'.join(output) + '\n')
#--------- return nonsubparam values ----------------------------------------------
def __flag_bad_quadrant_dflt( self, glb ):
return True
def __flag_bad_quadrant( self, glb ):
if 'flag_bad_quadrant' in glb: return glb['flag_bad_quadrant']
return True
def __flag_hilo_dflt( self, glb ):
return True
def __flag_hilo( self, glb ):
if 'flag_hilo' in glb: return glb['flag_hilo']
return True
def __pipelinemode_dflt( self, glb ):
return 'automatic'
def __pipelinemode( self, glb ):
if 'pipelinemode' in glb: return glb['pipelinemode']
return 'automatic'
#--------- return inp/go default --------------------------------------------------
def __dryrun_dflt( self, glb ):
if self.__pipelinemode( glb ) == "interactive": return bool(False)
return None
def __fbq_baseline_frac_limit_dflt( self, glb ):
if self.__flag_bad_quadrant( glb ) == bool(True): return float(1.0)
return None
def __fbq_antenna_frac_limit_dflt( self, glb ):
if self.__flag_bad_quadrant( glb ) == bool(True): return float(0.2)
return None
def __intent_dflt( self, glb ):
if self.__pipelinemode( glb ) == "interactive": return ""
if self.__pipelinemode( glb ) == "getinputs": return ""
return None
def __fbq_hilo_limit_dflt( self, glb ):
if self.__flag_bad_quadrant( glb ) == bool(True): return float(8.0)
return None
def __vis_dflt( self, glb ):
if self.__pipelinemode( glb ) == "interactive": return []
if self.__pipelinemode( glb ) == "getinputs": return []
return None
def __acceptresults_dflt( self, glb ):
if self.__pipelinemode( glb ) == "interactive": return bool(True)
return None
def __fhl_limit_dflt( self, glb ):
if self.__flag_hilo( glb ) == bool(True): return float(20.0)
return None
def __spw_dflt( self, glb ):
if self.__pipelinemode( glb ) == "interactive": return ""
if self.__pipelinemode( glb ) == "getinputs": return ""
return None
def __fhl_minsample_dflt( self, glb ):
if self.__flag_hilo( glb ) == bool(True): return float(5)
return None
#--------- return subparam values -------------------------------------------------
def __vis( self, glb ):
if 'vis' in glb: return glb['vis']
dflt = self.__vis_dflt( glb )
if dflt is not None: return dflt
return [ ]
def __spw( self, glb ):
if 'spw' in glb: return glb['spw']
dflt = self.__spw_dflt( glb )
if dflt is not None: return dflt
return ''
def __intent( self, glb ):
if 'intent' in glb: return glb['intent']
dflt = self.__intent_dflt( glb )
if dflt is not None: return dflt
return ''
def __fhl_limit( self, glb ):
if 'fhl_limit' in glb: return glb['fhl_limit']
dflt = self.__fhl_limit_dflt( glb )
if dflt is not None: return dflt
return float(20.0)
def __fhl_minsample( self, glb ):
if 'fhl_minsample' in glb: return glb['fhl_minsample']
dflt = self.__fhl_minsample_dflt( glb )
if dflt is not None: return dflt
return float(5)
def __fbq_hilo_limit( self, glb ):
if 'fbq_hilo_limit' in glb: return glb['fbq_hilo_limit']
dflt = self.__fbq_hilo_limit_dflt( glb )
if dflt is not None: return dflt
return float(8.0)
def __fbq_antenna_frac_limit( self, glb ):
if 'fbq_antenna_frac_limit' in glb: return glb['fbq_antenna_frac_limit']
dflt = self.__fbq_antenna_frac_limit_dflt( glb )
if dflt is not None: return dflt
return float(0.2)
def __fbq_baseline_frac_limit( self, glb ):
if 'fbq_baseline_frac_limit' in glb: return glb['fbq_baseline_frac_limit']
dflt = self.__fbq_baseline_frac_limit_dflt( glb )
if dflt is not None: return dflt
return float(1.0)
def __dryrun( self, glb ):
if 'dryrun' in glb: return glb['dryrun']
dflt = self.__dryrun_dflt( glb )
if dflt is not None: return dflt
return False
def __acceptresults( self, glb ):
if 'acceptresults' in glb: return glb['acceptresults']
dflt = self.__acceptresults_dflt( glb )
if dflt is not None: return dflt
return True
#--------- subparam inp output ----------------------------------------------------
def __vis_inp(self):
if self.__vis_dflt( self.__globals_( ) ) is not None:
description = 'List of input MeasurementSets'
value = self.__vis( self.__globals_( ) )
(pre,post) = ('','') if self.__validate_({'vis': value},{'vis': self.__schema['vis']}) else ('\x1B[91m','\x1B[0m')
self.__do_inp_output(' \x1B[92m%-23.23s =\x1B[0m %s%-23s%s' % ('vis',pre,self.__to_string_(value),post),description,9+len(pre)+len(post))
def __spw_inp(self):
if self.__spw_dflt( self.__globals_( ) ) is not None:
description = 'Set of data selection spectral windows, \'\' for all'
value = self.__spw( self.__globals_( ) )
(pre,post) = ('','') if self.__validate_({'spw': value},{'spw': self.__schema['spw']}) else ('\x1B[91m','\x1B[0m')
self.__do_inp_output(' \x1B[92m%-23.23s =\x1B[0m %s%-23s%s' % ('spw',pre,self.__to_string_(value),post),description,9+len(pre)+len(post))
def __intent_inp(self):
if self.__intent_dflt( self.__globals_( ) ) is not None:
description = 'Data intent to use in creating flagging view'
value = self.__intent( self.__globals_( ) )
(pre,post) = ('','') if self.__validate_({'intent': value},{'intent': self.__schema['intent']}) else ('\x1B[91m','\x1B[0m')
self.__do_inp_output(' \x1B[92m%-23.23s =\x1B[0m %s%-23s%s' % ('intent',pre,self.__to_string_(value),post),description,9+len(pre)+len(post))
def __flag_hilo_inp(self):
description = 'True to flag outlier baseline/channels'
value = self.__flag_hilo( self.__globals_( ) )
(pre,post) = ('','') if self.__validate_({'flag_hilo': value},{'flag_hilo': self.__schema['flag_hilo']}) else ('\x1B[91m','\x1B[0m')
self.__do_inp_output('\x1B[1m\x1B[47m%-26.26s =\x1B[0m %s%-23s%s' % ('flag_hilo',pre,self.__to_string_(value),post),description,13+len(pre)+len(post))
def __fhl_limit_inp(self):
if self.__fhl_limit_dflt( self.__globals_( ) ) is not None:
description = 'Flag baseline/channels further from median than limit * MAD'
value = self.__fhl_limit( self.__globals_( ) )
(pre,post) = ('','') if self.__validate_({'fhl_limit': value},{'fhl_limit': self.__schema['fhl_limit']}) else ('\x1B[91m','\x1B[0m')
self.__do_inp_output(' \x1B[92m%-23.23s =\x1B[0m %s%-23s%s' % ('fhl_limit',pre,self.__to_string_(value),post),description,9+len(pre)+len(post))
def __fhl_minsample_inp(self):
if self.__fhl_minsample_dflt( self.__globals_( ) ) is not None:
description = 'Minimum number of points in sample'
value = self.__fhl_minsample( self.__globals_( ) )
(pre,post) = ('','') if self.__validate_({'fhl_minsample': value},{'fhl_minsample': self.__schema['fhl_minsample']}) else ('\x1B[91m','\x1B[0m')
self.__do_inp_output(' \x1B[92m%-23.23s =\x1B[0m %s%-23s%s' % ('fhl_minsample',pre,self.__to_string_(value),post),description,9+len(pre)+len(post))
def __flag_bad_quadrant_inp(self):
description = 'True to flag bad quadrants in antennas'
value = self.__flag_bad_quadrant( self.__globals_( ) )
(pre,post) = ('','') if self.__validate_({'flag_bad_quadrant': value},{'flag_bad_quadrant': self.__schema['flag_bad_quadrant']}) else ('\x1B[91m','\x1B[0m')
self.__do_inp_output('\x1B[1m\x1B[47m%-26.26s =\x1B[0m %s%-23s%s' % ('flag_bad_quadrant',pre,self.__to_string_(value),post),description,13+len(pre)+len(post))
def __fbq_hilo_limit_inp(self):
if self.__fbq_hilo_limit_dflt( self.__globals_( ) ) is not None:
description = 'Note as \'suspect\' baseline/channels further from median than limit * MAD'
value = self.__fbq_hilo_limit( self.__globals_( ) )
(pre,post) = ('','') if self.__validate_({'fbq_hilo_limit': value},{'fbq_hilo_limit': self.__schema['fbq_hilo_limit']}) else ('\x1B[91m','\x1B[0m')
self.__do_inp_output(' \x1B[92m%-23.23s =\x1B[0m %s%-23s%s' % ('fbq_hilo_limit',pre,self.__to_string_(value),post),description,9+len(pre)+len(post))
def __fbq_antenna_frac_limit_inp(self):
if self.__fbq_antenna_frac_limit_dflt( self.__globals_( ) ) is not None:
description = 'Flag antenna quadrant if its fraction of \'suspect\' baseline/channels > limit'
value = self.__fbq_antenna_frac_limit( self.__globals_( ) )
(pre,post) = ('','') if self.__validate_({'fbq_antenna_frac_limit': value},{'fbq_antenna_frac_limit': self.__schema['fbq_antenna_frac_limit']}) else ('\x1B[91m','\x1B[0m')
self.__do_inp_output(' \x1B[92m%-23.23s =\x1B[0m %s%-23s%s' % ('fbq_antenna_frac_limit',pre,self.__to_string_(value),post),description,9+len(pre)+len(post))
def __fbq_baseline_frac_limit_inp(self):
if self.__fbq_baseline_frac_limit_dflt( self.__globals_( ) ) is not None:
description = 'Flag baseline quadrant if its fraction of \'suspect\' baseline/channels > limit'
value = self.__fbq_baseline_frac_limit( self.__globals_( ) )
(pre,post) = ('','') if self.__validate_({'fbq_baseline_frac_limit': value},{'fbq_baseline_frac_limit': self.__schema['fbq_baseline_frac_limit']}) else ('\x1B[91m','\x1B[0m')
self.__do_inp_output(' \x1B[92m%-23.23s =\x1B[0m %s%-23s%s' % ('fbq_baseline_frac_limit',pre,self.__to_string_(value),post),description,9+len(pre)+len(post))
def __pipelinemode_inp(self):
description = 'The pipeline operations mode'
value = self.__pipelinemode( self.__globals_( ) )
(pre,post) = ('','') if self.__validate_({'pipelinemode': value},{'pipelinemode': self.__schema['pipelinemode']}) else ('\x1B[91m','\x1B[0m')
self.__do_inp_output('\x1B[1m\x1B[47m%-26.26s =\x1B[0m %s%-23s%s' % ('pipelinemode',pre,self.__to_string_(value),post),description,13+len(pre)+len(post))
def __dryrun_inp(self):
if self.__dryrun_dflt( self.__globals_( ) ) is not None:
description = 'Run the task (False) or list commands (True)'
value = self.__dryrun( self.__globals_( ) )
(pre,post) = ('','') if self.__validate_({'dryrun': value},{'dryrun': self.__schema['dryrun']}) else ('\x1B[91m','\x1B[0m')
self.__do_inp_output(' \x1B[92m%-23.23s =\x1B[0m %s%-23s%s' % ('dryrun',pre,self.__to_string_(value),post),description,9+len(pre)+len(post))
def __acceptresults_inp(self):
if self.__acceptresults_dflt( self.__globals_( ) ) is not None:
description = 'Automatically apply results to context'
value = self.__acceptresults( self.__globals_( ) )
(pre,post) = ('','') if self.__validate_({'acceptresults': value},{'acceptresults': self.__schema['acceptresults']}) else ('\x1B[91m','\x1B[0m')
self.__do_inp_output(' \x1B[92m%-23.23s =\x1B[0m %s%-23s%s' % ('acceptresults',pre,self.__to_string_(value),post),description,9+len(pre)+len(post))
#--------- global default implementation-------------------------------------------
@static_var('state', __sf__('casa_inp_go_state'))
def set_global_defaults(self):
self.set_global_defaults.state['last'] = self
glb = self.__globals_( )
if 'dryrun' in glb: del glb['dryrun']
if 'flag_bad_quadrant' in glb: del glb['flag_bad_quadrant']
if 'fbq_baseline_frac_limit' in glb: del glb['fbq_baseline_frac_limit']
if 'fbq_antenna_frac_limit' in glb: del glb['fbq_antenna_frac_limit']
if 'pipelinemode' in glb: del glb['pipelinemode']
if 'intent' in glb: del glb['intent']
if 'flag_hilo' in glb: del glb['flag_hilo']
if 'fbq_hilo_limit' in glb: del glb['fbq_hilo_limit']
if 'vis' in glb: del glb['vis']
if 'acceptresults' in glb: del glb['acceptresults']
if 'fhl_limit' in glb: del glb['fhl_limit']
if 'spw' in glb: del glb['spw']
if 'fhl_minsample' in glb: del glb['fhl_minsample']
#--------- inp function -----------------------------------------------------------
def inp(self):
print("# hif_rawflagchans -- %s" % self._info_desc_)
self.term_width, self.term_height = shutil.get_terminal_size(fallback=(80, 24))
self.__vis_inp( )
self.__spw_inp( )
self.__intent_inp( )
self.__flag_hilo_inp( )
self.__fhl_limit_inp( )
self.__fhl_minsample_inp( )
self.__flag_bad_quadrant_inp( )
self.__fbq_hilo_limit_inp( )
self.__fbq_antenna_frac_limit_inp( )
self.__fbq_baseline_frac_limit_inp( )
self.__pipelinemode_inp( )
self.__dryrun_inp( )
self.__acceptresults_inp( )
#--------- tget function ----------------------------------------------------------
@static_var('state', __sf__('casa_inp_go_state'))
def tget(self,file=None):
from casashell.private.stack_manip import find_frame
from runpy import run_path
filename = None
if file is None:
if os.path.isfile("hif_rawflagchans.last"):
filename = "hif_rawflagchans.last"
elif isinstance(file, str):
if os.path.isfile(file):
filename = file
if filename is not None:
glob = find_frame( )
newglob = run_path( filename, init_globals={ } )
for i in newglob:
glob[i] = newglob[i]
self.tget.state['last'] = self
else:
print("could not find last file, setting defaults instead...")
self.set_global_defaults( )
def __call__( self, vis=None, spw=None, intent=None, flag_hilo=None, fhl_limit=None, fhl_minsample=None, flag_bad_quadrant=None, fbq_hilo_limit=None, fbq_antenna_frac_limit=None, fbq_baseline_frac_limit=None, pipelinemode=None, dryrun=None, acceptresults=None ):
def noobj(s):
if s.startswith('<') and s.endswith('>'):
return "None"
else:
return s
_prefile = os.path.realpath('hif_rawflagchans.pre')
_postfile = os.path.realpath('hif_rawflagchans.last')
_return_result_ = None
_arguments = [vis,spw,intent,flag_hilo,fhl_limit,fhl_minsample,flag_bad_quadrant,fbq_hilo_limit,fbq_antenna_frac_limit,fbq_baseline_frac_limit,pipelinemode,dryrun,acceptresults]
_invocation_parameters = OrderedDict( )
if any(map(lambda x: x is not None,_arguments)):
# invoke python style
# set the non sub-parameters that are not None
local_global = { }
if flag_hilo is not None: local_global['flag_hilo'] = flag_hilo
if flag_bad_quadrant is not None: local_global['flag_bad_quadrant'] = flag_bad_quadrant
if pipelinemode is not None: local_global['pipelinemode'] = pipelinemode
# the invocation parameters for the non-subparameters can now be set - this picks up those defaults
_invocation_parameters['flag_hilo'] = self.__flag_hilo( local_global )
_invocation_parameters['flag_bad_quadrant'] = self.__flag_bad_quadrant( local_global )
_invocation_parameters['pipelinemode'] = self.__pipelinemode( local_global )
# the sub-parameters can then be set. Use the supplied value if not None, else the function, which gets the appropriate default
_invocation_parameters['vis'] = self.__vis( _invocation_parameters ) if vis is None else vis
_invocation_parameters['spw'] = self.__spw( _invocation_parameters ) if spw is None else spw
_invocation_parameters['intent'] = self.__intent( _invocation_parameters ) if intent is None else intent
_invocation_parameters['fhl_limit'] = self.__fhl_limit( _invocation_parameters ) if fhl_limit is None else fhl_limit
_invocation_parameters['fhl_minsample'] = self.__fhl_minsample( _invocation_parameters ) if fhl_minsample is None else fhl_minsample
_invocation_parameters['fbq_hilo_limit'] = self.__fbq_hilo_limit( _invocation_parameters ) if fbq_hilo_limit is None else fbq_hilo_limit
_invocation_parameters['fbq_antenna_frac_limit'] = self.__fbq_antenna_frac_limit( _invocation_parameters ) if fbq_antenna_frac_limit is None else fbq_antenna_frac_limit
_invocation_parameters['fbq_baseline_frac_limit'] = self.__fbq_baseline_frac_limit( _invocation_parameters ) if fbq_baseline_frac_limit is None else fbq_baseline_frac_limit
_invocation_parameters['dryrun'] = self.__dryrun( _invocation_parameters ) if dryrun is None else dryrun
_invocation_parameters['acceptresults'] = self.__acceptresults( _invocation_parameters ) if acceptresults is None else acceptresults
else:
# invoke with inp/go semantics
_invocation_parameters['vis'] = self.__vis( self.__globals_( ) )
_invocation_parameters['spw'] = self.__spw( self.__globals_( ) )
_invocation_parameters['intent'] = self.__intent( self.__globals_( ) )
_invocation_parameters['flag_hilo'] = self.__flag_hilo( self.__globals_( ) )
_invocation_parameters['fhl_limit'] = self.__fhl_limit( self.__globals_( ) )
_invocation_parameters['fhl_minsample'] = self.__fhl_minsample( self.__globals_( ) )
_invocation_parameters['flag_bad_quadrant'] = self.__flag_bad_quadrant( self.__globals_( ) )
_invocation_parameters['fbq_hilo_limit'] = self.__fbq_hilo_limit( self.__globals_( ) )
_invocation_parameters['fbq_antenna_frac_limit'] = self.__fbq_antenna_frac_limit( self.__globals_( ) )
_invocation_parameters['fbq_baseline_frac_limit'] = self.__fbq_baseline_frac_limit( self.__globals_( ) )
_invocation_parameters['pipelinemode'] = self.__pipelinemode( self.__globals_( ) )
_invocation_parameters['dryrun'] = self.__dryrun( self.__globals_( ) )
_invocation_parameters['acceptresults'] = self.__acceptresults( self.__globals_( ) )
try:
with open(_prefile,'w') as _f:
for _i in _invocation_parameters:
_f.write("%-23s = %s\n" % (_i,noobj(repr(_invocation_parameters[_i]))))
_f.write("#hif_rawflagchans( ")
count = 0
for _i in _invocation_parameters:
_f.write("%s=%s" % (_i,noobj(repr(_invocation_parameters[_i]))))
count += 1
if count < len(_invocation_parameters): _f.write(",")
_f.write(" )\n")
except: pass
try:
_return_result_ = _hif_rawflagchans_t( _invocation_parameters['vis'],_invocation_parameters['spw'],_invocation_parameters['intent'],_invocation_parameters['flag_hilo'],_invocation_parameters['fhl_limit'],_invocation_parameters['fhl_minsample'],_invocation_parameters['flag_bad_quadrant'],_invocation_parameters['fbq_hilo_limit'],_invocation_parameters['fbq_antenna_frac_limit'],_invocation_parameters['fbq_baseline_frac_limit'],_invocation_parameters['pipelinemode'],_invocation_parameters['dryrun'],_invocation_parameters['acceptresults'] )
except Exception as e:
from traceback import format_exc
from casatasks import casalog
casalog.origin('hif_rawflagchans')
casalog.post("Exception Reported: Error in hif_rawflagchans: %s" % str(e),'SEVERE')
casalog.post(format_exc( ))
_return_result_ = False
try:
os.rename(_prefile,_postfile)
except: pass
return _return_result_
hif_rawflagchans = _hif_rawflagchans( )