Beispiel #1
0
def show_rfi_sk(band):
    """Display the result of an SK measurement for the given band
       (an integer between 1 and 34)."""
    import matplotlib.pyplot as plt
    import numpy as np

    pcapfile = "/home/user/Python/band" + str(band) + "_2.pcap"
    out1 = p.rd_spec(pcapfile)
    out1.shape = (200, 4096, 8)
    good = np.where(out1[:, 1000, 0] != 0)[0]
    n = len(good)
    out1 = out1[good, :, :]
    sk = (1792 + 1) / (1792.0 - 1) * (1792 * out1[:, :, 4:8] / (out1[:, :, 0:4] ** 2) - 1)
    plt.figure()
    title = ["Ant1 X", "Ant1 Y", "Ant2 X", "Ant2 Y"]
    for i in range(4):
        plt.subplot(4, 1, i + 1)
        plt.imshow(np.logical_or(sk[:, :, i] > 1.15, sk[:, :, i] < 0.85), aspect="auto", interpolation="nearest")
        plt.title(title[i])
    plt.set_cmap("gray")
    pcapfile = "/home/user/Python/band" + str(band) + "_3.pcap"
    out2 = p.rd_spec(pcapfile)
    out2.shape = (200, 4096, 8)
    good = np.where(out2[:, 1000, 0] != 0)[0]
    n = len(good)
    out2 = out2[good, :, :]
    sk = (1792 + 1) / (1792.0 - 1) * (1792 * out2[:, :, 4:8] / (out2[:, :, 0:4] ** 2) - 1)
    plt.figure()
    title = ["Ant3 X", "Ant3 Y", "Ant4 X", "Ant4 Y"]
    for i in range(4):
        plt.subplot(4, 1, i + 1)
        plt.imshow(np.logical_or(sk[:, :, i] > 1.15, sk[:, :, i] < 0.85), aspect="auto", interpolation="nearest")
        plt.title(title[i])
    return out1, out2
Beispiel #2
0
def show_rfi_sk(band):
    '''Display the result of an SK measurement for the given band
       (an integer between 1 and 34).'''
    import matplotlib.pyplot as plt
    import numpy as np
    pcapfile = '/home/user/Python/band' + str(band) + '_2.pcap'
    out1 = p.rd_spec(pcapfile)
    out1.shape = (200, 4096, 8)
    good = np.where(out1[:, 1000, 0] != 0)[0]
    n = len(good)
    out1 = out1[good, :, :]
    sk = (1792 + 1) / (1792. - 1) * (1792 * out1[:, :, 4:8] /
                                     (out1[:, :, 0:4]**2) - 1)
    plt.figure()
    title = ['Ant1 X', 'Ant1 Y', 'Ant2 X', 'Ant2 Y']
    for i in range(4):
        plt.subplot(4, 1, i + 1)
        plt.imshow(np.logical_or(sk[:, :, i] > 1.15, sk[:, :, i] < 0.85),
                   aspect='auto',
                   interpolation='nearest')
        plt.title(title[i])
    plt.set_cmap('gray')
    pcapfile = '/home/user/Python/band' + str(band) + '_3.pcap'
    out2 = p.rd_spec(pcapfile)
    out2.shape = (200, 4096, 8)
    good = np.where(out2[:, 1000, 0] != 0)[0]
    n = len(good)
    out2 = out2[good, :, :]
    sk = (1792 + 1) / (1792. - 1) * (1792 * out2[:, :, 4:8] /
                                     (out2[:, :, 0:4]**2) - 1)
    plt.figure()
    title = ['Ant3 X', 'Ant3 Y', 'Ant4 X', 'Ant4 Y']
    for i in range(4):
        plt.subplot(4, 1, i + 1)
        plt.imshow(np.logical_or(sk[:, :, i] > 1.15, sk[:, :, i] < 0.85),
                   aspect='auto',
                   interpolation='nearest')
        plt.title(title[i])
    return out1, out2
Beispiel #3
0
def qlook(file):
    ''' Routine to show all four channels (2 ants, 2 poln) for
        a pcapture file with a name of pattern 'bandnn_e.pcap'
        where nn is band number (can be 1 digit) and e is 
        ethernet interface (eth) number (2 or 3)
    '''
    import matplotlib.pyplot as plt
    out = p.rd_spec(file).reshape(200, 4096, 8)
    f, ax = plt.subplots(4, 1, sharex=True)
    ax[0].imshow(out[:, :, 0])
    ax[1].imshow(out[:, :, 1])
    ax[2].imshow(out[:, :, 2])
    ax[3].imshow(out[:, :, 3])
    band = file.split('band')[1].split('_')[0]
    if file.find('_2') != -1:
        ax[0].set_title('Ants 1 & 2, band ' + band)
    else:
        ax[0].set_title('Ants 3 & 4, band ' + band)
    return out
Beispiel #4
0
def qlook(file):
    """ Routine to show all four channels (2 ants, 2 poln) for
        a pcapture file with a name of pattern 'bandnn_e.pcap'
        where nn is band number (can be 1 digit) and e is 
        ethernet interface (eth) number (2 or 3)
    """
    import matplotlib.pyplot as plt

    out = p.rd_spec(file).reshape(200, 4096, 8)
    f, ax = plt.subplots(4, 1, sharex=True)
    ax[0].imshow(out[:, :, 0])
    ax[1].imshow(out[:, :, 1])
    ax[2].imshow(out[:, :, 2])
    ax[3].imshow(out[:, :, 3])
    band = file.split("band")[1].split("_")[0]
    if file.find("_2") != -1:
        ax[0].set_title("Ants 1 & 2, band " + band)
    else:
        ax[0].set_title("Ants 3 & 4, band " + band)
    return out