Scripts for Step 4 - Prepare the lines:

Averaging Down the Continuum#

Here, we want the exact opposite result as in Pseudo-continuum Measurement Sets.

We return to working with our very initial measurement sets, the uid*.ms.split.cal.source measurement sets (eight in total, one for each EB). For each EB, we “get rid” of the continuum spectral window (SPW 0) by averaging it down to a single channel, using the split task and width list argument. Since our continuum SPW has 128 channels, we average over 128 channels. The continuum SPW will come with us (in its averaged-down state) for the rest of the Step 4 journey, until we eventually split out individual spectral windows and combine them across EBs to create the final line MSes.

split(vis         = inputvis,
      field       = 'AB_Aur',
      spw         = data_dict[EB]['cont_spws'], # in hindsight, poorly named; this includes all spws
      outputvis   = outputvis,
      width       = data_dict[EB]['line_width_array'], # averages the cont spw (0) down to 1 channel, and keeps the line spws as they are
      datacolumn  = 'data',
      keepflags   = False)
print("Spectrally averaged continuum dataset saved to %s" % outputvis)
"""######### Parameter choices for Step 1 #########"""

'''For spectral averaging: Spectral windows to be included (all of them). spw 0 is the only pure-continuum spw though'''
cont_spws       = '0, 1, 2, 3, 4'

"""######### Parameter choices for Step 4 #########"""

'''For extracting the spectral lines: We average the continuum spw down, and do no averaging on the line spectral windows'''
line_width_array = [128, 1, 1, 1, 1] # number of channels to average together