102 lines
2.4 KiB
Python
102 lines
2.4 KiB
Python
# -*- 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()
|
|
|
|
|