Source
newtimedev,newfreqdev = writeRFlagThresholdFile(rflag_thresholds, rflagpars['timedev'], rflagpars['freqdev'], rflagid)
from __future__ import absolute_import
import os
import time
import ast
import copy
import numpy
from collections import deque,defaultdict
# get is_CASA6 and is_python3
from casatasks.private.casa_transition import *
if is_CASA6:
import inspect
from casatasks import casalog
from casatools import table,quanta,ms,agentflagger
from .parallel.parallel_task_helper import ParallelTaskHelper
from collections import OrderedDict
###some helper tools
tblocal = table()
mslocal = ms()
qalocal = quanta()
# this can be removed and agentflagger used directly when CASA5 is retired
agentflagger_fn = agentflagger
else:
from taskinit import casalog, tbtool, qa, ms, aftool
from parallel.parallel_task_helper import ParallelTaskHelper
# needed in Python 2.6
from OrderedDictionary import OrderedDict
###some helper tools
tblocal = tbtool()
# and to make the code read the same in both CASA versions
qalocal = qa
mslocal = ms
agentflagger_fn = aftool
# common function to use to get a dictionary item iterator
if is_python3:
def lociteritems(adict):
return adict.items()
else:
def lociteritems(adict):
return adict.iteritems()
'''
A set of helper functions for the tasks flagdata and flagcmd.
Class Parser: to parse flag commands
I/O functions:
get_flag_cmd_list
readFile
readFiles
readAndParse
parseDictionary
parseXML
readAntennaList
writeAntennaList
writeFlagCommands
writeRflagThresholdFile
Parameter handling
compressSelectionList
evalParams
selectReason
parseSelectionPars
parseUnion
purgeEmptyPars
purgeParameter
parseAgents
Others
backupFlags
convertDictToString
convertStringToDict
extractAntennaInfo
save_rflag_consolidated_files
parseRflagOutputFromSummary
'''
debug = False
if is_CASA6:
def get_task_arg_default( func, arg ):
spec = inspect.getargspec(func.__call__)
if arg not in spec.args:
raise Exception("cannot find '%s' among the function arguments" % arg)
return spec.defaults[spec.args.index(arg)-1]