R_s = np.sqrt(Z_s.real**2 + Z_s.imag**2) Phi = np.angle(Z, deg=False) # Create theoretical curve # if draw_theory: #Ttheo = np.linspace(T[0],T[-1], 1000) Xtd, Ytd, Xt, Yt = fk.Curve(l_trans, l_ref, harmonic, phi, a * max(abs(Z)), offset, T[0], T[-1], 1000) delay = T X = Z.real X_s = Z_s.real Y = Z.imag Y_s = Z_s.imag T_d, X_d, Y_d = fk.CutDataSet(T, X, Y, data_window) Z = X_d + 1j * Y_d scaling = 1E-4 #max(Z.real)/max(Ttheo) # Fourier traffo Zg = fk.GaussWindow(T_d, Z, suscept) Td = T[1] - T[0] if gauss: wn, dft = fk.DFT(T_d, Zg, Td, l_ref, harmonic, zeroPaddingFactor=zeroPaddingFactor) else: wn, dft = fk.DFT(T_d,
if dev == 'dev3269' and d == '1': def decay(t, amp, tau): return 0.002 + amp * np.exp(-t / tau) R_fit = R[115:329] #region of R that will be fitted delay_fit = delay[115:329] popt, pcov = curve_fit(decay, delay_fit, R_fit, p0=[0.8, 140.]) print('The time constant of the fit is {} fs'.format(popt[1])) X = Z.real X_s = Z_s.real Y = Z.imag Y_s = Z_s.imag T_d, X_d, Y_d = fk.CutDataSet(delay, X, Y, data_window) Z = X_d + 1j * Y_d scaling = 1E-4 #max(Z.real)/max(Ttheo) # Fourier traffo hann = np.kaiser(2 * len(Z), 2) Zh = hann[len(Z):] * Z Zg = fk.GaussWindow(T_d, Z, suscept) Td = -(delay[1] - delay[0]) # print Td if gauss: wn, dft = fk.DFT(T_d, Zg, Td, l_ref, harmonic,
if i0_6H_correction: Z = Z*i0_6H Z *= np.exp(1j*np.pi/180.*phas_corr) #phasing of dataset according to phase difference between reference and WPI signal R = np.abs(Z) Phi = np.angle(Z, deg=False) # plt.plot(np.unwrap(Phi)) # Create theoretical curve Ttheo = np.linspace(delay[0],delay[-1], 30000) Xtd,Ytd,Xt,Yt = fk.Curve(spc.h*spc.c/(spc.e*l_trans)*1e9, l_ref, harmonic, phi, a*max(abs(Z)), offset, delay[0], delay[-1], 30000) # theo curve for transition Xtd,Ytd,Xt,Yt = fk.Curve(l_fel/harmonic, l_ref, harmonic, phi, a*max(abs(Z)), offset, delay[0], delay[-1], 30000) # theo curve for laser CWL T_d,X_d,Y_d = fk.CutDataSet(delay, Z.real, Z.imag, data_window) Z_cut = X_d + 1j*Y_d Z_plot = Z_cut Z_cut = fk.Phasing_TD(Z_cut,T_d,E_r) #time domain phasing of data set to take into account position of data window scaling = 1 #max(Z.real)/max(Ttheo) # Fourier traffo Td = np.mean(np.unique(np.diff(delay))) if gauss: Zg = fk.GaussWindow(T_d, Z_cut, suscept) wn, dft = fk.DFT(T_d, Zg, Td, l_ref , harmonic, zeroPaddingFactor = zeroPaddingFactor) else: wn, dft = fk.DFT(T_d, Z_cut, Td, l_ref , harmonic, zeroPaddingFactor = zeroPaddingFactor) # dft = dft[::-1]
#seed laser AC sl_fwhm = 99. # seed intensity fwhm in fs t_theo_seed = np.linspace(-250, 250, 5000) sl_AC = np.exp(-4.0 * np.log(2) * (t_theo_seed / (sl_fwhm * np.sqrt(2)))**2) # seed laser AC sl_AC /= np.max(sl_AC) # ============================================================================= # spectrogram # ============================================================================= #analysing 5H Z5 = Z[4] Z5 *= np.exp(1j * np.pi / 180. * phas_corr) #phasing data T_d, X_d, Y_d = fk.CutDataSet(T, Z5.real, Z5.imag, data_window) Z5_cut = X_d + 1j * Y_d Z5_cut = fk.Phasing_TD(Z5_cut, T_d, E_r - E_undersamp) scaling = 1E-4 #max(Z.real)/max(Ttheo) # Fourier traffo Td = np.mean(np.unique(np.diff(T))) if gauss: Z5g = fk.GaussWindow(T_d, Z5_cut, suscept) wn, dft = fk.DFT(T_d, Z5g, Td, l_ref, harmonic, zeroPaddingFactor=zeroPaddingFactor) else: