In def wtstat, I believe that there needs to be a line ms.selectinit(reset=True) inside the loop over several spectral windows. Otherwise, anytime I have a dataset with several spectral windows, I get an error
2018-09-03 13:04:31 WARN ms::selectinit selectinit failed for datadescid 1
# Define stat outputs
# -------------------
def wtstat(mslist,comment=''):
print "%-4s%18s %4s %4s %4s %8s %8s %12s %12s %12s %12s" \
% (comment,'name','spw#','npnt','npol','nvis',\
'fwidth','min','max','mean','std')
for ims in mslist:
ms.open(ims,nomodify=True) # open MS
**ms.selectinit(reset=True) # all spws**
spwinfo= ms.getspectralwindowinfo() # get spw info
spwlist= spwinfo.keys() # list of SPWs
for ispw in spwlist: # get SPW info and WEIGHT
**ms.selectinit(reset=True) # all spws**
spwid = spwinfo[ispw]['SpectralWindowId']
numchan = spwinfo[ispw]['NumChan']
chan1freq = spwinfo[ispw]['Chan1Freq'] / 1.0e9 # GHz
chanwidth = spwinfo[ispw]['ChanWidth'] / 1.0e9 # GHz
In def wtstat, I believe that there needs to be a line ms.selectinit(reset=True) inside the loop over several spectral windows. Otherwise, anytime I have a dataset with several spectral windows, I get an error
2018-09-03 13:04:31 WARN ms::selectinit selectinit failed for datadescid 1