In [192]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit  # import the curve fitting function
%matplotlib inline

Day 1. Single Laser

Sloped Stuff


In [193]:
Data1 = pd.read_excel('Day1Sloped.xlsx',sheetname = None, header = None)

T1 = np.array([entry for entry in Data1['Day1Sloped'][0]])*1e3  + 50.1 #ms
V1 = np.array([entry for entry in Data1['Day1Sloped'][2]]) #V

plt.figure(figsize=(10,6));
plt.scatter(T1,V1);

plt.xlabel('Elapsed Sweep Time (ms)',fontsize=20);
plt.ylabel('Photodiode Response (V)',fontsize = 20);
plt.xticks(size = 13);
plt.yticks(size = 13);
plt.xlim(0,48.5);
plt.savefig('Day1Sloped.png')


No Slope


In [194]:
Data2 = pd.read_excel('Day1Flat.xlsx',sheetname = None, header = None)

T2 = np.array([entry for entry in Data2['Sheet1'][0]])*1e3 + 26.4 + 2.36004250e+01#ms
V2 = np.array([entry for entry in Data2['Sheet1'][1]]) #V

plt.figure(figsize=(10,6));
plt.scatter(T2,V2);

plt.xlabel('Elapsed Sweep Time (ms)',fontsize=20);
plt.ylabel('Photodiode Response (V)',fontsize = 20);
plt.xticks(size = 13);
plt.yticks(size = 13);
plt.xlim(0,48.5);
plt.savefig('Day1Flat.png')


Finding minima


In [195]:
T2 = np.array([entry for entry in Data2['Sheet1'][0]])*1e3 + 26.4 + 2.36004250e+01#ms
V2 = np.array([entry for entry in Data2['Sheet1'][1]]) #V

T2 = T2[720:785]
V2 = V2[720:785]

plt.figure(figsize=(10,6));
plt.scatter(T2,V2);

plt.xlabel('Elapsed Sweep Time (ms)',fontsize=20);
plt.ylabel('Photodiode Response (V)',fontsize = 20);
plt.xticks(size = 13);
plt.yticks(size = 13);
#plt.ylim(-12,2);


87a


In [196]:
c


Out[196]:
300000000.0

In [197]:
def myfun(t,a,b,c):
    ans =  a + b*t + c*t**2
    return ans

def myfun(t,a,b,c):
    ans =  a*np.exp(-((t-b)**2)/(2*c**2)) 
    return ans


p0 = [0.5,37,1] #guess

T2 = np.array([entry for entry in Data2['Sheet1'][0]])*1e3 + 26.4 + 2.36004250e+01#ms
V2 = -np.array([entry for entry in Data2['Sheet1'][1]]) - np.min(np.array([entry for entry in Data2['Sheet1'][1]])) #V

T2 = T2[715:790]
V2 = V2[715:790]

xspace = np.linspace(35.5,39) 

plsq, pcov = curve_fit(myfun, T2, V2, p0)  # curve fit returns p and covariance matrix
# these give the parameters and the uncertainties
a = plsq[0]
ea = np.sqrt(pcov[0,0])

b = plsq[1]
eb = np.sqrt(pcov[1,1])

c = plsq[2]
ec = np.sqrt(pcov[2,2])


#def minima(b,c):
    #return -b/(2*c)

#V_min = minima(b,c)

#dV = np.sqrt((eb/b)**2 + (ec/c)**2)*V_min
    
FWHM = 2*np.sqrt(2*np.log(2))*c

dFWHM = 2*np.sqrt(2*np.log(2))*ec

yfit = myfun(xspace,plsq[0],plsq[1],plsq[2])  # use fit results for a, b, c

plt.figure(figsize=(10,6));

plt.scatter(T2,V2);

plt.xlabel('Elapsed Sweep Time (ms)',fontsize=20);
plt.ylabel('Photodiode Response (V)',fontsize = 20);
plt.xticks(size = 13);
plt.yticks(size = 13);
#plt.ylim(-12,2);

plt.plot(xspace,yfit,label='Fit');

#plt.text(37,1, '$t_{min} = %.1f \pm %.1f$ ms' % (V_min, dV) ,size=20);
plt.text(37,9, '$FWHM = %.1f \pm %.1f$ ms' % (FWHM, dFWHM) ,size=20);
plt.title('87a Line');



In [198]:
a


Out[198]:
9.4424225475209784

In [199]:
b


Out[199]:
37.30401620019019

In [200]:
c


Out[200]:
-3.6529467694512996

85a


In [201]:
def myfun(t,a,b,c):
    ans =  a + b*t + c*t**2
    return ans

def myfun(t,a,b,c):
    ans =  a*np.exp(-((t-b)**2)/(2*c**2)) 
    return ans

p0 = [a,29,c] #guess

T2 = np.array([entry for entry in Data2['Sheet1'][0]])*1e3 + 26.4 + 2.36004250e+01#ms
V2 = -np.array([entry for entry in Data2['Sheet1'][1]]) + 0.2 #V

T2 = T2[565:620]
V2 = V2[565:620]
xspace = np.linspace(28,31) 

plsq, pcov = curve_fit(myfun, T2, V2, p0)  # curve fit returns p and covariance matrix
# these give the parameters and the uncertainties
a = plsq[0]
ea = np.sqrt(pcov[0,0])

b = plsq[1]
eb = np.sqrt(pcov[1,1])

c = plsq[2]
ec = np.sqrt(pcov[2,2])


#def minima(b,c):
#    return -b/(2*c)

#V_min = minima(b,c)

#dV = np.sqrt((eb/b)**2 + (ec/c)**2)*V_min
    

FWHM = 2*np.sqrt(2*np.log(2))*c

dFWHM = 2*np.sqrt(2*np.log(2))*ec
    
yfit = myfun(xspace,plsq[0],plsq[1],plsq[2])  # use fit results for a, b, c

plt.figure(figsize=(10,6));

plt.scatter(T2,V2);

plt.xlabel('Elapsed Sweep Time (ms)',fontsize=20);
plt.ylabel('Photodiode Response (V)',fontsize = 20);
plt.xticks(size = 13);
plt.yticks(size = 13);
#plt.ylim(-12,2);

plt.plot(xspace,yfit,label='Fit');

#plt.text(29,-1, '$t_{min} = %.1f \pm %.1f$ ms' % (V_min, dV) ,size=20);
plt.text(29,1, '$FWHM = %.2f \pm %.2f$ ms' % (FWHM, dFWHM) ,size=20);
plt.title('85a Line');


85b


In [202]:
def myfun(t,a,b,c):
    ans =  a + b*t + c*t**2
    return ans

def myfun(t,a,b,c):
    ans =  a*np.exp(-((t-b)**2)/(2*c**2)) 
    return ans

p0 = [0.5,19.5,0.5] #guess

T2 = np.array([entry for entry in Data2['Sheet1'][0]])*1e3 + 26.4 + 2.36004250e+01#ms
V2 = -np.array([entry for entry in Data2['Sheet1'][1]]) #V

T2 = T2[365:420]
V2 = V2[365:420]
xspace = np.linspace(18,21) 

plsq, pcov = curve_fit(myfun, T2, V2, p0)  # curve fit returns p and covariance matrix
# these give the parameters and the uncertainties
a = plsq[0]
ea = np.sqrt(pcov[0,0])

b = plsq[1]
eb = np.sqrt(pcov[1,1])

c = plsq[2]
ec = np.sqrt(pcov[2,2])


#def minima(b,c):
#    return -b/(2*c)

#V_min = minima(b,c)

#dV = np.sqrt((eb/b)**2 + (ec/c)**2)*V_min

FWHM = 2*np.sqrt(2*np.log(2))*c

dFWHM = 2*np.sqrt(2*np.log(2))*ec
    


yfit = myfun(xspace,plsq[0],plsq[1],plsq[2])  # use fit results for a, b, c

plt.figure(figsize=(10,6));

plt.scatter(T2,V2);

plt.xlabel('Elapsed Sweep Time (ms)',fontsize=20);
plt.ylabel('Photodiode Response (V)',fontsize = 20);
plt.xticks(size = 13);
plt.yticks(size = 13);
#plt.ylim(-12,2);

plt.plot(xspace,yfit,label='Fit');

#plt.text(19,-1, '$t_{min} = %.1f \pm %.1f$ ms' % (V_min, dV) ,size=20);
plt.text(19,5, '$FWHM = %.2f \pm %.2f$ ms' % (FWHM, dFWHM) ,size=20);
plt.title('85b Line');


87b


In [203]:
def myfun(t,a,b,c):
    ans =  a + b*t + c*t**2
    return ans

def myfun(t,a,b,c):
    ans =  a*np.exp(-((t-b)**2)/(2*c**2)) 
    return ans

p0 = [0.5,15.5,0.5] #guess

T2 = np.array([entry for entry in Data2['Sheet1'][0]])*1e3 + 26.4 + 2.36004250e+01#ms
V2 = -np.array([entry for entry in Data2['Sheet1'][1]]) + 4 #V

T2 = T2[280:335]
V2 = V2[280:335]

xspace = np.linspace(14,16.5) 

plsq, pcov = curve_fit(myfun, T2, V2, p0)  # curve fit returns p and covariance matrix
# these give the parameters and the uncertainties
a = plsq[0]
ea = np.sqrt(pcov[0,0])

b = plsq[1]
eb = np.sqrt(pcov[1,1])

c = plsq[2]
ec = np.sqrt(pcov[2,2])


#def minima(b,c):
#    return -b/(2*c)

#V_min = minima(b,c)

#dV = np.sqrt((eb/b)**2 + (ec/c)**2)*V_min
    
FWHM = 2*np.sqrt(2*np.log(2))*c

dFWHM = 2*np.sqrt(2*np.log(2))*ec

yfit = myfun(xspace,plsq[0],plsq[1],plsq[2])  # use fit results for a, b, c

plt.figure(figsize=(10,6));

plt.scatter(T2,V2);

plt.xlabel('Elapsed Sweep Time (ms)',fontsize=20);
plt.ylabel('Photodiode Response (V)',fontsize = 20);
plt.xticks(size = 13);
plt.yticks(size = 13);
#plt.ylim(-12,2);

plt.plot(xspace,yfit,label='Fit');

#plt.text(15,-1, '$t_{min} = %.1f \pm %.1f$ ms' % (V_min, dV) ,size=20);

plt.text(15,7, '$FWHM = %.2f \pm %.2f$ ms' % (FWHM, dFWHM) ,size=20);

plt.title('87b Line');


Day 2. Doppler Free

Flat


In [209]:
Data2 = pd.read_excel('Day2Flat.xlsx',sheetname = None, header = None)

def myfun(t,a,b,c):
    ans =  a*np.exp(-((t-b)**2)/(2*c**2)) 
    return ans

p0 = [0.5,15.5,0.5] #guess

T3 = np.array([entry for entry in Data2['Sheet1'][0]])*1e3 + 26.4 #ms
V3 = np.array([entry for entry in Data2['Sheet1'][1]])#V

plt.figure(figsize=(10,6));
plt.scatter(T3,V3);

plt.xlabel('Elapsed Sweep Time (ms)',fontsize=20);
plt.ylabel('Photodiode Response (V)',fontsize = 20);
plt.xticks(size = 13);
plt.yticks(size = 13);
plt.xlim(5,12.5);
plt.ylim(-2.8,-1.05);

plt.scatter(T3[411] ,V3[411],color='red', marker='x')
plt.scatter(T3[329] ,V3[329],color='red', marker='x')
plt.scatter(T3[300] ,V3[300],color='red', marker='x')


aaa = (T3[411] - T3[329])
bbb = (T3[329] - T3[300])

plt.scatter(T3[326] ,V3[326],color='red', marker='x')
plt.scatter(T3[333] ,V3[333],color='red', marker='x')

plt.scatter(T3[303] ,V3[303],color='red', marker='x')
plt.scatter(T3[296] ,V3[296],color='red', marker='x')

plt.savefig('Hyperfine87b.png')



In [212]:
aaa*307


Out[212]:
604.17600000000107

In [211]:
bbb*307


Out[211]:
0.69599999999999795

In [ ]:
(T3[333] - T3[326])*307

In [ ]:
(T3[303] - T3[296])*307

In [ ]:
T3[412] #F

In [ ]:
T3[329] #C13

In [ ]:
T3[300] #C23

In [ ]:
(535*1e6)/(384*1e12)

In [ ]:
T3[329] - T3[300]

In [ ]:
0.70*307

In [ ]:
0.05*307

In [ ]:
Data2 = pd.read_excel('Day2Flat.xlsx',sheetname = None, header = None)

T3 = np.array([entry for entry in Data2['Sheet1'][0]])[210:510]*1e3 + 26.4 #ms
V3 = -np.array([entry for entry in Data2['Sheet1'][1]])[210:510] - 1 #V

plt.figure(figsize=(10,6));

def myfun(t,a,b,c):
    ans =  a*np.exp(-((t-b)**2)/(2*c**2)) 
    return ans

p0 = [0.5,9,0.5] #guess


xspace = np.linspace(5,12.3) 

plsq, pcov = curve_fit(myfun, T3, V3, p0)  # curve fit returns p and covariance matrix
# these give the parameters and the uncertainties
a = plsq[0]
ea = np.sqrt(pcov[0,0])

b = plsq[1]
eb = np.sqrt(pcov[1,1])

c = plsq[2]
ec = np.sqrt(pcov[2,2])


#def minima(b,c):
#    return -b/(2*c)

#V_min = minima(b,c)

#dV = np.sqrt((eb/b)**2 + (ec/c)**2)*V_min
    
FWHM = 2*np.sqrt(2*np.log(2))*c

dFWHM = 2*np.sqrt(2*np.log(2))*ec

yfit = myfun(xspace,plsq[0],plsq[1],plsq[2])  # use fit results for a, b, c

plt.figure(figsize=(10,6));

plt.scatter(T3,V3);

plt.xlabel('Elapsed Sweep Time (ms)',fontsize=20);
plt.ylabel('Photodiode Response (V)',fontsize = 20);
plt.xticks(size = 13);
plt.yticks(size = 13);
#plt.xlim(5,12.5);
#plt.ylim(-2.8,-1.05);

plt.plot(xspace,yfit,label='Fit');

#plt.text(15,-1, '$t_{min} = %.1f \pm %.1f$ ms' % (V_min, dV) ,size=20);

plt.text(8,1, '$FWHM = %.2f \pm %.2f$ ms' % (FWHM, dFWHM) ,size=20);

In [ ]:
m = 85.4678
u = 1.660*1e-27
c = 3*1e8
k = 1.38*1e-23

y = 780*1e-9

f = c/y

def T(df):
    df = df*1e6
    return ((df/f)**2)*m*u*(c**2)/(8*np.log(2)*k)

def dT(df,ddf):
    df = df*1e6
    ddf = ddf*1e6
    return ddf*((2*df/f**2))*m*u*(c**2)/(8*np.log(2)*k)

In [ ]:
T(970)

In [ ]:
dT(970,6)

In [ ]:
T(804)

In [ ]:
dT(804)

In [ ]:
T(497)

In [ ]: