Exemplo n.º 1
0
def test_ant_metrics_run_only_red_corr():
    # get arguments
    a = utils.get_metrics_ArgumentParser('ant_metrics')
    if DATA_PATH not in sys.path:
        sys.path.append(DATA_PATH)
    arg0 = "-p xx,yy,xy,yx"
    arg1 = "--crossCut=5"
    arg2 = "--deadCut=5"
    arg3 = "--extension=.ant_metrics.hdf5"
    arg4 = "--metrics_path={}".format(os.path.join(DATA_PATH, 'test_output'))
    arg5 = "--vis_format=miriad"
    arg6 = "--alwaysDeadCut=10"
    arg7 = "--skip_mean_vij"
    arg8 = "--run_red_corr"
    arg9 = "--skip_cross_pols"
    arguments = ' '.join(
        [arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9])

    xx_file = os.path.join(DATA_PATH, 'zen.2458002.47754.xx.HH.uvA')
    dest_file = os.path.join(DATA_PATH, 'test_output',
                             'zen.2458002.47754.HH.ant_metrics.hdf5')
    if os.path.exists(dest_file):
        os.remove(dest_file)
    cmd = ' '.join([arguments, xx_file])
    args = a.parse_args(cmd.split())
    history = cmd
    pols = list(args.pol.split(','))
    if os.path.exists(dest_file):
        os.remove(dest_file)
    ant_metrics.ant_metrics_run(args.files,
                                pols,
                                args.crossCut,
                                args.deadCut,
                                args.alwaysDeadCut,
                                args.metrics_path,
                                args.extension,
                                args.vis_format,
                                args.verbose,
                                history=history,
                                run_mean_vij=args.run_mean_vij,
                                run_red_corr=args.run_red_corr,
                                run_cross_pols=args.run_cross_pols)
    assert os.path.exists(dest_file)
    os.remove(dest_file)
Exemplo n.º 2
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2018 the HERA Project
# Licensed under the MIT License

from hera_qm import utils
from hera_qm import ant_metrics
import sys

a = utils.get_metrics_ArgumentParser('ant_metrics')
args = a.parse_args()
history = ' '.join(sys.argv)
if args.pol == '':
    args.pol = ['xx', 'yy', 'xy', 'xy']
else:
    args.pol = list(args.pol.split(','))
ant_metrics.ant_metrics_run(args.files,
                            pols=args.pol,
                            crossCut=args.crossCut,
                            deadCut=args.deadCut,
                            alwaysDeadCut=args.alwaysDeadCut,
                            metrics_path=args.metrics_path,
                            extension=args.extension,
                            vis_format=args.vis_format,
                            verbose=args.verbose,
                            history=history,
                            run_mean_vij=args.run_mean_vij,
                            run_red_corr=args.run_red_corr,
                            run_cross_pols=args.run_cross_pols)