-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path20220904_T2_quick_cal.py
61 lines (51 loc) · 1.79 KB
/
20220904_T2_quick_cal.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 4 20:32:28 2022
@author: wj2002
"""
import os
import numpy as np
import pandas as pd
from natsort import natsorted
import matplotlib.pyplot as plt
import sys
# Directory and folder for data
dir = 'C:\\Users\\wj2002\\Dropbox (Heriot-Watt University Team)\\RES_EPS_Quantum_Photonics_Lab\\Experiments\\Current Experiments\\Broadband telecom quantum memories\\Pr_YSO_spectroscopy_HWU\\20220902_Pr_YSO_T2_L'
folder = 'SHB_NosweepBB'
path = dir + '\\' + folder + '\\'
file_list = os.listdir(path)
# Listing all .csv files but not all data fies will be used in some cases
list_csv=natsorted([i for i in file_list if i.endswith('.CSV')])
file_size=np.shape(list_csv)
file_len=file_size[0]
intensity_max=np.zeros(file_len)
#time_output=np.zeros([3750,file_len])
#T2_data_selected_output=np.zeros([3750,file_len])
tau=6e-6
tau_step=4e-6
tau_values=np.zeros(file_len)
for index, file in enumerate(file_list):
data=pd.read_csv(os.path.join(path,file))
data=data.to_numpy()
T2_data=data[:,2]
time=data[:,0]
tau_left=2*(tau+0.4e-6)-2.5e-6
tau_right=2*(tau+0.4e-6)+4e-6
difference_left = np.absolute(time-tau_left)
difference_right = np.absolute(time-tau_right)
time_left=np.argmin(difference_left)
time_right=np.argmin(difference_right)
T2_data_selected=T2_data[time_left:time_right]
T2_data_corrected=T2_data_selected-min(T2_data_selected)
intensity_max[index]=max(T2_data_corrected)
#time_output[:,index]=time[time_left:time_right]
#T2_data_selected_output[:,index]=T2_data_corrected
tau_values[index]=tau
plt.figure(1)
plt.plot(time,T2_data)
plt.figure(2)
plt.plot(time[time_left:time_right],T2_data_corrected)
tau=tau+tau_step
test=0
plt.figure(3)
plt.plot(tau_values,intensity_max)