def browsetable(tablename=None, mightedit=None,
sortlist=None, taql=None, skipcols=None):
""" Browse a table (visibility data set, calibration table, or image):
Brings up a GUI browser that can open and display any CASA table.
tablename -- Name of table directory on disk (MS, cal. table, image)
default: none; example: tablename='ngc5921.ms'
mightedit -- If True disable the filtering options (below) and allow
editing the table. Warning: the GUI appears to ignore
whether the table tool is opened read-only - just be
aware that you should not edit filtered tables unless
you know what you are doing.
sortlist -- List of columns to sort by.
taql -- TaQL query string for prefiltering the table.
default: '' (none); example: taql='ANTENNA2 < 6'
skipcols -- Columns to NOT display.
default: [] (none); example: skipcols='feed1, feed2'
casalog.origin('browsetable')
if type(tablename) == str:
mightfilter = sortlist or taql or skipcols
if os.path.exists(tablename):
t.open(tablename, nomodify=not mightedit)
if not tablename or mightedit or not mightfilter:
if type(skipcols) == str:
skipcols = re.split(r',?\s+', skipcols)
if c.upper() in colnames:
colnames.remove(c.upper())
if type(sortlist) == list:
sortlist = ', '.join(sortlist)
if not os.path.isdir(tempdir):
ftname = tempfile.mkdtemp(prefix=tablename + '_filtered_', dir=tempdir)
casalog.post('Using ' + ftname + ' as the filtered table.')
ft = t.query(taql, ftname, sortlist=sortlist.upper(),
columns=', '.join(colnames))