'q2CL': np.arange(145., 157.5, 50./1024/delay_compression*256),
        'q2AL': np.arange(145., 157.5, 50./1024/delay_compression*256),
    }
    freqs = freqs_dic[Q]
    lambdas = 299.792 / freqs
    correction_mat = np.array([[0.999973, 0.010705, -0.00263492], [-0.0105871, 0.999799, 0.0167222], [0.00142779, -0.00475158, -0.0178542]])#ubl.dot(correction_mat) gives better ubl for omniscope. this is directly from "antlocvecX5 // Transpose" in mathematica

    omnifits = {}
    for pol in ['xx', 'xy','yx', 'yy']:
        omnifits[pol] = [omni.load_omnifit(fname, info=fname.replace("%s.omnifit"%pol, "xx.binfo")) for fname in sorted(glob.glob("/home/omniscope/data/X5/2015calibration/*_%s_*%s.omnifit"%(Q,pol)))]
    nTimes = [fit.shape[0] for fit in omnifits['xx']]
    nFrequencies = [int(fit[0, 0, 5]) for fit in omnifits['xx']]
    nfreq = nFrequencies[0]
    print nTimes, nFrequencies

    jds = np.concatenate([omni.get_omnitime(fit) for fit in omnifits['xx']], axis=0)



    flags = {}
    for pol in ['xx', 'yy']:
        flags[pol] = np.concatenate([np.fromfile(fname, dtype = 'bool').reshape((nTimes[i], nFrequencies[i])) for i, fname in enumerate(sorted(glob.glob("/home/omniscope/data/X5/2015calibration/*_%s_*%s.omniflag"%(Q, pol))))], axis=0)
    flag = flags['xx']|flags['yy']


    for p, pol in enumerate(['xx', 'xy', 'yx', 'yy']):
        omnifits[pol] = np.concatenate([fit[..., 6::2] + 1.j*fit[..., 7::2] for fit in omnifits[pol]], axis=0).transpose((0,2,1))
        omnifits[pol][flag] = np.nan
    info = omni.read_redundantinfo(glob.glob("/home/omniscope/data/X5/2015calibration/*_%s_*xx.binfo"%Q)[0])
    redundancy_sort = np.argsort(info['ublcount'])
Пример #2
0


have_model_noises = False
if opts.model_noise is not None:
    if not need_new_flag:
        raise IOError("--noise_model supplied without --flag. Noise model is only useful when doing new flagging.")
    if len(opts.model_noise.split(',')) != len(opts.pol.split(',')):
        raise ValueError("--model_noise got argument %s that does not have the same number of polarizations as -p argument %s."%(opts.model_noise, opts.pol))
    model_noises = {}
    for p, pol in enumerate(opts.pol.split(',')):
        model_noise_file = os.path.expanduser(opts.model_noise.split(',')[p])
        if not os.path.isfile(model_noise_file):
            raise IOError("model noise file %s does not exist"%model_noise_file)
        model_noises[pol] = omni.load_omnichisq(model_noise_file)
        if np.max(omni.get_omnitime(model_noises[pol])) >= TPI or np.min(omni.get_omnitime(model_noises[pol])) < 0:
            raise ValueError("Times stored in noise model %s is outside the range [0, 2pi)."%model_noise_file)
    have_model_noises = True
    chisq_leniency = opts.chisq_leniency

have_model_treasure = False
if opts.model_treasure is not None:
    if os.path.isdir(os.path.expanduser(opts.model_treasure)):
        model_treasure = omni.Treasure(os.path.expanduser(opts.model_treasure))
        for pol in opts.pol.split(','):
            if pol not in model_treasure.ubls.keys():
                raise ValueError("Polarization %s not found in the model treasure file %s."%(pol, os.path.expanduser(opts.model_treasure)))
    else:
        raise IOError("Model treasure folder not found: %s."%os.path.expanduser(opts.model_treasure))
    have_model_treasure = True
Пример #3
0
    if not need_new_flag:
        raise IOError(
            "--noise_model supplied without --flag. Noise model is only useful when doing new flagging."
        )
    if len(opts.model_noise.split(',')) != len(opts.pol.split(',')):
        raise ValueError(
            "--model_noise got argument %s that does not have the same number of polarizations as -p argument %s."
            % (opts.model_noise, opts.pol))
    model_noises = {}
    for p, pol in enumerate(opts.pol.split(',')):
        model_noise_file = os.path.expanduser(opts.model_noise.split(',')[p])
        if not os.path.isfile(model_noise_file):
            raise IOError("model noise file %s does not exist" %
                          model_noise_file)
        model_noises[pol] = omni.load_omnichisq(model_noise_file)
        if np.max(omni.get_omnitime(model_noises[pol])) >= TPI or np.min(
                omni.get_omnitime(model_noises[pol])) < 0:
            raise ValueError(
                "Times stored in noise model %s is outside the range [0, 2pi)."
                % model_noise_file)
    have_model_noises = True
    chisq_leniency = opts.chisq_leniency

have_model_treasure = False
if opts.model_treasure is not None:
    if os.path.isdir(os.path.expanduser(opts.model_treasure)):
        model_treasure = omni.Treasure(os.path.expanduser(opts.model_treasure))
        for pol in opts.pol.split(','):
            if pol not in model_treasure.ubls.keys():
                raise ValueError(
                    "Polarization %s not found in the model treasure file %s."