예제 #1
0
def fit_signal_gauss(binning):
    xlim = gl.corrAx.get_xlim()
    ylim = gl.corrAx.get_ylim()
    disp.refresh_display(binning)
    if gl.boolSig == True:
        lborder = int(gl.fitRangeLeftEntry.get())
        rborder = int(gl.fitRangeRightEntry.get())
        sig_start = 2.
        x_fit = np.arange(lborder, rborder + 1, 1)
        y_fit = gl.g2_sig[lborder:rborder + 1]
        med_start = np.argmax(y_fit) + lborder
        amp_start = np.argmax(y_fit) - 1.
        popt, pcov = curve_fit(gauss,
                               x_fit,
                               y_fit,
                               p0=[amp_start, med_start, sig_start, 1.])
        perr = np.sqrt(np.diag(pcov))
        gl.x_plot = np.arange(lborder, rborder + 1, 0.01)
        try:
            gl.corrAx.gl.fit_plot.remove()
        except:
            pass
        gl.fit_plot = gl.corrAx.plot(gl.x_plot,
                                     gauss(gl.x_plot, *popt),
                                     color="red")
        gl.corrAx.set_xlim(xlim)
        gl.corrAx.set_ylim(ylim)
        I, dI = get_integral(popt, perr, binning)
        gl.intValLabel.config(text="{:.1f} +/- {:.1f} fs".format(I, dI))
        #gl.timeResValLabel.config(text="{:.2f} +/- {:.2f} ns".format(1e9*binning*popt[2], binning*perr[2]))

    else:
        print("No Signal measurement available")
예제 #2
0
def fit_difference_shape(binning):
    make_peak_fu()
    xlim = gl.corrAx.get_xlim()
    ylim = gl.corrAx.get_ylim()
    disp.refresh_display(binning)
    if gl.boolSig == True and gl.boolRef == True:
        lborder = int(gl.fitRangeLeftEntry.get())
        rborder = int(gl.fitRangeRightEntry.get())
        sig_start = 2.
        x_fit = np.arange(lborder, rborder + 1, 1)
        y_fit = gl.g2_diff[lborder:rborder + 1]
        med_start = np.argmax(y_fit) + lborder
        amp_start = np.argmax(y_fit) - 1.
        popt, pcov = curve_fit(peak_fu,
                               x_fit,
                               y_fit,
                               p0=[amp_start, med_start, 1.])
        perr = np.sqrt(np.diag(pcov))
        gl.x_plot = np.arange(lborder, rborder + 1, 0.01)
        try:
            gl.corrAx.gl.fit_plot.remove()
        except:
            pass
        gl.fit_plot = gl.corrAx.plot(gl.x_plot,
                                     peak_fu(gl.x_plot, *popt),
                                     color="orange")
        gl.corrAx.set_xlim(xlim)
        gl.corrAx.set_ylim(ylim)
        I = 1e6 * 1e9 * binning * popt[0]
        dI = 1e6 * 1e9 * binning * perr[0]
        gl.intValLabel.config(text="{:.1f} +/- {:.1f} fs".format(I, dI))
        #gl.timeResValLabel.config(text="{:.2f} +/- {:.2f} ns".format(1e9*binning*popt[2], 1e9*binning*perr[2]))

    else:
        print("No Difference measurement available")
예제 #3
0
def switch_logyButton():
    if gl.boolRMSlogy == False:
        gl.boolRMSlogy = True
        RMSlogyButton.config(text="RMS log(y) ON", bg="#f77059")
    else:
        gl.boolRMSlogy = False
        RMSlogyButton.config(text="RMS log(y) OFF", bg="#fad1ca")
    xlim = gl.corrAx.get_xlim()
    ylim = gl.corrAx.get_ylim()
    disp.refresh_display(binning=float(binningoptions[binning.get()]))
    gl.corrAx.set_xlim(xlim)
    gl.corrAx.set_ylim(ylim)
예제 #4
0
def cumulate_signal_per_file(binning):
    bas.reset_values()

    if gl.boolSig == True:
        print("Analyze Signal ...")
        file_list_sig()
        gl.isum_sig = np.zeros(len(np.loadtxt(gl.files_sig[0])[:, 1]))
        for i in range(0, len(gl.files_sig)):
            get_photon_rate_sig(i, binning)
            single_RMS_sig(i, binning)
            single_RMS_sig_exp(i, binning)
            cumulative_g2_per_file_sig(i)
            cumulative_RMS_sig(binning, method=1)
            cumulative_RMS_sig_exp(i, binning)
        gl.g2_sig = get_g2_per_file_sig()
        bas.correlate_shapes()

    if gl.boolRef == True:
        print("Analyze Reference ...")
        file_list_ref()
        gl.isum_ref = np.zeros(len(np.loadtxt(gl.files_ref[0])[:, 1]))
        for i in range(0, len(gl.files_ref)):
            get_photon_rate_ref(i, binning)
            single_RMS_ref(i, binning)
            single_RMS_ref_exp(i, binning)
            cumulative_g2_per_file_ref(i)
            cumulative_RMS_ref(binning, method=1)
            cumulative_RMS_ref_exp(i, binning)
            if gl.boolSig == True:
                cumulative_RMS_diff(binning, method=1)
                cumulative_RMS_diff_exp(i)
        gl.g2_ref = get_g2_per_file_ref()
        if gl.boolSig == True:
            gl.g2_diff = get_cumulative_g2_diff_per_file()

    fft(binning)
    disp.refresh_display(binning)
    print("Done\n")