Exemplo n.º 1
0
def generate_data_products():
    '''
    I need a variety of intermediate data products in order to create 
    the figures.
    '''
    TOT_bounds, VCD_bounds, THW_bounds = find_quiet_regions()
    VCD_rawfile = WAIS + '/orig/xlob/VCD/JKB2g/DVD01a/RADnh3/bxds'
    TOT_rawfile = WAIS + '/orig/xlob/TOT/JKB2d/X16a/RADnh3/bxds'
    THW_rawfile = WAIS + '/orig/xlob/THW/SJB2/DRP02a/RADjh1/bxds1'

    insamples = 3437
    outsamples = 3200
    channel = 2
    blanking = 200
    scale = 1000

    num_sweeps = pik1_utils.get_num_traces(TOT_rawfile, insamples)
    reference_chirp = pik1_utils.generate_reference_chirp()
Exemplo n.º 2
0
def generate_data_products():
    '''
    I need a variety of intermediate data products in order to create 
    the figures.
    '''
    TOT_bounds, VCD_bounds, THW_bounds = find_quiet_regions()
    VCD_rawfile = WAIS + '/orig/xlob/VCD/JKB2g/DVD01a/RADnh3/bxds'
    TOT_rawfile = WAIS + '/orig/xlob/TOT/JKB2d/X16a/RADnh3/bxds'
    THW_rawfile = WAIS + '/orig/xlob/THW/SJB2/DRP02a/RADjh1/bxds1'
    
    insamples = 3437
    outsamples = 3200
    channel = 2
    blanking = 200
    scale = 1000

    num_sweeps = pik1_utils.get_num_traces(TOT_rawfile, insamples)
    reference_chirp = pik1_utils.generate_reference_chirp()
Exemplo n.º 3
0
def plot_filter_freqs():
    '''
    Shows the various frequencies within the system, and what the filter does.
    '''
    # Each bin is one sample; sampled at 50Mhz
    nbins = 3200

    # Time of each sample, in us
    tt = np.arange(0, nbins / 50., 1 / 50.)
    # 70MHz local oscillator signal
    y70 = np.sin(2 * np.pi * tt * 70)
    fft70 = np.fft.fft(y70, n=nbins)
    # 140MHz - LO's first harmonic
    y140 = np.sin(2 * np.pi * tt * 140)
    fft140 = np.fft.fft(y140, n=nbins)

    # Reference chirp used for actual pik1 dechirping
    ref_chirp = pik1_utils.generate_reference_chirp()
    y_ref = np.zeros(nbins)
    y_ref[100:100 + len(ref_chirp)] = ref_chirp
    fft_ref = np.fft.fft(y_ref, n=nbins)

    # theoretical reference chirp
    theoretical_chirp = pik1_utils.generate_theoretical_chirp()
    y_theory = np.zeros(nbins)
    y_theory[100:100 + len(theoretical_chirp)] = theoretical_chirp
    fft_theory = np.fft.fft(y_theory, n=nbins)

    # Frequency of fft bins, in MHz
    fftfreq = np.fft.fftfreq(nbins, 1 / 50.)

    # ideal chirp frequency content
    fft_ideal = [
        1.0 if 2.5 <= np.abs(elem) <= 17.5 else 0.0 for elem in fftfreq
    ]

    # Hanning filter
    hfilter = pik1_utils.generate_hfilter(nbins)

    fig = Figure((15, 3.5))
    canvas = FigureCanvas(fig)
    ax = fig.add_axes([0.05, 0.25, 0.9, 0.7])

    ax.plot(fftfreq,
            np.abs(fft_ref) / np.max(np.abs(fft_ref)),
            linewidth=1,
            color='black',
            label='pik1 reference chirp')
    ax.plot(fftfreq,
            np.abs(fft_theory) / np.max(np.abs(fft_theory)),
            linewidth=2,
            color='darkgrey',
            label='theoretical reference chirp')
    ax.plot(fftfreq,
            np.abs(fft_ideal) / np.max(np.abs(fft_ideal)),
            linewidth=2,
            color='lightgrey',
            label='theoretical reference chirp')
    ax.plot(fftfreq,
            np.abs(fft70) / np.max(np.abs(fft70)),
            linewidth=2,
            color='blue',
            label='FFT of 70MHz signal')
    ax.plot(fftfreq,
            np.abs(fft140) / np.max(np.abs(fft140)),
            linewidth=2,
            color='blue',
            label='FFT of 1st harmonic of LO')
    ax.plot(fftfreq,
            hfilter / np.max(hfilter),
            linewidth=2,
            color='red',
            label='Hamming filter')
    ax.set_ylim([0, 1.05])
    ax.set_xlim([-25, 25])
    ax.set_xlabel('Frequency (MHz)', fontsize=24)
    #ax.legend()
    ax.tick_params(which='both',
                   bottom=True,
                   top=False,
                   left=False,
                   right=False,
                   labelbottom=True,
                   labeltop=False,
                   labelleft=False,
                   labelright=False,
                   labelsize=18)
    for side in ['top', 'left', 'right']:
        ax.spines[side].set_visible(False)

    canvas.print_figure('../FinalReport/figures/filter_frequencies.png')
Exemplo n.º 4
0
def plot_filter_freqs():
    '''
    Shows the various frequencies within the system, and what the filter does.
    '''
    # Each bin is one sample; sampled at 50Mhz
    nbins = 3200

    # Time of each sample, in us
    tt = np.arange(0, nbins/50., 1/50.)
    # 70MHz local oscillator signal
    y70 = np.sin(2*np.pi*tt*70)
    fft70 = np.fft.fft(y70, n=nbins)
    # 140MHz - LO's first harmonic
    y140 = np.sin(2*np.pi*tt*140)
    fft140 = np.fft.fft(y140, n=nbins)

    # Reference chirp used for actual pik1 dechirping
    ref_chirp = pik1_utils.generate_reference_chirp()
    y_ref = np.zeros(nbins)
    y_ref[100:100+len(ref_chirp)] = ref_chirp
    fft_ref = np.fft.fft(y_ref, n=nbins)

    # theoretical reference chirp
    theoretical_chirp = pik1_utils.generate_theoretical_chirp()
    y_theory = np.zeros(nbins)
    y_theory[100:100+len(theoretical_chirp)] = theoretical_chirp
    fft_theory = np.fft.fft(y_theory, n=nbins)    

    # Frequency of fft bins, in MHz
    fftfreq = np.fft.fftfreq(nbins, 1/50.)

    # ideal chirp frequency content
    fft_ideal = [1.0 if 2.5 <= np.abs(elem) <= 17.5 else 0.0 for elem in fftfreq]

    # Hanning filter
    hfilter = pik1_utils.generate_hfilter(nbins)

    fig = Figure((15,3.5))
    canvas = FigureCanvas(fig)
    ax = fig.add_axes([0.05, 0.25, 0.9, 0.7])

    ax.plot(fftfreq, np.abs(fft_ref)/np.max(np.abs(fft_ref)), 
            linewidth=1, color='black', label='pik1 reference chirp')
    ax.plot(fftfreq, np.abs(fft_theory)/np.max(np.abs(fft_theory)), 
            linewidth=2, color='darkgrey', label='theoretical reference chirp')
    ax.plot(fftfreq, np.abs(fft_ideal)/np.max(np.abs(fft_ideal)), 
            linewidth=2, color='lightgrey', label='theoretical reference chirp')
    ax.plot(fftfreq, np.abs(fft70)/np.max(np.abs(fft70)), 
            linewidth=2, color='blue', label='FFT of 70MHz signal')
    ax.plot(fftfreq, np.abs(fft140)/np.max(np.abs(fft140)), 
            linewidth=2, color='blue', label='FFT of 1st harmonic of LO')
    ax.plot(fftfreq, hfilter/np.max(hfilter), linewidth=2, color='red',
            label='Hamming filter')
    ax.set_ylim([0, 1.05])
    ax.set_xlim([-25, 25])
    ax.set_xlabel('Frequency (MHz)', fontsize=24)
    #ax.legend()
    ax.tick_params(which='both', bottom=True, top=False, left=False, right=False,
                   labelbottom=True, labeltop=False, labelleft=False, labelright=False,
                   labelsize=18)
    for side in ['top', 'left', 'right']:
        ax.spines[side].set_visible(False)

    canvas.print_figure('../FinalReport/figures/filter_frequencies.png')