parser.add_option("-o","--output",type="string", help="Name of output MS. Use '%(ms)s' to insert basename of input MS. Use '%(ddid)d' to insert DDID number. Use '%(msext)s' to insert extension of input MS. Default is %default"); parser.add_option("-f","--force",dest="force",action="store_true", help="overwrites output MS if it already exists"); parser.set_defaults(ddid=-1,output="%(ms)s_spw%(ddid)d%(msext)s"); (options,msname) = parser.parse_args(); if len(msname) != 1 : parser.error("Incorrect number of arguments. Use '-h' for help."); # open input MS msname = msname[0]; print "Reading input MS %s"%msname; if not tableexists(msname): parser.error("MS %s not found."%msname); ms = table(msname); # check DDID option num_ddids = table(ms.getkeyword("DATA_DESCRIPTION")).nrows(); print "MS contains %d DATA_DESC_IDs"%num_ddids; if options.ddid < 0: ddids = range(num_ddids); elif options.ddid >= num_ddids: parser.error("DATA_DESC_ID %d is out of range"%options.ddid); else: ddids = [ options.ddid ]; # setup outputs msname,msext = os.path.splitext(os.path.basename(os.path.normpath(msname)));
parser.add_option("-s","--renumber-spws",action="store_true", help="treat each MS as a separate spectral window"); parser.add_option("--renumber-obs",action="store_true", help="renumber OBSERVATION_ID of each MS"); parser.add_option("-v","--verbose",action="store_true", help="be more verbose"); (options,msnames) = parser.parse_args(); if len(msnames) < (2 if options.append else 3): parser.error("Insufficient number of arguments. Use '-h' for help."); msout = msnames[0]; msins = msnames[1:]; if tableexists(msout) and not options.append and not options.force: print "Output MS",msout,"already exists. Use the -f switch to overwrite."; sys.exit(1); if not options.force: if options.append: print "Will extend merged MS %s with %d input MSs:"%(msout,len(msins)); else: print "Will create merged MS %s from %d input MSs:"%(msout,len(msins)); for ms in msins: print " ",ms; if options.renumber_spws: print "Each input MS will be put into a separate spectral window, spws will be renumbered."; else: print "Spectral windows will not be renumbered."; if options.renumber_obs:
) parser.add_option( "-f", "--force", dest="force", action="store_true", help="overwrites output MS if it already exists" ) parser.set_defaults(ddid=-1, output="%(ms)s_spw%(ddid)d%(msext)s") (options, msname) = parser.parse_args() if len(msname) != 1: parser.error("Incorrect number of arguments. Use '-h' for help.") # open input MS msname = msname[0] print "Reading input MS %s" % msname if not tableexists(msname): parser.error("MS %s not found." % msname) ms = table(msname) # check DDID option num_ddids = table(ms.getkeyword("DATA_DESCRIPTION")).nrows() print "MS contains %d DATA_DESC_IDs" % num_ddids if options.ddid < 0: ddids = range(num_ddids) elif options.ddid >= num_ddids: parser.error("DATA_DESC_ID %d is out of range" % options.ddid) else: ddids = [options.ddid] # setup outputs msname, msext = os.path.splitext(os.path.basename(os.path.normpath(msname)))
action="store_true", help="renumber OBSERVATION_ID of each MS") parser.add_option("-v", "--verbose", action="store_true", help="be more verbose") (options, msnames) = parser.parse_args() if len(msnames) < (2 if options.append else 3): parser.error("Insufficient number of arguments. Use '-h' for help.") msout = msnames[0] msins = msnames[1:] if tableexists(msout) and not options.append and not options.force: print "Output MS", msout, "already exists. Use the -f switch to overwrite." sys.exit(1) if not options.force: if options.append: print "Will extend merged MS %s with %d input MSs:" % (msout, len(msins)) else: print "Will create merged MS %s from %d input MSs:" % (msout, len(msins)) for ms in msins: print " ", ms if options.renumber_spws: print "Each input MS will be put into a separate spectral window, spws will be renumbered." else: