コード例 #1
0
ファイル: flag-ms.py プロジェクト: ska-sa/owlcat
    if not (options.flag or options.unflag or options.fill_legacy):
        if options._import:
            sys.exit(0)
        statonly = True
    else:
        statonly = False

    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')
コード例 #2
0
        if options._import:
            sys.exit(0)
        statonly = True
    else:
        statonly = False

    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')
コード例 #3
0
ファイル: plot-ms.py プロジェクト: ska-sa/owlcat
    # 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:
コード例 #4
0
    # 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