예제 #1
0
    def test_construct_pstokes_multipol(self):
        """test construct_pstokes on multi-polarization files"""
        uvd = pyuvdata.UVData()
        uvd.read(multipol_dset)
        uvc = pyuvdata.UVCal()
        uvc.read_calfits(multipol_dset_cal)
        uvutils.uvcalibrate(uvd, uvc)
        wgts = [(0.5, 0.5), (0.5, -0.5)]

        for i, ps in enumerate(['pI', 'pQ']):
            uvp = pstokes.construct_pstokes(dset1=uvd, dset2=uvd, pstokes=ps)
            # assert polarization array is correct
            assert uvp.polarization_array == np.array([i + 1])
            # assert data are properly summmed
            pstokes_vis = uvd.get_data(23, 24, 'xx') * wgts[i][0] + uvd.get_data(23, 24, 'yy') * wgts[i][1]
            assert np.isclose(pstokes_vis, uvp.get_data(23, 24, ps)).all()
예제 #2
0
#! /usr/bin/env python
import numpy as np, pylab as plt
import pyuvdata, hera_cal
import uvtools
import sys

omni_files = sys.argv[1:]
print omni_files

oc = pyuvdata.UVCal()
oc.read_calfits(omni_files)
gains = oc.gain_array.squeeze()
print gains.shape
for i in [0,1,5]:
    ai = oc.ant_array[i]
    g = gains[i,...,0].T
    plt.figure()
    uvtools.plot.waterfall(g, mode='lin', mx=2, drng=2)
    plt.title(ai)
    plt.figure()
    uvtools.plot.waterfall(g, mode='phs')
    plt.title(ai)
    plt.show()
예제 #3
0
import pyuvdata
import glob
import numpy as np
import matplotlib.pyplot as plt
from math import ceil
from matplotlib import cm

inpath = '/data6/HERA/data/2458042/'
first_pathlist = glob.glob(inpath + '*.first.calfits')
omni_pathlist = glob.glob(inpath + '*.omni.calfits')
first_outpath = '/data4/mwilensky/cal_gains/first/'
omni_outpath = '/data4/mwilensky/cal_gains/omni/'
pol_titles = {-1: 'rr', -2: 'll', -3: 'rl', -4: 'lr', -5: 'xx', -6: 'yy', -7: 'xy', -8: 'yx'}

first_cal = pyuvdata.UVCal()
omni_cal = pyuvdata.UVCal()

for path in first_pathlist:
    first_cal.read_calfits(path)
    end = path.find('.HH')
    obs = path[path.find('zen'):end + 3]
    pol = path[end - 2:end]
    gain_amp = np.absolute(first_cal.gain_array)

    dim = ceil(np.sqrt(first_cal.Nants_data))
    fig, ax = plt.subplots(figsize=(14, 8), nrows=dim, ncols=dim)
    fig.suptitle('First Cal Gain Amplitude ' + pol)
    cmap = cm.plasma
    vmin = np.amin(gain_amp)
    vmax = np.amax(gain_amp)
예제 #4
0
import optparse
import sys
import pyuvdata
import glob
import pylab as p

### Options ###
o = optparse.OptionParser()
o.set_usage('inspect_delays.py [options] *firstcal.fits')
o.set_description(__doc__)
a.scripting.add_standard_options(o, pol=True)
opts, args = o.parse_args(sys.argv[1:])

delays = {}
for f in args:
    cal = pyuvdata.UVCal()
    cal.read_calfits(f)
    print " Reading calibration: {0}".format(f)

    if cal.cal_type != 'delay':
        print "Not a file with delays, exiting..."
        exit()

    for i, ant in enumerate(cal.ant_array):
        if not ant in delays:
            delays[ant] = []
        delays[ant].append(cal.delay_array[i, 0, :, 0])

for ant in cal.ant_array:
    p.plot(1e9 * np.concatenate(delays[ant]).flatten(), '.', label=str(ant))
p.xlabel('time bins')