Beispiel #1
0
             (Q_mixercalibrated - np.mean(Q_mixercalibrated))**2)

###   Get index of maximum point and
###   cut measurement data 500 points left from the peak and
###   2500 points right from the peak
numleft = 500
numright = 2500
index = IQ.argmax()
Ievent = I_mixercalibrated[index - numleft:index + numright]
Qevent = Q_mixercalibrated[index - numleft:index + numright]
amplitude = np.asarray(IQ[index - numleft:index + numright])
phase = np.arctan2(Qevent, Ievent)

###   Transfer number to time with microsecond unit
t = num[index - numleft:index + numright] / fs * 1e6
a, a_err, A, A_err, t0, t0_err, tau, tau_err, taur, taur_err, fit_report, residual = Fitter.Fit_CosmicRay(
    t, amplitude)
fitresult = Fitter.Fit_CosmicRay_model(t, t0, a, A, tau, taur)

###   Plot data and fitting result and residual
font = {
    'family': 'serif',
    'color': 'darkred',
    'weight': 'normal',
    'size': 10,
}

with PdfPages(cosraydata_folder + cosraydata_file + '.pdf') as pdf:
    plt.figure(figsize=(18.5, 10.5))

    plt.subplot(2, 1, 1)
    plt.plot(t, fitresult, '.r')