def get_ms (): global ms; global msname; if not ms: ms = Owlcat.table(msname); return ms;
import numpy import numpy.ma import Owlcat.Flagger from Owlcat.Flagger import Flagger # now, skip most of the actions below if we're in statonly mode and exporting if not (statonly and options.export): # create flagger object flagger = Flagger(msname, verbose=options.verbose, timestamps=options.timestamps, chunksize=options.chunk_size) # # -l/--list: list MS info # if options.list: ms = get_ms() ants = Owlcat.table(ms.getkeyword('ANTENNA')).getcol('NAME') ddid_tab = Owlcat.table(ms.getkeyword('DATA_DESCRIPTION')) spwids = ddid_tab.getcol('SPECTRAL_WINDOW_ID') polids = ddid_tab.getcol('POLARIZATION_ID') corrs = Owlcat.table(ms.getkeyword('POLARIZATION')).getcol('CORR_TYPE') spw_tab = Owlcat.table(ms.getkeyword('SPECTRAL_WINDOW')) ref_freq = spw_tab.getcol('REF_FREQUENCY') nchan = spw_tab.getcol('NUM_CHAN') fields = Owlcat.table(ms.getkeyword('FIELD')).getcol('NAME') print("===> MS is %s" % msname) print(" %d antennas: %s" % (len(ants), " ".join(ants))) print(" %d DATA_DESC_ID(s): " % len(spwids)) for i, (spw, pol) in enumerate(zip(spwids, polids)): print(" %d: %.3f MHz, %d chans x %d correlations" % ( i, ref_freq[spw] * 1e-6, nchan[spw], len(corrs[pol, :])))
if len([opt for opt in allopt if opt == what]) > 1: parser.error("Conflicting --page/--stack/--average options for '%s'.") # get figsize try: w, h = list(map(int, options.figsize.split('x', 1))) figsize = (w * 10, h * 10) except: parser.error("Invalid --size setting '%s'" % options.figsize) # get MS name if not args: parser.error("MS not specified. Use '-h' for help.") msname = args[0] print("===> Attaching to MS %s" % msname) ms = Owlcat.table(msname) # get flagmask, use a Flagger for this import Owlcat.Flagger from Owlcat.Flagger import Flagger if options.flagmask == "0": flagmask = 0 print("===> Flagmask 0, ignoring all flags") elif options.flagmask is not None: flagger = Flagger(msname) flagmask = flagger.lookup_flagmask(options.flagmask) flagger.close() flagger = None print("===> Flagmask is %s (you specified '%s')" % (Flagger.flagmaskstr(flagmask), options.flagmask)) if not flagmask & Flagger.LEGACY:
from Owlcat.Flagger import Flagger # now, skip most of the actions below if we're in statonly mode and exporting if not (statonly and options.export): # create flagger object flagger = Flagger(msname, verbose=options.verbose, timestamps=options.timestamps, chunksize=options.chunk_size) # # -l/--list: list MS info # if options.list: ms = get_ms() ants = Owlcat.table(ms.getkeyword('ANTENNA')).getcol('NAME') ddid_tab = Owlcat.table(ms.getkeyword('DATA_DESCRIPTION')) spwids = ddid_tab.getcol('SPECTRAL_WINDOW_ID') polids = ddid_tab.getcol('POLARIZATION_ID') corrs = Owlcat.table( ms.getkeyword('POLARIZATION')).getcol('CORR_TYPE') spw_tab = Owlcat.table(ms.getkeyword('SPECTRAL_WINDOW')) ref_freq = spw_tab.getcol('REF_FREQUENCY') nchan = spw_tab.getcol('NUM_CHAN') fields = Owlcat.table(ms.getkeyword('FIELD')).getcol('NAME') print "===> MS is %s" % msname print " %d antennas: %s" % (len(ants), " ".join(ants)) print " %d DATA_DESC_ID(s): " % len(spwids) for i, (spw, pol) in enumerate(zip(spwids, polids)): print " %d: %.3f MHz, %d chans x %d correlations" % (
if len([opt for opt in allopt if opt == what]) > 1: parser.error("Conflicting --page/--stack/--average options for '%s'.") # get figsize try: w, h = map(int, options.figsize.split("x", 1)) figsize = (w * 10, h * 10) except: parser.error("Invalid --size setting '%s'" % options.figsize) # get MS name if not args: parser.error("MS not specified. Use '-h' for help.") msname = args[0] print "===> Attaching to MS %s" % msname ms = Owlcat.table(msname) # get flagmask, use a Flagger for this import Owlcat.Flagger from Owlcat.Flagger import Flagger if options.flagmask == "0": flagmask = 0 print "===> Flagmask 0, ignoring all flags" elif options.flagmask is not None: flagger = Flagger(msname) flagmask = flagger.lookup_flagmask(options.flagmask) flagger.close() flagger = None print "===> Flagmask is %s (you specified '%s')" % (Flagger.flagmaskstr(flagmask), options.flagmask) if not flagmask & Flagger.LEGACY:
def get_ms(): global ms global msname if not ms: ms = Owlcat.table(msname) return ms
parser.error( "Conflicting --page/--stack/--average options for '%s'.") # get figsize try: w, h = map(int, options.figsize.split('x', 1)) figsize = (w * 10, h * 10) except: parser.error("Invalid --size setting '%s'" % options.figsize) # get MS name if not args: parser.error("MS not specified. Use '-h' for help.") msname = args[0] print "===> Attaching to MS %s" % msname ms = Owlcat.table(msname) # get flagmask, use a Flagger for this import Owlcat.Flagger from Owlcat.Flagger import Flagger if options.flagmask == "0": flagmask = 0 print "===> Flagmask 0, ignoring all flags" elif options.flagmask is not None: flagger = Flagger(msname) flagmask = flagger.lookup_flagmask(options.flagmask) flagger.close() flagger = None print "===> Flagmask is %s (you specified '%s')" % ( Flagger.flagmaskstr(flagmask), options.flagmask) if not flagmask & Flagger.LEGACY: