elif os.path.exists(contvis_bestsens+".working"): logprint("Continuum: Skipping {0} because it's in progress in another thread".format(contvis),) elif field not in fields: logprint("Skipping {0} because it is not one of the " "selected fields (but its metadata is being " "collected in continuum_mses.txt)".format(contvis)) else: logprint("Flagging and splitting {0} to {1} for continuum" .format(visfile, contvis),) logprint("contfile is {0}".format(contfile)) touch(contvis+".working") linechannels, linefracs = contchannels_to_linechannels(cont_channel_selection, freqs, return_fractions=True) logprint("Line fractions are: {0}".format(linefracs)) logprint("Cont channels are: {0}".format(cont_channel_selection)) logprint("Line channels are: {0}".format(linechannels)) flagmanager(vis=visfile, mode='save', versionname='before_cont_flags') # not clear why this is done in other imaging scripts, but it # seems to achieve the wrong effect. # initweights(vis=visfile, wtmode='weight', dowtsp=True) flagdata(vis=visfile, mode='manual', spw=linechannels,
"the target line width for spw {0} " "in ms {1}".format(spw, visfile)) if wid > msmd.nchan(spw) / 2: # CASA *cannot* handle wid > nchan # This one also insists that there will be at least 2 # output channels in all cases wid = int(msmd.nchan(spw) / 2) widths.append(wid) # these are TOPO freqs: freqs[spw] = msmd.chanfreqs(spw) try: freqs[spw] = ms.cvelfreqs(spwid=[spw], outframe='LSRK') except TypeError: freqs[spw] = ms.cvelfreqs(spwids=[spw], outframe='LSRK') linechannels = contchannels_to_linechannels( cont_channel_selection, freqs) msmd.close() ms.close() flagmanager(vis=visfile, mode='save', versionname='before_cont_flags') # not clear why this is done in other imaging scripts, but it # seems to achieve the wrong effect. #initweights(vis=visfile, wtmode='weight', dowtsp=True) flagdata(vis=visfile, mode='manual', spw=linechannels,
ms.open(concatvis) try: frqs = { spw: ms.cvelfreqs(spwid=[spw], outframe='LSRK') for spw in spws } except TypeError: frqs = { spw: ms.cvelfreqs(spwids=[spw], outframe='LSRK') for spw in spws } ms.close() # calculate the line channels from the contdatfile (which is in LSRK) # and the frequency arrays linechannels = contchannels_to_linechannels( cont_freq_selection, frqs) uvcontsub( vis=concatvis, fitspw=linechannels, excludechans=True, # fit the non-line channels combine= 'none', # DO NOT combine spws for continuum ID (since that implies combining 7m <-> 12m) solint='int', # fit each integration (may be noisy?) fitorder=1, want_cont=False) # if do_contsub, we want to use the contsub'd MS concatvis = concatvis + contsub_suffix # check that autocorrs are flagged out