In [32]:
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

In [33]:
mub = 927.4009*1e-26 #Bohr magneton [J/T]
h = 6.62607*1e-34 #Planck's constant [Js]
muo = 4*np.pi*1e-7
q = 1.60217*1e-19 

R = 16.3*1e-2#Coil radius [m]
N = 11 #Coil turns

1) RF Depumping


In [34]:
Rf = np.array([98.335, 48.815, 64.904, 75.932, 87.133, 112.03, 123.30, 137.240, 150.148, 159.998, 169.021])*1e3 #Hz
V_Rb87 = np.array([381.1, 268.6, 303.9, 329.2, 355.0, 412, 438, 471, 501, 523, 544])*1e-3 #Resonant dip voltage [V]
V_Rb85 = np.array([494, 326.4, 379.0, 416, 455, 542, 581, 629, 674, 709, 740])*1e-3 #Resonant dip voltage [V]
dV = 0.4*1e-3 #0.4 mV uncertainty

V_Rb87 = V_Rb87 - 163.4*1e-3 #Offset Earth B
V_Rb85 = V_Rb85 - 163.4*1e-3 #Offset Earth B



Rf = np.sort(Rf)
V_Rb87 = np.sort(V_Rb87)
V_Rb85 = np.sort(V_Rb85)

I_Rb87 = V_Rb87/1; #1 Ohm resistor to coils
I_Rb85 = V_Rb85/1; #1 Ohm resistor to coils

E_Rf = h*Rf #RF photon energy

In [ ]:


In [35]:
def BField(I):
    return 16*muo*N*I/(np.sqrt(125)*2*R)

In [36]:
B_Rb87 = BField(I_Rb87)
B_Rb85 = BField(I_Rb85)

$^{87}$Rb


In [37]:
plt.figure(figsize=(5,3));
plt.scatter(mub*B_Rb87,E_Rf);

plt.ylabel('RF Energy',fontsize=20);
plt.xlabel('$\mu_BB$',fontsize = 20);
plt.xticks(size = 13);
plt.yticks(size = 13);
plt.xlim(0.5e-28,2.5e-28);
plt.ylim(3e-29,1.2e-28);
plt.ylim(0,1.2e-28);


So when B sweep is zero,


In [38]:
def myfun(mubB,gf):
    ans =  gf*mubB#DeltaE for Zeeman
    return ans

p0 = [0.5] #guess

xspace = np.linspace(0.5e-28,2.5e-28) 

plsq, pcov = curve_fit(myfun, mub*B_Rb87, E_Rf, p0)  # curve fit returns p and covariance matrix
# these give the parameters and the uncertainties
gf87 = plsq[0]
egf87 = np.sqrt(pcov[0,0])


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

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


plt.scatter(mub*B_Rb87,E_Rf, marker='.',label='Data');
plt.plot(xspace,yfit,label='Fit')

plt.legend(loc='lower right')
plt.xlabel('$\mu_BB$ $[J]$',fontsize=20);
plt.ylabel('RF Energy $[J]$',fontsize = 20);
plt.text(0.6e-28,1e-28,'$g_f = %.4f \pm %.4f$' % (plsq[0], np.sqrt(pcov[0,0])),size=20)
plt.xticks(size = 13);
plt.errorbar(mub*B_Rb87,E_Rf,xerr = mub*16*muo*N*dV/(np.sqrt(125)*2*R),fmt='none');
plt.xlim(0.5e-28,2.5e-28);
plt.ylim(3e-29,1.2e-28);
plt.yticks(size = 13);
plt.savefig('Lande87.png')


$^{85}$Rb


In [39]:
plt.figure(figsize=(5,3));
plt.scatter(mub*B_Rb85,E_Rf);

plt.ylabel('RF Energy [$J$]',fontsize=20);
plt.xlabel('$\mu_BB$ [$J$]',fontsize = 20);
plt.xticks(size = 13);
plt.xlim(0.8e-28,3.5e-28);
plt.ylim(2e-29,1.22e-28);
plt.yticks(size = 13);



In [40]:
def myfun(mubB,gf):
    ans =  gf*mubB#DeltaE for Zeeman
    return ans

p0 = [0.5] #guess

xspace = np.linspace(0.8e-28,3.5e-28)

plsq, pcov = curve_fit(myfun, mub*B_Rb85, E_Rf, p0)  # curve fit returns p and covariance matrix
# these give the parameters and the uncertainties
gf85 = plsq[0]
egf85 = np.sqrt(pcov[0,0])


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

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

plt.scatter(mub*B_Rb85,E_Rf,marker='.',label='Data');
plt.plot(xspace,yfit,label='Fit')

plt.legend(loc='lower right')
plt.xlabel('$\mu_BB$ $[J]$',fontsize=20);
plt.ylabel('RF Energy $[J]$',fontsize = 20);
plt.text(0.9e-28,1e-28,'$g_f = %.4f \pm %.4f$' % (plsq[0], np.sqrt(pcov[0,0])),size=20)
plt.xticks(size = 13);
plt.xlim(0.8e-28,3.5e-28);
plt.errorbar(mub*B_Rb85,E_Rf,xerr = mub*16*muo*N*dV/(np.sqrt(125)*2*R),fmt='none');
plt.ylim(2e-29,1.22e-28);
plt.yticks(size = 13);
plt.savefig('Lande85.png')


2) Dip Angle


In [41]:
V_Vertical = 0.3729 #Volts, cancel Earth's vertical field.
I_Vertical = V_Vertical/1 #1 Ohm
B_Vertical = BField(I_Vertical)
B_Vertical*1e6


Out[41]:
22.627798808544554

In [42]:
dB_Vertical = 0.001*BField(I_Vertical)/I_Vertical
dB_Vertical*1e6


Out[42]:
0.060680608228867131

In [43]:
V_Horizontal = 0.1634 #Volts, cancel Earth's vertical field.
I_Horizontal = V_Horizontal/1 #1 Ohm
B_Horizontal = BField(I_Horizontal)
B_Horizontal*1e6


Out[43]:
9.9152113845968888

In [44]:
dB_Horizontal = 0.001*BField(I_Horizontal)/I_Horizontal
dB_Horizontal*1e6


Out[44]:
0.060680608228867131

In [45]:
BMag = np.sqrt(B_Horizontal**2 + B_Vertical**2)
BMag


Out[45]:
2.470483142466692e-05

In [46]:
theta = np.arctan(B_Vertical/B_Horizontal)
theta*180/np.pi #Dip Angle in degrees of earth magnetic field


Out[46]:
66.33758344202937

In [47]:
dtheta = dB_Horizontal/np.sqrt(B_Horizontal**2 + B_Vertical**2)
dtheta*180/np.pi


Out[47]:
0.14073128814509914

Measured inside 72.5 degrees. Lobby 83 degrees.

3) Optical Pumping Time

RF = 156.806 Khz


In [48]:
Scope = np.loadtxt('PumpingTime.csv',delimiter=',')
Time = Scope[:,0]*100e-4
V1 = Scope[:,1]
V2 = Scope[:,2]

offset = abs(V2[480])

In [49]:
plt.figure(figsize=(10,6));
plt.scatter(Time,V1 + offset,marker='.',color='red',label = 'RF Amplitude');
plt.scatter(Time,V2 + offset,marker='.',color='blue',label = 'Detector');
#plt.scatter(Time[480:1375],V2[480:1375] + offset,marker='.',color='black',label = 'Detector');
plt.legend(loc='best')

plt.xlabel('Time',fontsize=20);
plt.ylabel('Voltage',fontsize = 20);
plt.xticks(size = 13);
plt.xlim((-2.58e-2)*100e-4,(8.21e-2)*100e-4);
plt.ylim(-1.5+offset,1.5+offset);
plt.yticks(size = 13);



In [50]:
def myfun(t,Vo,tau):
    ans =  Vo*(1-np.exp(-t/tau))#Charging Capacitor
    return ans

p0 = [0.3, 0.01] #guess

xspace = np.linspace(Time[480],Time[1375])

plsq, pcov = curve_fit(myfun, Time[480:1375], V2[480:1375] + offset, p0)  # curve fit returns p and covariance matrix
# these give the parameters and the uncertainties
Vo = plsq[0]
eVo = np.sqrt(pcov[0,0])

tau = plsq[1]
etau = np.sqrt(pcov[1,1])


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

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

#plt.scatter(Time[480:1375],V2[480:1375]+offset,marker='.',color='black',label = 'Detector');
plt.plot(xspace,yfit,label='Fit',color='black',marker='o')


plt.scatter(Time,V1 + offset,marker='.',color='red',label = 'RF Trigger Amplitude');
plt.scatter(Time,V2 + offset,marker='.',color='blue',label = 'Detector Intensity');
#plt.scatter(Time[480:1375],V2[480:1375] + offset,marker='.',color='black',label = 'Detector');
plt.legend(loc='best')

plt.xlabel('Time [s]',fontsize=20);
plt.ylabel('Voltage [V]',fontsize = 20);
plt.xticks(size = 13);
plt.xlim((-2.58e-2)*100e-4,(8.21e-2)*100e-4);
plt.ylim(-1.5+offset,1.5+offset);
plt.yticks(size = 13);


plt.text(-0.0002,0.87,'$tau = %.1f \pm %.1f$ $\mu s$' % (plsq[1]*1e6, np.sqrt(pcov[1,1])*1e6),size=20)

plt.savefig('TimeConstant.png')


4) Rapid Field Switching

$^{87}$Rb


In [51]:
T87 = np.array([3.4, 2.4, 2.2, 1.9, 4.5, 2.8])*1e-3 #Period in seconds
RFAmp87 = np.array([.602, .840, .920, 1.01, .480, .720]) #Read from oscope Volts
BRF87 = RFAmp87/50

In [52]:
plt.figure(figsize=(5,3));
plt.scatter(BRF87,1/T87);

plt.xlabel('$B_{RF}$',fontsize=20);
plt.ylabel('$1/T$   $s^{-1}$',fontsize = 20);
plt.xticks(size = 13);
#plt.xlim(2.5e-4,7e-4);
plt.xlim(0.008,0.023);
plt.yticks(size = 13);
#plt.savefig('Sample')



In [53]:
def myfun(B_RF,k):
    ans =  B_RF*k#DeltaE for Zeeman
    return ans

p0 = [500] #guess

xspace87 = np.linspace(0.008,0.023)

plsq, pcov = curve_fit(myfun, BRF87, 1/T87, p0)  # curve fit returns p and covariance matrix
# these give the parameters and the uncertainties
k87 = plsq[0]
ek87 = np.sqrt(pcov[0,0])


yfit87 = myfun(xspace87,plsq[0])  # use fit results for a, b, c

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

plt.scatter(BRF87,1/T87,label = 'RB87 Data');
plt.plot(xspace87,yfit87,label='Fit')

plt.legend(loc='lower right')
plt.xlabel('$B_{RF}$ [$T$]',fontsize=20);
plt.ylabel('$1/T$   [$s^{-1}$]',fontsize = 20);
plt.text(0.009,500,'$Slope = %.00f \pm %.00f$' % (plsq[0], np.sqrt(pcov[0,0])),size=20)
plt.xticks(size = 13);
plt.xlim(0.008,0.023);
#plt.ylim(2e-29,1.22e-28);
#plt.errorbar(mub*B_Rb85,E_Rf,xerr = mub*16*muo*N*dV/(np.sqrt(125)*2*R),fmt='none');

plt.yticks(size = 13);
#plt.savefig('Lande85.png')


$^{85}$Rb


In [54]:
T85 = np.array([4.3, 3.5, 3.3, 2.8, 2.7])*1e-3 #Period in seconds
RFAmp85 = np.array([.720, .820, .920, 1.01, 1.11]) #Read from oscope Volts
BRF85 = RFAmp85/50

In [55]:
plt.figure(figsize=(5,3));
plt.scatter(BRF85,1/T85);

plt.xlabel('$B_{RF}$',fontsize=20);
plt.ylabel('$1/T$   $s^{-1}$',fontsize = 20);
plt.xticks(size = 13);
#plt.xlim(2.5e-4,7e-4);
plt.xlim(0.013,0.023);
plt.yticks(size = 13);
#plt.savefig('Sample')



In [56]:
def myfun(B_RF,k):
    ans =  B_RF*k#DeltaE for Zeeman
    return ans

p0 = [500] #guess

xspace85 = np.linspace(0.013,0.023)

plsq, pcov = curve_fit(myfun, BRF85, 1/T85, p0)  # curve fit returns p and covariance matrix
# these give the parameters and the uncertainties
k85 = plsq[0]
ek85 = np.sqrt(pcov[0,0])


yfit85 = myfun(xspace85,plsq[0])  # use fit results for a, b, c

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

plt.scatter(BRF85,1/T85,label = 'RB85 Data');
plt.plot(xspace85,yfit85,label='Fit')

plt.legend(loc='lower right')
plt.xlabel('$B_{RF}$',fontsize=20);
plt.ylabel('$1/T$   $s^{-1}$',fontsize = 20);
plt.text(0.0135,350,'$Slope = %.00f \pm %.00f$' % (plsq[0], np.sqrt(pcov[0,0])),size=13)
plt.xticks(size = 13);
plt.xlim(0.013,0.023);
#plt.ylim(2e-29,1.22e-28);
#plt.errorbar(mub*B_Rb85,E_Rf,xerr = mub*16*muo*N*dV/(np.sqrt(125)*2*R),fmt='none');

plt.yticks(size = 13);
#plt.savefig('Lande85.png')


Pretty large uncertainty here, rushed measurements

Together


In [57]:
plt.figure(figsize=(10,6));
plt.scatter(BRF85,1/T85,color='blue',label='RB85 Data');
plt.errorbar(BRF85, 1/T85, yerr=(0.2*1e-3)/T85**2,fmt='none',color='blue')

plt.scatter(BRF87,1/T87,color='red',label='RB87 Data');
plt.errorbar(BRF87, 1/T87, yerr=(0.2*1e-3)/T87**2,fmt='none',color='red')

plt.plot(xspace87,yfit87,label='RB87 Fit',color='red')
plt.plot(xspace85,yfit85,label='RB85 Fit',color='blue')

plt.legend(loc='best')

plt.text(0.0085,430,'$^{87}$RB Slope = $25000 \pm 300$ $s^{-1}T^{-1}$',size=15)
plt.text(0.0085,400,'$^{85}$RB Slope = $16900 \pm 300$ $s^{-1}T^{-1}$',size=15)


plt.xlabel('$B_{RF}$ [$T$]',fontsize=20);
plt.ylabel('$1/T$   [$s^{-1}$]',fontsize = 20);
plt.xticks(size = 13);
plt.xlim(0.008,0.023);
plt.yticks(size = 13);
plt.savefig('SlopeCompare')



In [58]:
k87/k85


Out[58]:
1.4758992657677534

In [59]:
0.5/0.3


Out[59]:
1.6666666666666667

In [60]:
gf87/gf85


Out[60]:
1.5178766224274796

In [61]:
gf87


Out[61]:
0.52731333105806533

In [62]:
gf85


Out[62]:
0.34740197145585794

In [ ]: