예제 #1
0
def validateinput():
    """
    Parse the input config file (command line argument) and validate that the
    parameters look okay
    """

    logger.info('This is version {0} of the pipeline'.format(processMeerKAT.__version__))

    # Get the name of the config file
    args = config_parser.parse_args()

    # Parse config file
    taskvals, config = config_parser.parse_config(args['config'])

    visname = va(taskvals, 'data', 'vis', str)
    calcrefant = va(taskvals, 'crosscal', 'calcrefant', bool)
    refant = va(taskvals, 'crosscal', 'refant', str)
    fields = bookkeeping.get_field_ids(taskvals['fields'])

    # Check if the reference antenna exists, and complain and quit if it doesn't
    if not calcrefant:
        refant = va(taskvals, 'crosscal', 'refant', str)
        msmd.open(visname)
        get_fields.check_refant(MS=visname, refant=refant, warn=False)
        msmd.close()
        msmd.done()

    if not os.path.exists(visname):
        raise IOError("Path to MS %s not found" % (visname))
예제 #2
0
def main():

    # Get the name of the config file
    args = config_parser.parse_args()

    # Parse config file
    taskvals, config = config_parser.parse_config(args['config'])

    visname = va(taskvals, 'data', 'vis', str)

    fields = bookkeeping.get_field_ids(taskvals['fields'])
    calcrefant = va(taskvals, 'crosscal', 'calcrefant', bool, default=False)

    # Calculate reference antenna
    if calcrefant:
        if len(fields.fluxfield.split(',')) > 1:
            field = fields.fluxfield.split(',')[0]
        else:
            field = fields.fluxfield

        refant, badants = get_ref_ant(visname, field)
        # Overwrite config file with new refant
        config_parser.overwrite_config(args['config'],
                                       conf_sec='crosscal',
                                       conf_dict={'refant': refant})
        config_parser.overwrite_config(args['config'],
                                       conf_sec='crosscal',
                                       conf_dict={'badants': badants})
예제 #3
0
파일: split.py 프로젝트: mb010/pipelines
def main(args, taskvals):

    visname = va(taskvals, 'data', 'vis', str)

    calfiles, caldir = bookkeeping.bookkeeping(visname)
    fields = bookkeeping.get_field_ids(taskvals['fields'])

    spw = va(taskvals, 'crosscal', 'spw', str, default='')

    specavg = va(taskvals, 'crosscal', 'width', int, default=1)
    timeavg = va(taskvals, 'crosscal', 'timeavg', str, default='8s')
    keepmms = va(taskvals, 'crosscal', 'keepmms', bool)

    msmd.open(visname)
    newvis = split_vis(visname, spw, fields, specavg, timeavg, keepmms)

    config_parser.overwrite_config(args['config'],
                                   conf_dict={'vis': "'{0}'".format(newvis)},
                                   conf_sec='data')
    config_parser.overwrite_config(
        args['config'],
        conf_dict={'crosscal_vis': "'{0}'".format(visname)},
        conf_sec='run',
        sec_comment='# Internal variables for pipeline execution')
    msmd.done()
예제 #4
0
def main(args, taskvals):

    visname = va(taskvals, 'run', 'crosscal_vis', str)
    keepmms = va(taskvals, 'crosscal', 'keepmms', bool)

    fields = bookkeeping.get_field_ids(taskvals['fields'])

    run_tclean(visname, fields, keepmms)
예제 #5
0
def main(args, taskvals):

    visname = va(taskvals, 'data', 'vis', str)
    calcrefant = va(taskvals, 'crosscal', 'calcrefant', bool, default=False)
    refant = va(taskvals, 'crosscal', 'refant', str, default='m005')
    spw = va(taskvals, 'crosscal', 'spw', str, default='')
    nspw = va(taskvals, 'crosscal', 'nspw', int, default='')
    tasks = va(taskvals, 'slurm', 'ntasks_per_node', int)
    preavg = va(taskvals, 'crosscal', 'chanbin', int, default=1)
    include_crosshand = va(taskvals, 'run', 'dopol', bool, default=False)
    createmms = va(taskvals, 'crosscal', 'createmms', bool, default=True)

    # HPC Specific Configuration
    known_hpc_path = os.path.dirname(SCRIPT_DIR) + "/known_hpc.cfg"
    KNOWN_HPCS, HPC_CONFIG = config_parser.parse_config(known_hpc_path)
    HPC_NAME = taskvals["run"]["hpc"]
    HPC_NAME = HPC_NAME if HPC_NAME in KNOWN_HPCS.keys() else "unknown"
    CPUS_PER_NODE_LIMIT = va(KNOWN_HPCS,
                             HPC_NAME,
                             "CPUS_PER_NODE_LIMIT".lower(),
                             dtype=int)

    if nspw > 1:
        casalog.setlogfile(
            'logs/{SLURM_JOB_NAME}-{SLURM_ARRAY_JOB_ID}_{SLURM_ARRAY_TASK_ID}.casa'
            .format(**os.environ))
    else:
        logfile = casalog.logfile()
        casalog.setlogfile(
            'logs/{SLURM_JOB_NAME}-{SLURM_JOB_ID}.casa'.format(**os.environ))

    if ',' in spw:
        low, high, unit, dirs = config_parser.parse_spw(args['config'])
        spwname = '{0:.0f}~{1:.0f}MHz'.format(min(low), max(high))
    else:
        spwname = spw.replace('0:', '')

    msmd.open(visname)
    npol = msmd.ncorrforpol()[0]

    if not include_crosshand and npol == 4:
        npol = 2
    CPUs = npol if tasks * npol <= CPUS_PER_NODE_LIMIT else 1  #hard-code for number of polarisations

    mvis = do_partition(visname, spw, preavg, CPUs, include_crosshand,
                        createmms, spwname)
    mvis = "'{0}'".format(mvis)
    vis = "'{0}'".format(visname)

    config_parser.overwrite_config(args['config'],
                                   conf_sec='data',
                                   conf_dict={'vis': mvis})
    config_parser.overwrite_config(
        args['config'],
        conf_sec='run',
        sec_comment='# Internal variables for pipeline execution',
        conf_dict={'orig_vis': vis})
    msmd.done()
예제 #6
0
def main(args, taskvals):

    visname = va(taskvals, 'run', 'crosscal_vis', str)
    keepmms = va(taskvals, 'crosscal', 'keepmms', bool)

    calfiles, caldir = bookkeeping.bookkeeping(visname)
    fields = bookkeeping.get_field_ids(taskvals['fields'])

    msmd.open(visname)

    if not os.path.exists(PLOT_DIR):
        os.mkdir(PLOT_DIR)

    # #Superseded by 'plotcal_spw.py'
    # #Plot solutions for bandpass calibrator
    # plotms(vis=calfiles.bpassfile, xaxis='Real', yaxis='Imag', coloraxis='corr', plotfile='{0}/bpass_real_imag.png'.format(PLOT_DIR),showgui=False)
    # plotms(vis=calfiles.bpassfile, xaxis='freq', yaxis='Amp', coloraxis='antenna1', plotfile='{0}/bpass_freq_amp.png'.format(PLOT_DIR),showgui=False)
    # plotms(vis=calfiles.bpassfile, xaxis='freq', yaxis='Phase', coloraxis='antenna1', plotfile='{0}/bpass_freq_phase.png'.format(PLOT_DIR),showgui=False)
    #
    # #Plot solutions for phase calibrator
    # plotms(vis=calfiles.gainfile, xaxis='Real', yaxis='Imag', coloraxis='corr', plotfile='{0}/phasecal_real_imag.png'.format(PLOT_DIR),showgui=False)
    # plotms(vis=calfiles.gainfile, xaxis='Time', yaxis='Amp', coloraxis='antenna1', plotfile='{0}/phasecal_time_amp.png'.format(PLOT_DIR),showgui=False)
    # plotms(vis=calfiles.gainfile, xaxis='Time', yaxis='Phase', coloraxis='antenna1', plotfile='{0}/phasecal_time_phase.png'.format(PLOT_DIR),showgui=False)
    #
    # #Plot solutions for individual antennas of bandpass and phase calibrator in 3x2 panels
    # plot_antennas('bpass',fields,calfiles,xaxis='freq',yaxis='amp')
    # plot_antennas('bpass',fields,calfiles,xaxis='freq',yaxis='phase')
    # plot_antennas('phasecal',fields,calfiles,xaxis='time',yaxis='amp')
    # plot_antennas('phasecal',fields,calfiles,xaxis='time',yaxis='phase')

    extn = 'mms' if keepmms else 'ms'
    for field in fields:
        if field != '':
            for fname in field.split(','):
                if fname.isdigit():
                    fname = msmd.namesforfields(int(fname))[0]
                inname = '%s.%s.%s' % (os.path.splitext(visname)[0], fname,
                                       extn)
                if not os.path.exists('{0}/{1}_freq_amp.png'.format(
                        PLOT_DIR, fname)):
                    plotms(vis=inname,
                           xaxis='freq',
                           yaxis='Amp',
                           coloraxis='corr',
                           plotfile='{0}/{1}_freq_amp.png'.format(
                               PLOT_DIR, fname),
                           showgui=False)
                    plotms(vis=inname,
                           xaxis='Real',
                           yaxis='Imag',
                           coloraxis='corr',
                           plotfile='{0}/{1}_real_imag.png'.format(
                               PLOT_DIR, fname),
                           showgui=False)

    msmd.done()
예제 #7
0
def main(args, taskvals):

    visname = va(taskvals, 'data', 'vis', str)

    calfiles, caldir = bookkeeping.bookkeeping(visname)
    fields = bookkeeping.get_field_ids(taskvals['fields'])

    refant = va(taskvals, 'crosscal', 'refant', str, default='m005')
    minbaselines = va(taskvals, 'crosscal', 'minbaselines', int, default=4)

    do_parallel_cal_apply(visname, fields, calfiles)
예제 #8
0
def main(args, taskvals):

    visname = va(taskvals, 'data', 'vis', str)
    calcrefant = va(taskvals, 'crosscal', 'calcrefant', bool, default=False)
    refant = va(taskvals, 'crosscal', 'refant', str, default='m005')
    spw = va(taskvals, 'crosscal', 'spw', str, default='')
    tasks = va(taskvals, 'slurm', 'ntasks_per_node', int)
    preavg = va(taskvals, 'crosscal', 'chanbin', int, default=1)
    include_crosshand = va(taskvals, 'run', 'dopol', bool, default=False)
    createmms = va(taskvals, 'crosscal', 'createmms', bool, default=True)

    msmd.open(visname)
    npol = msmd.ncorrforpol()[0]

    if not include_crosshand and npol == 4:
        npol = 2
    CPUs = npol if tasks * npol <= processMeerKAT.CPUS_PER_NODE_LIMIT else 1  #hard-code for number of polarisations

    mvis = do_partition(visname, spw, preavg, CPUs, include_crosshand,
                        createmms)
    mvis = "'{0}'".format(mvis)
    vis = "'{0}'".format(visname)

    config_parser.overwrite_config(args['config'],
                                   conf_sec='data',
                                   conf_dict={'vis': mvis})
    config_parser.overwrite_config(
        args['config'],
        conf_sec='run',
        sec_comment='# Internal variables for pipeline execution',
        conf_dict={'orig_vis': vis})
    msmd.done()
예제 #9
0
파일: setjy.py 프로젝트: mb010/pipelines
def main(args,taskvals):

    visname = va(taskvals, "data", "vis", str)

    if os.path.exists(os.path.join(os.getcwd(), "caltables")):
        shutil.rmtree(os.path.join(os.getcwd(), "caltables"))

    calfiles, caldir = bookkeeping.bookkeeping(visname)
    fields = bookkeeping.get_field_ids(taskvals["fields"])

    spw = va(taskvals, "crosscal", "spw", str, default="")
    standard = va(taskvals, "crosscal", "standard", str, default="Stevens-Reynolds 2016")
    dopol = va(taskvals, 'run', 'dopol', bool, default=False)
    createmms = va(taskvals, 'crosscal', 'createmms', bool, default=True)

    do_setjy(visname, spw, fields, standard, dopol, createmms)
예제 #10
0
def main(args, taskvals):

    visname = va(taskvals, 'data', 'vis', str)

    calfiles, caldir = bookkeeping.bookkeeping(visname)
    fields = bookkeeping.get_field_ids(taskvals['fields'])

    do_cross_cal_apply(visname, fields, calfiles, caldir)
예제 #11
0
def main(args, taskvals):

    visname = va(taskvals, 'data', 'vis', str)

    calfiles, caldir = bookkeeping.bookkeeping(visname)
    fields = bookkeeping.get_field_ids(taskvals['fields'])

    do_pre_flag_2(visname, fields)
예제 #12
0
def main(args, taskvals):

    visname = va(taskvals, 'data', 'vis', str)

    calfiles, caldir = bookkeeping.bookkeeping(visname)
    fields = bookkeeping.get_field_ids(taskvals['fields'])

    minbaselines = va(taskvals, 'crosscal', 'minbaselines', int, default=4)
    standard = va(taskvals,
                  'crosscal',
                  'standard',
                  str,
                  default='Stevens-Reynolds 2016')
    refant = va(taskvals, 'crosscal', 'refant', str, default='m059')

    do_parallel_cal(visname, fields, calfiles, refant, caldir, minbaselines,
                    standard)
예제 #13
0
def main():

    config = config_parser.parse_args()['config']

    # Parse config file
    taskvals, config = config_parser.parse_config(config)

    visname = va(taskvals, 'data', 'vis', str)
    keepmms = va(taskvals, 'crosscal', 'keepmms', bool)

    calfiles, caldir = bookkeeping.bookkeeping(visname)
    fields = bookkeeping.get_field_ids(taskvals['fields'])

    msmd.open(visname)

    if not os.path.exists(PLOT_DIR):
        os.mkdir(PLOT_DIR)

    #Plot solutions for bandpass calibrator
    plotms(vis=calfiles.bpassfile, xaxis='Real', yaxis='Imag', coloraxis='corr', plotfile='{0}/bpass_real_imag.png'.format(PLOT_DIR),showgui=False)
    plotms(vis=calfiles.bpassfile, xaxis='freq', yaxis='Amp', coloraxis='antenna1', plotfile='{0}/bpass_freq_amp.png'.format(PLOT_DIR),showgui=False)
    plotms(vis=calfiles.bpassfile, xaxis='freq', yaxis='Phase', coloraxis='antenna1', plotfile='{0}/bpass_freq_phase.png'.format(PLOT_DIR),showgui=False)

    #Plot solutions for phase calibrator
    plotms(vis=calfiles.gainfile, xaxis='Real', yaxis='Imag', coloraxis='corr', plotfile='{0}/phasecal_real_imag.png'.format(PLOT_DIR),showgui=False)
    plotms(vis=calfiles.gainfile, xaxis='Time', yaxis='Amp', coloraxis='antenna1', plotfile='{0}/phasecal_time_amp.png'.format(PLOT_DIR),showgui=False)
    plotms(vis=calfiles.gainfile, xaxis='Time', yaxis='Phase', coloraxis='antenna1', plotfile='{0}/phasecal_time_phase.png'.format(PLOT_DIR),showgui=False)

    #Plot solutions for individual antennas of bandpass and phase calibrator in 3x2 panels
    plot_antennas('bpass',fields,calfiles,xaxis='freq',yaxis='amp')
    plot_antennas('bpass',fields,calfiles,xaxis='freq',yaxis='phase')
    plot_antennas('phasecal',fields,calfiles,xaxis='time',yaxis='amp')
    plot_antennas('phasecal',fields,calfiles,xaxis='time',yaxis='phase')


    extn = 'mms' if keepmms else 'ms'
    for field in fields:
        for subf in field.split(','):
            fname = msmd.namesforfields(int(subf))[0]
            inname = '%s.%s.%s' % (os.path.splitext(visname)[0], fname, extn)
            if not os.path.exists('{0}/{1}_freq_amp.png'.format(PLOT_DIR,fname)):
                plotms(vis=inname, xaxis='freq', yaxis='Amp', coloraxis='corr', plotfile='{0}/{1}_freq_amp.png'.format(PLOT_DIR,fname),showgui=False)
                plotms(vis=inname, xaxis='Real', yaxis='Imag', coloraxis='corr', plotfile='{0}/{1}_real_imag.png'.format(PLOT_DIR,fname),showgui=False)

    msmd.close()
    msmd.done()
예제 #14
0
def main(args, taskvals):

    visname = va(taskvals, 'data', 'vis', str)

    calfiles, caldir = bookkeeping.bookkeeping(visname)
    fields = bookkeeping.get_field_ids(taskvals['fields'])

    refant = va(taskvals, 'crosscal', 'refant', str, default='m005')
    minbaselines = va(taskvals, 'crosscal', 'minbaselines', int, default=4)
    standard = va(taskvals,
                  'crosscal',
                  'standard',
                  str,
                  default='Perley-Butler 2010')

    do_cross_cal(visname, fields, calfiles, refant, caldir, minbaselines,
                 standard)
예제 #15
0
def main(args, taskvals):

    visname = va(taskvals, 'data', 'vis', str)
    fields = bookkeeping.get_field_ids(taskvals['fields'])
    calcrefant = va(taskvals, 'crosscal', 'calcrefant', bool)
    spw = va(taskvals, 'crosscal', 'spw', str)
    nspw = va(taskvals, 'crosscal', 'nspw', int)

    # Calculate reference antenna
    if calcrefant:
        if len(fields.fluxfield.split(',')) > 1:
            field = fields.fluxfield.split(',')[0]
        else:
            field = fields.fluxfield

        refant, badants = get_ref_ant(visname, field)
        # Overwrite config file with new refant
        config_parser.overwrite_config(
            args['config'],
            conf_sec='crosscal',
            conf_dict={'refant': "'{0}'".format(refant)})
        config_parser.overwrite_config(args['config'],
                                       conf_sec='crosscal',
                                       conf_dict={'badants': badants})

        #Replace reference antenna in each SPW config
        if nspw > 1:
            for SPW in spw.split(','):
                spw_config = '{0}/{1}'.format(SPW.replace('0:', ''),
                                              args['config'])
                # Overwrite config file with new refant
                config_parser.overwrite_config(
                    spw_config,
                    conf_sec='crosscal',
                    conf_dict={'refant': "'{0}'".format(refant)})
                config_parser.overwrite_config(spw_config,
                                               conf_sec='crosscal',
                                               conf_dict={'badants': badants})
                config_parser.overwrite_config(spw_config,
                                               conf_sec='crosscal',
                                               conf_dict={'calcrefant': False})
    else:
        logger.info(
            "Skipping calculation of reference antenna, as 'calcrefant=False' in '{0}'."
            .format(args['config']))
예제 #16
0
def main(args,taskvals):

    visname = va(taskvals, 'data', 'vis', str)

    badfreqranges = taskvals['crosscal'].pop('badfreqranges', ['935~947MHz', '1160~1310MHz', '1476~1611MHz', '1670~1700MHz'])
    badants = taskvals['crosscal'].pop('badants')

    calfiles, caldir = bookkeeping.bookkeeping(visname)
    fields = bookkeeping.get_field_ids(taskvals['fields'])

    do_pre_flag(visname, fields, badfreqranges, badants)
예제 #17
0
def main(args, taskvals):
    """
    Parse the input config file (command line argument) and validate that the
    parameters look okay
    """

    logger.info('This is version {0} of the pipeline'.format(
        processMeerKAT.__version__))

    visname = va(taskvals, 'data', 'vis', str)
    calcrefant = va(taskvals, 'crosscal', 'calcrefant', bool)
    refant = taskvals['crosscal']['refant']
    if type(refant) is str and 'm' in refant:
        refant = va(taskvals, 'crosscal', 'refant', str)
    else:
        refant = va(taskvals, 'crosscal', 'refant', int)
    nspw = va(taskvals, 'crosscal', 'nspw', int)
    fields = bookkeeping.get_field_ids(taskvals['fields'])

    # Check if the reference antenna exists, and complain and quit if it doesn't
    if not calcrefant:
        refant = va(taskvals, 'crosscal', 'refant', str)
        msmd.open(visname)
        read_ms.check_refant(MS=visname,
                             refant=refant,
                             config=args['config'],
                             warn=False)
        msmd.done()

    if not os.path.exists(visname):
        raise IOError("Path to MS %s not found" % (visname))
예제 #18
0
def main(args, taskvals):

    visname = va(taskvals, 'data', 'vis', str)
    spw = va(taskvals, 'crosscal', 'spw', str, default='')
    nspw = va(taskvals, 'crosscal', 'nspw', int, default='')
    fields = bookkeeping.get_field_ids(taskvals['fields'])
    dirs = config_parser.parse_spw(args['config'])[3]

    if ',' in spw:
        newvis = do_concat(visname, fields, dirs)
        config_parser.overwrite_config(
            args['config'],
            conf_dict={'vis': "'{0}'".format(newvis)},
            conf_sec='data')
        config_parser.overwrite_config(
            args['config'],
            conf_dict={'crosscal_vis': "'{0}'".format(visname)},
            conf_sec='run',
            sec_comment='# Internal variables for pipeline execution')
    else:
        logger.error(
            "Only found one SPW in '{0}', so will skip concat.".format(
                args['config']))
예제 #19
0
def main():

    # Get the name of the config file
    args = config_parser.parse_args()

    # Parse config file
    taskvals, config = config_parser.parse_config(args['config'])

    visname = va(taskvals, 'data', 'vis', str)
    calcrefant = va(taskvals, 'crosscal', 'calcrefant', bool, default=False)
    refant = va(taskvals, 'crosscal', 'refant', str, default='m005')
    spw = va(taskvals, 'crosscal', 'spw', str, default='')

    mvis = do_partition(visname, spw)
    mvis = "'{0}'".format(mvis)
    vis = "'{0}'".format(visname)

    config_parser.overwrite_config(args['config'],
                                   conf_sec='data',
                                   conf_dict={'vis': mvis})
    config_parser.overwrite_config(args['config'],
                                   conf_sec='data',
                                   conf_dict={'orig_vis': vis})
예제 #20
0
def main():

    config = config_parser.parse_args()['config']

    # Parse config file
    taskvals, config = config_parser.parse_config(config)

    visname = va(taskvals, 'data', 'vis', str)

    calfiles, caldir = bookkeeping.bookkeeping(visname)
    fields = bookkeeping.get_field_ids(taskvals['fields'])

    #Plot solutions for bandpass calibrator
    fastplot(calfiles.bpassfile,
             col='CPARAM',
             xaxis='Real',
             yaxis='Imag',
             fname='bpass_real_imag.png')
    fastplot(calfiles.bpassfile,
             col='CPARAM',
             xaxis='chan',
             yaxis='Amp',
             logy=True,
             fname='bpass_chan_amp.png')
    fastplot(calfiles.bpassfile,
             col='CPARAM',
             xaxis='chan',
             yaxis='Phase',
             fname='bpass_chan_phase.png')

    #Plot solutions for phase calibrator
    fastplot(calfiles.gainfile,
             col='CPARAM',
             xaxis='Amp',
             yaxis='Time',
             fname='phasecal_time_amp.png',
             markersize=2,
             extent=1e-8)
    fastplot(calfiles.gainfile,
             col='CPARAM',
             xaxis='Phase',
             yaxis='Time',
             fname='phasecal_time_phase.png',
             markersize=2,
             extent=1e-8)
예제 #21
0
def main(args,taskvals):

    try:
        if not os.path.exists(PLOT_DIR):
            os.makedirs(PLOT_DIR)

        fields = bookkeeping.get_field_ids(taskvals['fields'])
        visname = va(taskvals, 'run', 'crosscal_vis', str)
        polfield = bookkeeping.polfield_name(visname)

        msmd.open(visname)

        caldir = 'caltables'
        spwdir = config_parser.parse_spw(args['config'])[3]

        if type(spwdir) is str:
            spwdir = glob.glob(spwdir)

        for ff in fields.gainfields.split(','):
            plotstr='phase,time'
            table_ext = 'gcal'
            title='Gain Phase'
            outname = '{}/field_{}_gain_phase'.format(PLOT_DIR,ff)
            plotcal(plotstr, int(msmd.fieldsforname(ff)[0]), spwdir, caldir, table_ext, title, outname)

            plotstr='amp,time'
            table_ext = 'gcal'
            title='Gain Amp'
            outname = '{}/field_{}_gain_amp'.format(PLOT_DIR,ff)
            plotcal(plotstr, int(msmd.fieldsforname(ff)[0]), spwdir, caldir, table_ext, title, outname)

        #print("k")
        #plotstr='delay,freq'
        #table_ext = 'kcal'
        #title='Delay'
        #outname = '{}/field_{}_delay'.format(PLOT_DIR,fields.fluxfield)
        #plotcal(plotstr, int(msmd.fieldsforname(fields.fluxfield)[0]), spwdir, caldir, table_ext, title, outname)

        #print("kcross")
        #plotstr='delay,freq'
        #table_ext = 'xdel'
        #title='Crosshand Delay'
        #outname = '{}/field_{}_crosshanddelay'.format(PLOT_DIR,fields.fluxfield)
        #plotcal(plotstr, int(msmd.fieldsforname(fields.fluxfield)[0]), spwdir, caldir, table_ext, title, outname)

        plotstr='amp,freq'
        table_ext = 'bcal'
        title='Bandpass Amp'
        outname = '{}/field_{}_bandpass_amp'.format(PLOT_DIR,fields.fluxfield)
        plotcal(plotstr, int(msmd.fieldsforname(fields.fluxfield)[0]), spwdir, caldir, table_ext, title, outname)

        plotstr='phase,freq'
        table_ext = 'bcal'
        title='Bandpass Phase'
        outname = '{}/field_{}_bandpass_phase'.format(PLOT_DIR,fields.fluxfield)
        plotcal(plotstr, int(msmd.fieldsforname(fields.fluxfield)[0]), spwdir, caldir, table_ext, title, outname)

        plotstr='amp,freq'
        table_ext = 'pcal'
        title='Leakage Amp'
        outname = '{}/field_{}_leakage_amp'.format(PLOT_DIR,fields.bpassfield)
        plotcal(plotstr, int(msmd.fieldsforname(fields.dpolfield)[0]), spwdir, caldir, table_ext, title, outname, None, [0, 0.1])
        plotstr='phase,freq'
        table_ext = 'pcal'
        title='Leakage Phase'
        outname = '{}/field_{}_leakage_phase'.format(PLOT_DIR,fields.bpassfield)
        plotcal(plotstr, int(msmd.fieldsforname(fields.dpolfield)[0]), spwdir, caldir, table_ext, title, outname)

        plotstr='phase,freq'
        table_ext = 'xyambcal'
        title='XY Phase'
        outname = '{}/field_{}_xyamb_phase'.format(PLOT_DIR,polfield)
        plotcal(plotstr, int(msmd.fieldsforname(polfield)[0]), spwdir, caldir, table_ext, title, outname)

        plotstr='phase,freq'
        table_ext = 'xycal'
        title='XY Phase (amb resolved)'
        outname = '{}/field_{}_xy_phase'.format(PLOT_DIR,polfield)
        plotcal(plotstr, int(msmd.fieldsforname(polfield)[0]), spwdir, caldir, table_ext, title, outname)

        msmd.done()

    except Exception as err:
        logger.error('Exception found in the pipeline of type {0}: {1}'.format(type(err),err))
        logger.error(traceback.format_exc())
        msmd.done()
예제 #22
0
                       specmode='mfs',
                       deconvolver=deconvolver,
                       nterms=terms,
                       scales=[],
                       savemodel='none',
                       gridder='standard',
                       restoration=True,
                       pblimit=0,
                       parallel=parallel)

                exportfits(imagename=secimname + '.image' + suffix,
                           fitsimage=secimname + '.fits')

    msmd.close()
    msmd.done()


if __name__ == '__main__':
    # Get the name of the config file
    args = config_parser.parse_args()

    # Parse config file
    taskvals, config = config_parser.parse_config(args['config'])

    visname = va(taskvals, 'data', 'vis', str)
    keepmms = va(taskvals, 'crosscal', 'keepmms', bool)

    fields = bookkeeping.get_field_ids(taskvals['fields'])

    run_tclean(visname, fields, keepmms)
예제 #23
0
             parang=True)

    logger.info(" applying calibration -> target calibrator")
    applycal(vis=visname,
             field=fields.targetfield,
             selectdata=False,
             calwt=False,
             gaintable=[calfiles.kcorrfile, calfiles.bpassfile, fluxfile],
             gainfield=[
                 fields.kcorrfield, fields.bpassfield, fields.secondaryfield
             ],
             parang=True)


if __name__ == '__main__':
    # Get the name of the config file
    args = config_parser.parse_args()

    # Parse config file
    taskvals, config = config_parser.parse_config(args['config'])

    visname = va(taskvals, 'data', 'vis', str)

    calfiles, caldir = bookkeeping.bookkeeping(visname)
    fields = bookkeeping.get_field_ids(taskvals['fields'])

    refant = va(taskvals, 'crosscal', 'refant', str, default='m005')
    minbaselines = va(taskvals, 'crosscal', 'minbaselines', int, default=4)

    do_parallel_cal_apply(visname, fields, calfiles)
예제 #24
0
                  reference=fields.fluxfield,
                  transfer='',
                  fluxtable=calfiles.fluxfile,
                  listfile=os.path.join(caldir, 'fluxscale_xy_yx.txt'),
                  append=False,
                  display=False)


if __name__ == '__main__':
    # Get the name of the config file
    args = config_parser.parse_args()

    # Parse config file
    taskvals, config = config_parser.parse_config(args['config'])

    visname = va(taskvals, 'data', 'vis', str)

    calfiles, caldir = bookkeeping.bookkeeping(visname)
    fields = bookkeeping.get_field_ids(taskvals['fields'])

    refant = va(taskvals, 'crosscal', 'refant', str, default='m005')
    minbaselines = va(taskvals, 'crosscal', 'minbaselines', int, default=4)
    standard = va(taskvals,
                  'crosscal',
                  'standard',
                  str,
                  default='Perley-Butler 2010')

    do_cross_cal(visname,
                 fields,
                 calfiles,
예제 #25
0
            overwrite=True, writeflags=True)

    # now flag using 'rflag' option
    flagdata(vis=visname, mode="rflag", datacolumn="corrected",
            field=fields.targetfield, timecutoff=5.0, freqcutoff=5.0, timefit="poly",
            freqfit="poly", flagdimension="freqtime", extendflags=False,
            timedevscale=5.0, freqdevscale=5.0, spectralmax=500.0,
            extendpols=False, growaround=False, flagneartime=False,
            flagnearfreq=False, action="apply", flagbackup=True, overwrite=True,
            writeflags=True)

    # Now summary
    flagdata(vis=visname, mode="summary", datacolumn="corrected",
            extendflags=True, name=visname + 'summary.split', action="apply",
            flagbackup=True, overwrite=True, writeflags=True)


if __name__ == '__main__':
    # Get the name of the config file
    args = config_parser.parse_args()

    # Parse config file
    taskvals, config = config_parser.parse_config(args['config'])

    visname = va(taskvals, 'data', 'vis', str)

    calfiles, caldir = bookkeeping.bookkeeping(visname)
    fields = bookkeeping.get_field_ids(taskvals['fields'])

    do_pre_flag_2(visname, fields)
예제 #26
0
                            field=fname,
                            spw=spw,
                            keepflags=False,
                            createmms=keepmms,
                            chanaverage=chanaverage,
                            chanbin=specavg,
                            timeaverage=True,
                            timebin=timeavg,
                            usewtspectrum=True)


if __name__ == '__main__':
    # Get the name of the config file
    args = config_parser.parse_args()

    # Parse config file
    taskvals, config = config_parser.parse_config(args['config'])

    visname = va(taskvals, 'data', 'vis', str)

    calfiles, caldir = bookkeeping.bookkeeping(visname)
    fields = bookkeeping.get_field_ids(taskvals['fields'])

    spw = va(taskvals, 'crosscal', 'spw', str, default='')

    specavg = va(taskvals, 'crosscal', 'specavg', int, default=1)
    timeavg = va(taskvals, 'crosscal', 'timeavg', str, default='8s')
    keepmms = va(taskvals, 'crosscal', 'keepmms', bool)

    split_vis(visname, spw, fields, specavg, timeavg, keepmms)
예제 #27
0
    else:
        setjy(vis=visname,
              field=setjyname,
              spw=spw,
              scalebychan=True,
              standard=standard)


if __name__ == '__main__':
    # Get the name of the config file
    args = config_parser.parse_args()

    # Parse config file
    taskvals, config = config_parser.parse_config(args['config'])

    visname = va(taskvals, 'data', 'vis', str)

    if os.path.exists(os.path.join(os.getcwd(), 'caltables')):
        shutil.rmtree(os.path.join(os.getcwd(), 'caltables'))

    calfiles, caldir = bookkeeping.bookkeeping(visname)
    fields = bookkeeping.get_field_ids(taskvals['fields'])

    spw = va(taskvals, 'crosscal', 'spw', str, default='')
    standard = va(taskvals,
                  'crosscal',
                  'standard',
                  str,
                  default='Perley-Butler 2010')

    do_setjy(visname, spw, fields, standard)