示例#1
0
        if spectrogram:
            # plot spec
            figFT = plt.figure('scan_{0:03}_{1}_d{2}_SG_{3}'.format(
                run, dev, d, i))
            print(T_d[0], T_d[-1])
            slide_step = Td  #in fs
            FWHM_slide = 20.0  #in fs
            t_lim = data_window
            slide_positions = np.arange(T_d[0], T_d[-1], slide_step)
            S = np.zeros((np.size(T_d), np.size(wn)))
            i = 0
            for slide_pos in slide_positions:
                Z_slide = fk.slide_window(
                    T_d, Z, slide_pos, FWHM_slide
                )  # multiply gaussian onto data set which is centered at current sliding position
                wn, DFT_slide = fk.DFT(
                    T_d, Z_slide, Td, l_ref, harmonic, zeroPaddingFactor=2
                )  # FFT of interferogram which has been truncated by mulitplying wiht gaussian
                # add DFT to spectrum-matrix while weighting with temporal gaussian envelope
                #                for i in range(np.size(T_d)):
                #                    S[i,:] += abs(DFT_slide)/max(abs(DFT_slide))*fk.weighting_coeff(T_d[i], slide_pos, FWHM_slide)
                S[i, :] += abs(DFT_slide) / max(abs(DFT_slide))
                i += 1
            S[:, :] /= np.size(slide_positions)
            fk.plot_spectrogram(figFT, wn, T_d, S, l_fel, wn_lim, t_lim)
#            plt.show()

if not interactive_plots:
    plt.close('all')
else:
    plt.show()
            for slide_pos in slide_positions:
                Z_slide = fk.slide_window(
                    delay, Z, slide_pos, FWHM_slide
                )  # multiply gaussian onto data set which is centered at current sliding position
                wn, DFT_slide = fk.DFT(
                    T_d,
                    Z_slide,
                    Td,
                    l_ref,
                    harmonic,
                    zeroPaddingFactor=zeroPaddingFactor
                )  # FFT of interferogram which has been truncated by mulitplying wiht gaussian
                S[i, :] += abs(DFT_slide) / max(abs(DFT_slide))
                i += 1
            S[:, :] /= np.size(slide_positions)
            fk.plot_spectrogram(figFT, wn, delay, S, l_fel / 5., l_trans,
                                wn_lim_s, data_window)
            plt.tight_layout()

if not interactive_plots:
    plt.close('all')
else:
    plt.show()

#i0_list = [i0_0H,i0_1H,i0_2H,i0_3H,i0_4H,i0_5H,i0_0H+i0_1H+i0_2H+i0_3H+i0_4H+i0_5H]
#for ii in i0_list:
#    plt.plot(delay,ii)
#    plt.xlabel('delay [fs]')
#    plt.ylabel('i0 [a.u.]')
#plt.legend(['0H','1H','2H','3H','4H','5H','sum'])

#
    slide_step = Td  #in fs
    FWHM_slide = 20.0  #in fs
    t_lim = data_window
    slide_positions = np.arange(delay[0],delay[-1], slide_step)
    S = np.zeros((np.size(delay), np.size(wn)))
    i = 0
    for slide_pos in slide_positions:
        Z_slide = fk.slide_window(delay, Z, slide_pos, FWHM_slide)    # multiply gaussian onto data set which is centered at current sliding position
        wn,  DFT_slide = fk.DFT(delay, Z_slide, Td, l_ref, harmonic, zeroPaddingFactor = zeroPaddingFactor)   # FFT of interferogram which has been truncated by mulitplying wiht gaussian           
        # add DFT to spectrum-matrix while weighting with temporal gaussian envelope
#                for i in range(np.size(T_d)):
#                    S[i,:] += abs(DFT_slide)/max(abs(DFT_slide))*fk.weighting_coeff(T_d[i], slide_pos, FWHM_slide)
        S[i,:] += abs(DFT_slide)/max(abs(DFT_slide))
        i += 1
    S[:,:] /= np.size(slide_positions)
    fk.plot_spectrogram(figFT, wn, delay, S, l_fel/6., 1E7/l_trans, wn_lim_s, t_lim)
#            plt.show()
    


#print delay

#figTD = plt.figure("zoom",figsize=(7,6))
#
#ax = figTD.add_subplot(111)
##ax.errorbar(delay, X, yerr=X_s, color='b', linestyle='')
#ax.plot(delay, Z.real, 'o-', color='b')
#ax.plot(delay, Z.imag, 'o-', color='g')
#ax.plot(Ttheo, Xt*0.34, 'b', alpha=0.3)
#ax.legend(['real','imag','real_theo'])
#ax.set_xlim(-20,20)
            S = np.zeros((np.size(T_d), np.size(wn)))
            i = 0
            for slide_pos in slide_positions:
                Z_slide = fk.slide_window(
                    T_d, Z, slide_pos, FWHM_slide
                )  # multiply gaussian onto data set which is centered at current sliding position
                wn, DFT_slide = fk.DFT(
                    T_d, Z_slide, Td, l_ref, harmonic, zeroPaddingFactor=2
                )  # FFT of interferogram which has been truncated by mulitplying wiht gaussian
                # add DFT to spectrum-matrix while weighting with temporal gaussian envelope
                #                for i in range(np.size(T_d)):
                #                    S[i,:] += abs(DFT_slide)/max(abs(DFT_slide))*fk.weighting_coeff(T_d[i], slide_pos, FWHM_slide)
                S[i, :] += abs(DFT_slide) / max(abs(DFT_slide))
                i += 1
            S[:, :] /= np.size(slide_positions)
            fk.plot_spectrogram(figFT, wn, T_d, S, l_fel / 5, l_trans, wn_lim,
                                t_lim)
#            plt.show()

if not interactive_plots:
    plt.close('all')
else:
    plt.show()

#''' Plots for Paper '''
#ticksize= 2.
#ticklength = 5.
#fontsize=16.
#plt.rcParams['xtick.labelsize'] = fontsize
#plt.rcParams['ytick.labelsize'] = fontsize
#plt.rcParams['axes.labelsize'] = fontsize
#plt.rcParams['xtick.major.width'] = ticksize