elif options.fill_legacy == '-': options.fill_legacy = None # if no other actions supplied, enable stats (unless flags were imported, in which case just exit) if not (options.flag or options.unflag or options.fill_legacy): if options._import: sys.exit(0) statonly = not options.export else: statonly = False # convert all the various FLAGS to flagmasks (or Nones) for opt in 'data_flagmask', 'flagmask', 'flagmask_all', 'flagmask_none', 'flag', 'unflag', 'fill_legacy': value = getattr(options, opt) try: flagmask = flagger.lookup_flagmask(value, create=(opt == 'flag' and options.create)) except Exception as exc: msg = str(exc) if opt == 'flag' and not options.create: msg += "\nPerhaps you forgot the -c/--create option?" error(msg) setattr(options, opt, flagmask) # clear the legacy flag itself from fill_legacy, otherwise it can have no effect if options.fill_legacy is not None: options.fill_legacy &= ~Flagger.LEGACY # # -r/--remove: remove flagsets # if options.remove is not None:
options.fill_legacy = None # if no other actions supplied, enable stats (unless flags were imported, in which case just exit) if not (options.flag or options.unflag or options.fill_legacy): if options._import: sys.exit(0) statonly = not options.export else: statonly = False # convert all the various FLAGS to flagmasks (or Nones) for opt in 'data_flagmask', 'flagmask', 'flagmask_all', 'flagmask_none', 'flag', 'unflag', 'fill_legacy': value = getattr(options, opt) try: flagmask = flagger.lookup_flagmask(value, create=(opt == 'flag' and options.create)) except Exception, exc: msg = str(exc) if opt == 'flag' and not options.create: msg += "\nPerhaps you forgot the -c/--create option?" error(msg) setattr(options, opt, flagmask) # clear the legacy flag itself from fill_legacy, otherwise it can have no effect if options.fill_legacy is not None: options.fill_legacy &= ~Flagger.LEGACY # # -r/--remove: remove flagsets #
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: print("===> NB: legacy FLAG/FLAG_ROW columns will be ignored with this flagmask") else: flagmask = Flagger.BITMASK_ALL | Flagger.LEGACY print("===> Using all flags") # parse slice specs try: freqslice = Parsing.parse_slice(options.freqslice) print("===> Channel selection is ", freqslice) except: parser.error("Invalid -L/--channels option. Start:end[:step] or start~end[:step] expected.")
# 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: print "===> NB: legacy FLAG/FLAG_ROW columns will be ignored with this flagmask" else: flagmask = Flagger.BITMASK_ALL | Flagger.LEGACY print "===> Using all flags" # parse slice specs try: freqslice = Parsing.parse_slice(options.freqslice) print "===> Channel selection is ", freqslice except: