def make_continuum(script, parameters, project_dict, continfo, comments, template, flagchannels): """Write the make a continuum ms portion of the script""" width = continfo['width'] widthall = continfo['widthall'] if continfo['cont_index'] == continfo['spwall']: contspws = "contspws = '" + continfo['cont_index'] elif continfo['cont_index'] == '': contspws = "contspws = '" + continfo['spwall'] + "' # Because there are no continuum-dedicated spws, all of the spws are included. You will need to flag out line emission before proceeding. \n\n" width=widthall else: contspws = "contspws = '" + continfo['cont_index'] + "'\n" spwall = continfo['spwall'] if comments == False: script = script + com.im_template_header() + sc.finalvis() + sc.plotspw() + com.casa_warning() else: script = script + com.im_template() + sc.finalvis() + sc.plotspw() + com.casa_warning() if not flagchannels: flagchannels = "flagchannels = 'specify_channels_to_flag_here' # Example syntax: '2:1201~2199,3:1201~2199'\n\n" splitcomplete = sc.splitcont() + " width=[" + width + "], # widths for all the spws are [" + widthall + "]\n datacolumn='data')\n\n" else: # use all the spws, not just continuum-dedicated: flagchannels = "\n# Flag the 'line channels'\nflagchannels = '" + flagchannels + "'#In this example , spws 2&3 have a line between channels 1201 and\n\ # 2199 and spectral windows 0 and 1 are line-free.\n\n" #for the future it may be possible to steal hifa_flagchannels output to find these channels contspws = "contspws = '" + spwall + "'\n" splitcomplete = sc.splitcont() + " width=[" + widthall + "], # widths for all the spws are [" + widthall + "]\n datacolumn='data')\n\n" # >= 4.4 fixes.... initweights = "initweights(vis=finalvis,wtmode='weight',dowtsp=True)\n\n" checkweights = "plotms(vis=contvis, yaxis='wtsp',xaxis='freq',spw='',antenna='DA42',field='%s')\n" % parameters['scifield0'] # how to get the antenna? casa_version = int(project_dict['casa_version'].replace('.','0')) # replace dots with zeros and convert to int if project_dict['project_type'] == 'Manual' or casa_version >= 40400: # or casa version >= 4.4.0 splitcomplete = sc.splitcont2() + " width=[" + width + "], # widths for all the spws are [" + widthall + "]\n datacolumn='data')\n\n" script = script + contspws + initweights + sc.flags() + flagchannels + sc.flagdata() + sc.plotspw() + sc.contvis() + splitcomplete + sc.flagrestore() + checkweights + sc.plotuv() elif template == True: script = script + contspws + initweights + sc.flags() + flagchannels + sc.flagdata() + sc.contvis() + com.split_versions() + sc.flagrestore() + checkweights + sc.plotuv() else: script = script + contspws + sc.flags() + flagchannels + sc.flagdata() + sc.contvis() + splitcomplete + sc.flagrestore() + sc.plotuv() return script
def make_continuum(script, parameters, project_dict, continfo, comments, flagchannels=False): width = continfo['width'] widthall = continfo['widthall'] contspws = "contspws = '" + continfo['cont_index'] + "'\n" spwall = continfo['spwall'] if comments == False: script = script + com.im_template_header() + sc.finalvis() + sc.plotspw() else: script = script + com.im_template() + sc.finalvis() + sc.plotspw() if not flagchannels: flagchannels = "flagchannels = '0'\n\n" splitcomplete = sc.splitcont() + " width=[" + width + "], # widths for all the spws are [" + widthall + "]\n datacolumn='data')\n\n" else: # use all the spws, not just continuum-dedicated: flagchannels = "flagchannels = '" + flagchannels + "'\n\n" contspws = "contspws = '" + spwall + "\n" splitcomplete = sc.splitcont() + " width=[" + widthall + "], # widths for all the spws are [" + widthall + "]\n datacolumn='data')\n\n" # 4.4 fixes.... if project_dict['project_type'] == 'Manual': initweights = "initweights(vis=finalvis,wtmode='weight',dowtsp=True)\n\n" splitcomplete = sc.splitcont2() + " width=[" + width + "], # widths for all the spws are [" + widthall + "]\n datacolumn='data')\n\n" checkweights = "plotms(vis=contvis, yaxis='wtsp',xaxis='freq',spw='',antenna='DA42',field='%s')\n" % parameters['scifield0'] # how to get the antenna? script = script + contspws + initweights + sc.flags() + flagchannels + sc.flagdata() + sc.plotspw() + sc.contvis() + splitcomplete + sc.flagrestore() + checkweights + sc.plotuv() else: script = script + contspws + sc.flags() + flagchannels + sc.flagdata() + sc.contvis() + splitcomplete + sc.flagrestore() + sc.plotuv() return script