Esempio n. 1
0
def plot_counts_vs_time(windowdata,
                        savepath,
                        window=1,
                        bins=700,
                        save_prefix='',
                        save_postfix=''):

    gated = hht3.filter_counts_on_marker(windowdata, 2, [window - 2])

    print 'length of window data = ', len(windowdata)

    fig = plt.figure()

    t0, t1 = hht3.get_click_times(windowdata)
    h0y, h0x = np.histogram(t0, bins=bins, range=(0, bins - 1))
    h1y, h1x = np.histogram(t1, bins=bins, range=(0, bins - 1))

    g_t0, g_t1 = hht3.get_click_times(gated)
    g_h0y, g_h0x = np.histogram(g_t0, bins=bins, range=(0, bins - 1))
    g_h1y, g_h1x = np.histogram(g_t1, bins=bins, range=(0, bins - 1))

    ax = plt.subplot(121)
    ax.semilogy(g_h0x[:-1], g_h0y, color='g', label='ch0 gated')
    ax.semilogy(h0x[:-1], h0y, label='ch0', color='b')
    ax.set_xlabel('Bins')
    ax.legend()

    ax = plt.subplot(122)
    ax.semilogy(h1x[:-1], h1y, label='ch1')
    ax.semilogy(g_h1x[:-1], g_h1y, label='ch1 gated')
    ax.set_xlabel('Bins')
    ax.legend()

    plt.suptitle('Clicks after optical pulse, window %d' % window)

    fig.savefig(os.path.join(savepath,'%shistogram_window%s%s.pdf' % \
            (save_prefix,window,save_postfix)))

    np.savez(os.path.join(savepath, 'histogram_window%s.npz' % window),
             window_number=window,
             window_data=windowdata,
             ch0=h0y,
             ch0_xaxis=h0x[:-1],
             ch0_gated=g_h0y,
             ch0_gated_xaxis=g_h0x[:-1],
             ch1=h1y,
             ch1_xaxis=h1x[:-1],
             ch1_gated=g_h1y,
             ch1_gated_xaxis=g_h1x[:-1])

    return True
Esempio n. 2
0
def plot_counts_vs_time(windowdata, savepath, window=1, bins=700,
        save_prefix='', save_postfix=''):
    
    gated = hht3.filter_counts_on_marker(windowdata, 2, [window-2])
    
    print 'length of window data = ',len(windowdata)

    fig = plt.figure()
    
    t0, t1 = hht3.get_click_times(windowdata)
    h0y, h0x = np.histogram(t0, bins=bins, range=(0,bins-1))
    h1y, h1x = np.histogram(t1, bins=bins, range=(0,bins-1))
    
    g_t0, g_t1 = hht3.get_click_times(gated)
    g_h0y, g_h0x = np.histogram(g_t0, bins=bins, range=(0,bins-1))
    g_h1y, g_h1x = np.histogram(g_t1, bins=bins, range=(0,bins-1))
    
    ax = plt.subplot(121)
    ax.semilogy(g_h0x[:-1], g_h0y, color = 'g', label='ch0 gated')
    ax.semilogy(h0x[:-1], h0y, label='ch0', color = 'b')
    ax.set_xlabel('Bins')
    ax.legend()

    ax = plt.subplot(122)
    ax.semilogy(h1x[:-1], h1y, label='ch1')
    ax.semilogy(g_h1x[:-1], g_h1y, label='ch1 gated')
    ax.set_xlabel('Bins')
    ax.legend()

    plt.suptitle('Clicks after optical pulse, window %d' % window)
    
    fig.savefig(os.path.join(savepath,'%shistogram_window%s%s.pdf' % \
            (save_prefix,window,save_postfix)))

    np.savez(os.path.join(savepath, 'histogram_window%s.npz'%window), 
        window_number = window, 
        window_data = windowdata, 
        ch0 = h0y, 
        ch0_xaxis = h0x[:-1],
        ch0_gated = g_h0y,
        ch0_gated_xaxis = g_h0x[:-1],
        ch1 = h1y, 
        ch1_xaxis = h1x[:-1],
        ch1_gated = g_h1y,
        ch1_gated_xaxis = g_h1x[:-1])

    return True
Esempio n. 3
0
def plot_counts_vs_time(data, rng=500.):
    
    fig = plt.figure()
    
    t0, t1 = hht3.get_click_times(data)
    h0y, h0x = np.histogram(t0, bins=rng+1, range=(0.,rng))
    h1y, h1x = np.histogram(t1, bins=rng+1, range=(0.,rng))
       
    ax = plt.subplot(121)
    ax.semilogy(h0x[:-1], h0y, 'o-', c='k', mfc='None', mec='k', label='ch0')
    ax.set_xlabel('Bins')
    ax.legend()

    ax = plt.subplot(122)
    ax.semilogy(h1x[:-1], h1y, 'o-', c='k', mfc='None', mec='k', label='ch1')
    ax.set_xlabel('Bins')
    ax.legend()
Esempio n. 4
0
def plot_counts_vs_time(data, rng=500.0):

    fig = plt.figure()

    t0, t1 = hht3.get_click_times(data)
    h0y, h0x = np.histogram(t0, bins=rng + 1, range=(0.0, rng))
    h1y, h1x = np.histogram(t1, bins=rng + 1, range=(0.0, rng))

    ax = plt.subplot(121)
    ax.semilogy(h0x[:-1], h0y, "o-", c="k", mfc="None", mec="k", label="ch0")
    ax.set_xlabel("Bins")
    ax.legend()

    ax = plt.subplot(122)
    ax.semilogy(h1x[:-1], h1y, "o-", c="k", mfc="None", mec="k", label="ch1")
    ax.set_xlabel("Bins")
    ax.legend()
Esempio n. 5
0
def plot_counts_vs_time(data, rng=500.):
    
    fig = plt.figure()
    
    t0, t1 = hht3.get_click_times(data)
    h0y, h0x = np.histogram(t0, bins=rng+1, range=(0.,rng))
    h1y, h1x = np.histogram(t1, bins=rng+1, range=(0.,rng))
       
    ax = plt.subplot(121)
    ax.semilogy(h0x[:-1], h0y, 'o-', c='k', mfc='None', mec='k', label='ch0')
    ax.set_xlabel('Bins')
    ax.legend()

    ax = plt.subplot(122)
    ax.semilogy(h1x[:-1], h1y, 'o-', c='k', mfc='None', mec='k', label='ch1')
    ax.set_xlabel('Bins')
    ax.legend()