def get_ms ():
  global ms;
  global msname;
  if not ms:
    ms = Owlcat.table(msname);
  return ms;
Example #2
0
    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, :])))
Example #3
0
        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:
Example #4
0
    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" % (
Example #5
0
        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:
Example #6
0
def get_ms():
    global ms
    global msname
    if not ms:
        ms = Owlcat.table(msname)
    return ms
Example #7
0
            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: