diff --git a/PLE/120_plot_2D_contourf.py b/PLE/120_plot_2D_contourf.py new file mode 100644 index 0000000..dc93f69 --- /dev/null +++ b/PLE/120_plot_2D_contourf.py @@ -0,0 +1,92 @@ +# -*- coding: utf-8 -*- +""" +Created on Sun Nov 10 15:42:46 2024 + +@author: shen_t2 +""" + + +import os +os.chdir(os.path.abspath(os.path.dirname(__file__))) + +import numpy as np +import matplotlib.pyplot as plt +plt.rcParams.update({'font.size': 14}) + + +#%% + +MAIN_EXP_folder = 'C:/RE_qubit_TS/202504_CW_PLE_167Er/20250408_BalongcScan_sigma/' +os.chdir(MAIN_EXP_folder) + +timestampsuffix = '_04080258.npy' + +actual_counts_all = np.load('actual_counts_All_Bfields_rep0' + timestampsuffix) +raw_counts_all = np.load('actual_counts_All_Bfields_rep0' + timestampsuffix) + + +B_field_all = np.load('wl_scan_Bfields' + timestampsuffix) +wl_scan_all = np.load('wl_scan_x_axis_20.00_120.00_speed0.5000_CWGatedD' + timestampsuffix) + +B_field_all = B_field_all.reshape(len(B_field_all), 1) +B_field_all = np.repeat(B_field_all, len(wl_scan_all), axis=1) + +wl_scan_all = np.tile(wl_scan_all, (len(B_field_all), 1) ) + +wn_PLE_c = 6535.0997 # OK w/o precise fitting +wn_FTIR_c = 6534.356431 +wn_scan_all = wl_scan_all#1e7 / wl_scan_all - wn_PLE_c + wn_FTIR_c + + +#%% + +counts_all = raw_counts_all +counts_threshold = 2500 + +counts_all = actual_counts_all +counts_threshold = 40000 + + + +plt.figure(11, figsize=[9,6], dpi=100) +plt.clf() + +plt.pcolormesh(B_field_all, wn_scan_all, counts_all, norm='linear', + vmin=0, + # vmax=counts_threshold, # to see satellites + cmap='RdBu') +plt.colorbar(label='Photon Counting (cps)') + + +# to see the full +# plt.contourf(B_field_all, wn_scan_all, counts_all, +# cmap='RdBu', levels=200) +# plt.colorbar(label='Photon Counting (cps)') + +# to see satellites +# plt.contourf(B_field_all, wn_scan_all, counts_all, +# levels=np.linspace(0, counts_threshold, 201), +# cmap='RdBu', +# extend='both') +# plt.colorbar(label='Photon Counting (cps)', ticks=np.linspace(0, counts_threshold, 6)) + + +# plt.grid() +# plt.legend(loc=1) + +plt.title('Gated CW PLE @ #22, 0.01%, 167Er, 3.4 K, OD 0.5,\n 1/2 V/s, AOM, DAQ = 10 ms, sigma $E\perp c$, $B_{ext}\parallel c$') +plt.xlabel('Magnetic field (Gauss)') +plt.ylabel('Calibrated wavenumber (cm$^{-1}$)') +plt.ylabel('Piezo voltage (V)') +# plt.ylabel('Wavelength (nm)') + + +# plt.xlim(-100, ) +# plt.ylim(6533.5, 6536.0) +plt.tight_layout() + +plt.savefig( MAIN_EXP_folder + '20250408_plot_BalongcScan_sigma_167Er_full.jpg' ) +plt.show() + + + diff --git a/PLE/131_fit_T1.py b/PLE/131_fit_T1.py new file mode 100644 index 0000000..e4d71ae --- /dev/null +++ b/PLE/131_fit_T1.py @@ -0,0 +1,67 @@ +# -*- coding: utf-8 -*- +""" +Created on Wed Feb 5 13:08:12 2025 + +@author: shen_t2 +""" + + +import os +# os.chdir(os.path.abspath(os.path.dirname(__file__))) + +import numpy as np +import matplotlib.pyplot as plt +plt.rcParams.update({'font.size': 14}) + +from scipy import optimize + + +# %% + +MAIN_EXP_folder = 'C:/RE_qubit_TS/202510_T1_pair/20250208_T1/' +os.chdir(MAIN_EXP_folder) + +timestampsuffix = '_02081615.npy' + +time_scan = np.load('detection_delay_x_axis_0-120ms' + timestampsuffix) # in [us] +time_scan *= 1e-3 # in [ms] + +# raw_count_rep = np.load('raw_counts_B150Gs_rep0_exc30ms_count3ms' + timestampsuffix) +actual_count_rep = np.load('actual_counts_B150Gs_rep0_exc30ms_count3ms' + timestampsuffix) +actual_count_rep /= np.max(actual_count_rep) + + + +# %% + +def _ExpDecay(t, tau): + return np.exp(-t/tau) + +(popt, pcov, infodict, mesg, ier) = optimize.curve_fit(_ExpDecay, time_scan, actual_count_rep, + # p0 = [0, 1.88, 1.94, 5.5], + full_output=True) +# (popt, pcov, infodict, mesg, ier) + + + +# %% + + +plt.figure(131, figsize=[9,6], dpi=100) +plt.clf() +# plt.plot(time_scan, raw_count_rep, '.-b', label= 'raw counts' ) +plt.plot(time_scan, actual_count_rep, '.-r', label='Experiment' ) +plt.plot(time_scan, _ExpDecay(time_scan, *popt), '--b', label='Fitted $T_1$ = {:.2f} ms'.format(popt[0]) ) + +plt.grid() +plt.legend(loc=1) +plt.title('$T_1$ measurement') +plt.xlabel('Detection delay time/ms') +plt.ylabel('Actual photon counts (normalized)') +plt.tight_layout() + +plt.savefig( MAIN_EXP_folder + 'fitted_T1_{:.0f}ms{:}.jpg'.format(popt[0], timestampsuffix[:-4]) ) +plt.show() + + + diff --git a/PLE/132_Rabi_FT.py b/PLE/132_Rabi_FT.py new file mode 100644 index 0000000..ef911f9 --- /dev/null +++ b/PLE/132_Rabi_FT.py @@ -0,0 +1,101 @@ +# -*- coding: utf-8 -*- +""" +Created on Wed Feb 5 13:08:12 2025 + +@author: shen_t2 +""" + + +import os +# os.chdir(os.path.abspath(os.path.dirname(__file__))) + +import numpy as np +import matplotlib.pyplot as plt +plt.rcParams.update({'font.size': 14}) + +from scipy.fftpack import fft, ifft, fftfreq + + +# %% + +MAIN_EXP_folder = 'C:/RE_qubit_TS/202503_Pulse_echo_sample2/02_thicker_Cu_plate/61_left3_left_splitting/run21_Rabi_smallApt_1500ns_noEOM_count10ms_avg100/' +os.chdir(MAIN_EXP_folder) + +timestampsuffix = '_04102217.npy' + +time_scan = np.load('excitation_time_x_axis_0-0ms_Pulse_Rabi' + timestampsuffix) # in [us] + + +raw_count_sum = np.zeros(len(time_scan)) +actual_count_sum = np.zeros(len(time_scan)) + +total_average = 35 + +for ii in range(total_average): + raw_count_rep = np.load('raw_counts_B1000Gs_rep{:d}_count10ms'.format(ii) + timestampsuffix) + raw_count_sum += raw_count_rep + + actual_count_rep = np.load('actual_counts_B1000Gs_rep{:d}_count10ms'.format(ii) + timestampsuffix) + actual_count_sum += actual_count_rep + + +raw_count = raw_count_sum / total_average +actual_count = actual_count_sum / total_average + + +# %% FFT + +time_step = time_scan[1] - time_scan[0] # [us] +fs = 1e6 / time_step # Hz + +x, y = time_scan, actual_count + +fft_x = fftfreq(len(x)) * fs +fft_y = fft(y) + + +# %% + + +plt.figure(1320, figsize=[9,6], dpi=100) +plt.clf() + +plt.plot(time_scan * 1e3, raw_count, '.-b', label= 'raw counts' ) +plt.plot(time_scan * 1e3, actual_count, '.-r', label='Experiment' ) + +plt.grid() +plt.legend(loc=2) +plt.title('Total average = {:d}'.format(total_average)) +plt.xlabel('Excitation time (ns)') +plt.ylabel('Actual photon counts (cps)') +# plt.xscale('log') +plt.tight_layout() + +# plt.savefig( MAIN_EXP_folder + 'plot_{:}Averaged.jpg'.format(total_average) ) +plt.show() + + + +# %% + +plt.figure(1321, figsize=[9,6], dpi=100) +plt.clf() + +# plt.plot(time_scan, raw_count, '.-b', label= 'raw counts' ) +# plt.plot(time_scan, actual_count, '.-r', label='Experiment' ) + +# plt.plot(fft_x, abs(fft_y), '.-b', label='FFT') +plt.plot(fft_x[:len(fft_x)//2], abs(fft_y)[:len(fft_x)//2] / len(x) * 2, '.-r', label='FFT') + +plt.grid() +plt.legend(loc=1) +# plt.title('Rabi measurement') +plt.xlabel('Frequency (Hz)') +plt.ylabel('FFT') +plt.yscale('log') +plt.tight_layout() + +# plt.savefig( MAIN_EXP_folder + 'plot_FFT.jpg' ) +plt.show() + + diff --git a/PLE/133_echo_halfpi_FT.py b/PLE/133_echo_halfpi_FT.py new file mode 100644 index 0000000..49b8223 --- /dev/null +++ b/PLE/133_echo_halfpi_FT.py @@ -0,0 +1,101 @@ +# -*- coding: utf-8 -*- +""" +Created on Wed Feb 5 13:08:12 2025 + +@author: shen_t2 +""" + + +import os +# os.chdir(os.path.abspath(os.path.dirname(__file__))) + +import numpy as np +import matplotlib.pyplot as plt +plt.rcParams.update({'font.size': 14}) + +from scipy.fftpack import fft, ifft, fftfreq + + +# %% + +MAIN_EXP_folder = 'C:/RE_qubit_TS/202503_Pulse_echo_sample2/02_thicker_Cu_plate/19_echo_halfpi_population/run1_2us_noEOM_avg100/' +os.chdir(MAIN_EXP_folder) + +timestampsuffix = '_04071904.npy' + +time_scan = np.load('half_pi_x_axis_300-1500ns_Pulse_echo_halfpi' + timestampsuffix) # in [us] + + +raw_count_sum = np.zeros(len(time_scan)) +actual_count_sum = np.zeros(len(time_scan)) + +total_average = 55 + +for ii in range(total_average): + raw_count_rep = np.load('raw_counts_B680Gs_rep{:d}_tau500ns_count3ms'.format(ii) + timestampsuffix) + raw_count_sum += raw_count_rep + + actual_count_rep = np.load('actual_counts_B680Gs_rep{:d}_tau500ns_count3ms'.format(ii) + timestampsuffix) + actual_count_sum += actual_count_rep + + +raw_count = raw_count_sum / total_average +actual_count = actual_count_sum / total_average + + + +# %% FFT + +time_step = 1/409.6 # [us] +fs = 1e6 / time_step # Hz + +x, y = time_scan, actual_count + +fft_x = fftfreq(len(x)) * fs +fft_y = fft(y) + + +# %% + + +plt.figure(1330, figsize=[9,6], dpi=100) +plt.clf() + +# plt.plot(time_scan, raw_count, '.-b', label= 'raw counts' ) +plt.plot(time_scan, actual_count, '.-r', label='Experiment' ) + +plt.grid() +plt.legend(loc=1) +# plt.title('Rabi measurement') +plt.xlabel('Excitation time (us)') +plt.ylabel('Actual photon counts (cps)') +plt.tight_layout() + +# plt.savefig( MAIN_EXP_folder + 'fitted_T1_{:.0f}ms{:}.jpg'.format(popt[0], timestampsuffix[:-4]) ) +plt.show() + + + +# %% + +plt.figure(1331, figsize=[9,6], dpi=100) +plt.clf() + +# plt.plot(time_scan, raw_count, '.-b', label= 'raw counts' ) +# plt.plot(time_scan, actual_count, '.-r', label='Experiment' ) + +# plt.plot(fft_x, abs(fft_y), '.-b', label='FFT') +plt.plot(fft_x[:len(fft_x)//2], abs(fft_y)[:len(fft_x)//2] / len(x) * 2, '.-r', label='FFT') + +plt.grid() +plt.legend(loc=1) +# plt.title('Rabi measurement') +plt.xlabel('Frequency (Hz)') +plt.ylabel('FFT') +plt.yscale('log') +plt.tight_layout() + +# plt.savefig( MAIN_EXP_folder + 'fitted_T1_{:.0f}ms{:}.jpg'.format(popt[0], timestampsuffix[:-4]) ) +plt.show() + + diff --git a/PLE/Caylar_calibration.xlsx b/PLE/Caylar_calibration.xlsx new file mode 100644 index 0000000..974a237 Binary files /dev/null and b/PLE/Caylar_calibration.xlsx differ