Source
raise RuntimeError( 'There are no unapplied flags in the input. Set useapplied=True to also use the previously-applied flags.' )
import os
import copy
import numpy as np
from collections import defaultdict
from casatasks import casalog
from casatools import ms, quanta, table, agentflagger
from .mstools import write_history
from . import flaghelper as fh
qalocal = quanta( )
tblocal = table( )
def flagcmd(
vis=None,
inpmode=None,
inpfile=None,
tablerows=None,
reason=None,
useapplied=None,
tbuff=None,
ants=None,
action=None,
flagbackup=None,
clearall=None,
rowlist=None,
plotfile=None,
savepars=None,
outfile=None,
overwrite=None
):
#
# Task flagcmd
# Reads flag commands from file or string and applies to MS
try:
from xml.dom import minidom
except Exception as exc:
raise ImportError('Failed to load xml.dom.minidom into python: {}'.format(exc))
casalog.origin('flagcmd')
aflocal = agentflagger()
mslocal = ms()
mslocal2 = ms()
try:
# Use a default ntime to open the MS. The user-set ntime will be
# used in the tool later
ntime = 0.0
# Open the MS and attach it to the tool
if (type(vis) == str) & os.path.exists(vis):
aflocal.open(vis, ntime)
else:
raise ValueError( 'Visibility data set not found - please verify the name' )
# Check if vis is a cal table:
# typevis = 1 --> cal table
# typevis = 0 --> MS
# typevis = 2 --> MMS
iscal = False