In [1]:
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 [2]:
#Current in Pico Amps
#T157
FST157 = np.loadtxt('FS1_T157.csv');
Voltage_FST157 = np.array([FST157[i][0] for i in np.arange(len(FST157))])
Current_FST157 = np.array([FST157[i][1] for i in np.arange(len(FST157))])*1e12
Min6to9T157 = np.loadtxt('Min6to9T157.csv');
Voltage_Min6to9T157 = np.array([Min6to9T157[i][0] for i in np.arange(len(Min6to9T157))])
Current_Min6to9T157 = np.array([Min6to9T157[i][1] for i in np.arange(len(Min6to9T157))])*1e12
Min11to14T157 = np.loadtxt('Min11to14T157.csv');
Voltage_Min11to14T157= np.array([Min11to14T157[i][0] for i in np.arange(len(Min11to14T157))])
Current_Min11to14T157 = np.array([Min11to14T157[i][1] for i in np.arange(len(Min11to14T157))])*1e12
Min16to19T157 = np.loadtxt('Min16to19T157.csv');
Voltage_Min16to19T157= np.array([Min16to19T157[i][0] for i in np.arange(len(Min16to19T157))])
Current_Min16to19T157 = np.array([Min16to19T157[i][1] for i in np.arange(len(Min16to19T157))])*1e12
Min21to24T157 = np.loadtxt('Min21to24T157.csv');
Voltage_Min21to24T157= np.array([Min21to24T157[i][0] for i in np.arange(len(Min21to24T157))])
Current_Min21to24T157 = np.array([Min21to24T157[i][1] for i in np.arange(len(Min21to24T157))])*1e12
Min24to29T157 = np.loadtxt('Min24to29T157.csv');
Voltage_Min24to29T157= np.array([Min24to29T157[i][0] for i in np.arange(len(Min24to29T157))])
Current_Min24to29T157 = np.array([Min24to29T157[i][1] for i in np.arange(len(Min24to29T157))])*1e12
Min31to34T157 = np.loadtxt('Min31to34T157.csv');
Voltage_Min31to34T157= np.array([Min31to34T157[i][0] for i in np.arange(len(Min31to34T157))])
Current_Min31to34T157 = np.array([Min31to34T157[i][1] for i in np.arange(len(Min31to34T157))])*1e12
Min36to39T157 = np.loadtxt('Min36to39T157.csv');
Voltage_Min36to39T157= np.array([Min36to39T157[i][0] for i in np.arange(len(Min36to39T157))])
Current_Min36to39T157 = np.array([Min36to39T157[i][1] for i in np.arange(len(Min36to39T157))])*1e12
Min37to40T157 = np.loadtxt('Min37to40T157.csv');
Voltage_Min37to40T157= np.array([Min37to40T157[i][0] for i in np.arange(len(Min37to40T157))])
Current_Min37to40T157 = np.array([Min37to40T157[i][1] for i in np.arange(len(Min37to40T157))])*1e12
In [3]:
#Current in Pico Amps
#T186
FST186 = np.loadtxt('FS1_T186.csv');
Voltage_FST186 = np.array([FST186[i][0] for i in np.arange(len(FST186))])
Current_FST186 = np.array([FST186[i][1] for i in np.arange(len(FST186))])*1e12
Min11to14T186 = np.loadtxt('Min11to14T186.csv');
Voltage_Min11to14T186 = np.array([Min11to14T186[i][0] for i in np.arange(len(Min11to14T186))])
Current_Min11to14T186 = np.array([Min11to14T186[i][1] for i in np.arange(len(Min11to14T186))])*1e12
Min16to19T186= np.loadtxt('Min16to19T186.csv');
Voltage_Min16to19T186= np.array([Min16to19T186[i][0] for i in np.arange(len(Min16to19T186))])
Current_Min16to19T186 = np.array([Min16to19T186[i][1] for i in np.arange(len(Min16to19T186))])*1e12
Min21to24T186 = np.loadtxt('Min21to24T186.csv');
Voltage_Min21to24T186= np.array([Min21to24T186[i][0] for i in np.arange(len(Min21to24T186))])
Current_Min21to24T186 = np.array([Min21to24T186[i][1] for i in np.arange(len(Min21to24T186))])*1e12
Min25to28T186 = np.loadtxt('Min25to28T186.csv');
Voltage_Min25to28T186= np.array([Min25to28T186[i][0] for i in np.arange(len(Min25to28T186))])
Current_Min25to28T186 = np.array([Min25to28T186[i][1] for i in np.arange(len(Min25to28T186))])*1e12
Min31to34T186 = np.loadtxt('Min31to34T186.csv');
Voltage_Min31to34T186= np.array([Min31to34T186[i][0] for i in np.arange(len(Min31to34T186))])
Current_Min31to34T186 = np.array([Min31to34T186[i][1] for i in np.arange(len(Min31to34T186))])*1e12
Min36to39T186 = np.loadtxt('Min36to39T186.csv');
Voltage_Min36to39T186= np.array([Min36to39T186[i][0] for i in np.arange(len(Min36to39T186))])
Current_Min36to39T186 = np.array([Min36to39T186[i][1] for i in np.arange(len(Min36to39T186))])*1e12
In [4]:
plt.figure(figsize=(10,6))
plt.xticks(size = 15);
plt.yticks(size = 15);
plt.scatter(Voltage_FST157,Current_FST157,marker='.');
plt.xlim(0,40);
plt.ylim(0,400);
plt.xlabel('Accelerating Voltage (V)',size=20);
plt.ylabel('Current (pA)',size=20);
plt.savefig('IV430K.png')
In [5]:
def myfun(V,a,b,c):
ans = a + b*V + c*V**2
return ans
p0 = [0.5,0.5,0.5] #guess
xspace = np.linspace(6.75,8.25)
plsq, pcov = curve_fit(myfun, Voltage_Min6to9T157[80:220], Current_Min6to9T157[80:220], 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
yfit = myfun(xspace,plsq[0],plsq[1],plsq[2]) # use fit results for a, b, c
plt.figure(figsize=(10,6));
plt.scatter(Voltage_Min6to9T157[80:220],Current_Min6to9T157[80:220],marker='.',label='Data');
plt.xticks(size = 15);
plt.yticks(size = 15);
plt.xlim(6.7,8.3);
#plt.ylim(0,400);
plt.xlabel('Accelerating Voltage (V)',size=20);
plt.ylabel('Current (pA)',size=20);
plt.plot(xspace,yfit,label='Fit');
plt.text(7,9.1, '$V_{min} = %.1f \pm %.1f$ V' % (V_min, dV) ,size=20)
plt.legend(loc='best');
In [6]:
def myfun(V,a,b,c):
ans = a + b*V + c*V**2
return ans
p0 = [0.5,0.5,0.5] #guess
xspace = np.linspace(12.05,13.05)
plsq, pcov = curve_fit(myfun, Voltage_Min11to14T157[110:200], Current_Min11to14T157[110:200], 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
yfit = myfun(xspace,plsq[0],plsq[1],plsq[2]) # use fit results for a, b, c
plt.figure(figsize=(10,6));
plt.scatter(Voltage_Min11to14T157[110:200],Current_Min11to14T157[110:200],marker='.',label='Data');
plt.xticks(size = 15);
plt.yticks(size = 15);
plt.xlim(12.05,13.05);
#plt.ylim(0,400);
plt.xlabel('Accelerating Voltage (V)',size=20);
plt.ylabel('Current (pA)',size=20);
plt.plot(xspace,yfit,label='Fit');
plt.text(12.1,20.1, '$V_{min} = %.1f \pm %.1f$ V' % (V_min,dV) ,size=20)
plt.legend(loc='best');
In [7]:
def myfun(V,a,b,c):
ans = a + b*V + c*V**2
return ans
p0 = [0.5,0.5,0.5] #guess
xspace = np.linspace(17.2,17.85)
plsq, pcov = curve_fit(myfun, Voltage_Min16to19T157[62:90], Current_Min16to19T157[62:90], 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)
yfit = myfun(xspace,plsq[0],plsq[1],plsq[2]) # use fit results for a, b, c
plt.figure(figsize=(10,6));
plt.scatter(Voltage_Min16to19T157[62:90],Current_Min16to19T157[62:90],marker='.',label='Data');
plt.xticks(size = 15);
plt.yticks(size = 15);
plt.xlim(17.2,17.85);
#plt.ylim(0,400);
plt.xlabel('Accelerating Voltage (V)',size=20);
plt.ylabel('Current (pA)',size=20);
plt.plot(xspace,yfit,label='Fit');
plt.text(17.25,32, '$V_{min} = %.1f \pm %.1f$ V' % (minima(b,c), np.sqrt((eb/b)**2 + (ec/c)**2)*minima(b,c)) ,size=20)
plt.legend(loc='best');
In [8]:
def myfun(V,a,b,c):
ans = a + b*V + c*V**2
return ans
p0 = [0.5,0.5,0.5] #guess
xspace = np.linspace(22.15,23.25)
plsq, pcov = curve_fit(myfun, Voltage_Min21to24T157[60:110], Current_Min21to24T157[60:110], 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)
yfit = myfun(xspace,plsq[0],plsq[1],plsq[2]) # use fit results for a, b, c
plt.figure(figsize=(10,6));
plt.scatter(Voltage_Min21to24T157[60:110],Current_Min21to24T157[60:110],marker='.',label='Data');
plt.xticks(size = 15);
plt.yticks(size = 15);
plt.xlim(22.15,23.25);
#plt.ylim(0,400);
plt.xlabel('Accelerating Voltage (V)',size=20);
plt.ylabel('Current (pA)',size=20);
plt.plot(xspace,yfit,label='Fit');
plt.text(22.4,64, '$V_{min} = %.1f \pm %.1f$ V' % (minima(b,c), np.sqrt((eb/b)**2 + (ec/c)**2)*minima(b,c)) ,size=20)
plt.legend(loc='best');
In [9]:
def myfun(V,a,b,c):
ans = a + b*V + c*V**2
return ans
p0 = [0.5,0.5,0.5] #guess
xspace = np.linspace(27.39,28.2)
plsq, pcov = curve_fit(myfun, Voltage_Min24to29T157[70:110], Current_Min24to29T157[70:110], 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)
yfit = myfun(xspace,plsq[0],plsq[1],plsq[2]) # use fit results for a, b, c
plt.figure(figsize=(10,6));
plt.scatter(Voltage_Min24to29T157[70:110],Current_Min24to29T157[70:110],marker='.',label='Data');
plt.xticks(size = 15);
plt.yticks(size = 15);
plt.xlim(27.39,28.2);
#plt.ylim(0,400);
plt.xlabel('Accelerating Voltage (V)',size=20);
plt.ylabel('Current (pA)',size=20);
plt.plot(xspace,yfit,label='Fit');
plt.text(27.6,96, '$V_{min} = %.1f \pm %.1f$ V' % (minima(b,c), np.sqrt((eb/b)**2 + (ec/c)**2)*minima(b,c)) ,size=20)
plt.legend(loc='best');
In [10]:
def myfun(V,a,b,c):
ans = a + b*V + c*V**2
return ans
p0 = [0.5,0.5,0.5] #guess
xspace = np.linspace(32.5,33.81)
plsq, pcov = curve_fit(myfun, Voltage_Min31to34T157[80:125], Current_Min31to34T157[80:125], 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)
yfit = myfun(xspace,plsq[0],plsq[1],plsq[2]) # use fit results for a, b, c
plt.figure(figsize=(10,6));
plt.scatter(Voltage_Min31to34T157[80:125],Current_Min31to34T157[80:125],marker='.',label='Data');
plt.xticks(size = 15);
plt.yticks(size = 15);
plt.xlim(32.5,33.6);
#plt.ylim(0,400);
plt.xlabel('Accelerating Voltage (V)',size=20);
plt.ylabel('Current (pA)',size=20);
plt.plot(xspace,yfit,label='Fit');
plt.text(32.6,155, '$V_{min} = %.1f \pm %.1f$ V' % (minima(b,c), np.sqrt((eb/b)**2 + (ec/c)**2)*minima(b,c)) ,size=20)
plt.legend(loc='best');
In [11]:
def myfun(V,a,b,c):
ans = a + b*V + c*V**2
return ans
p0 = [0.5,0.5,0.5] #guess
xspace = np.linspace(37.95,38.65)
plsq, pcov = curve_fit(myfun, Voltage_Min37to40T157[95:165], Current_Min37to40T157[95:165], 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)
yfit = myfun(xspace,plsq[0],plsq[1],plsq[2]) # use fit results for a, b, c
plt.figure(figsize=(10,6));
plt.scatter(Voltage_Min37to40T157[95:165],Current_Min37to40T157[95:165],marker='.',label='Data');
plt.xticks(size = 15);
plt.yticks(size = 15);
plt.xlim(37.95,38.65);
#plt.ylim(0,400);
plt.xlabel('Accelerating Voltage (V)',size=20);
plt.ylabel('Current (pA)',size=20);
plt.plot(xspace,yfit,label='Fit');
plt.text(38.1,191, '$V_{min} = %.1f \pm %.1f$ V' % (minima(b,c), np.sqrt((eb/b)**2 + (ec/c)**2)*minima(b,c)) ,size=20)
plt.legend(loc='best');
In [12]:
plt.figure(figsize=(10,6))
plt.xticks(size = 15);
plt.yticks(size = 15);
plt.scatter(Voltage_FST186,Current_FST186,marker='.');
plt.xlim(0,41);
plt.ylim(0,155);
plt.xlabel('Accelerating Voltage (V)',size=20);
plt.ylabel('Current (pA)',size=20);
plt.savefig('IV459K.png')
In [13]:
def myfun(V,a,b,c):
ans = a + b*V + c*V**2
return ans
p0 = [0.5,0.5,0.5] #guess
xspace = np.linspace(7,10)
plsq, pcov = curve_fit(myfun, Voltage_FST186[70:100], Current_FST186[70:100], 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
yfit = myfun(xspace,plsq[0],plsq[1],plsq[2]) # use fit results for a, b, c
plt.figure(figsize=(10,6));
plt.scatter(Voltage_FST186[70:100],Current_FST186[70:100],marker='.',label='Data');
plt.xticks(size = 15);
plt.yticks(size = 15);
plt.xlim(7,10);
#plt.ylim(0,400);
plt.xlabel('Accelerating Voltage (V)',size=20);
plt.ylabel('Current (pA)',size=20);
plt.plot(xspace,yfit,label='Fit');
plt.text(7.5,10, '$V_{min} = %.1f \pm %.1f$ V' % (V_min,dV) ,size=20)
plt.legend(loc='best');
In [14]:
def myfun(V,a,b,c):
ans = a + b*V + c*V**2
return ans
p0 = [0.5,0.5,0.5] #guess
xspace = np.linspace(11.65,14.1)
plsq, pcov = curve_fit(myfun, Voltage_Min11to14T186[30:250], Current_Min11to14T186[30:250], 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
yfit = myfun(xspace,plsq[0],plsq[1],plsq[2]) # use fit results for a, b, c
plt.figure(figsize=(10,6));
plt.scatter(Voltage_Min11to14T186[30:250],Current_Min11to14T186[30:250],marker='.',label='Data');
plt.xticks(size = 15);
plt.yticks(size = 15);
plt.xlim(11.65,14.1);
#plt.ylim(0,400);
plt.xlabel('Accelerating Voltage (V)',size=20);
plt.ylabel('Current (pA)',size=20);
plt.plot(xspace,yfit,label='Fit');
plt.text(12.5,20, '$V_{min} = %.1f \pm %.1f$ V' % (V_min,dV) ,size=20)
plt.legend(loc='best');
In [15]:
def myfun(V,a,b,c):
ans = a + b*V + c*V**2
return ans
p0 = [0.5,0.5,0.5] #guess
xspace = np.linspace(16.55,18.45)
plsq, pcov = curve_fit(myfun, Voltage_Min16to19T186[65:240], Current_Min16to19T186[65:240], 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
yfit = myfun(xspace,plsq[0],plsq[1],plsq[2]) # use fit results for a, b, c
plt.figure(figsize=(10,6));
plt.scatter(Voltage_Min16to19T186[65:240],Current_Min16to19T186[65:240],marker='.',label='Data');
plt.xticks(size = 15);
plt.yticks(size = 15);
plt.xlim(16.55,18.45);
#plt.ylim(0,400);
plt.xlabel('Accelerating Voltage (V)',size=20);
plt.ylabel('Current (pA)',size=20);
plt.plot(xspace,yfit,label='Fit');
plt.text(17,30, '$V_{min} = %.1f \pm %.1f$ V' % (V_min,dV) ,size=20)
plt.legend(loc='best');
In [16]:
def myfun(V,a,b,c):
ans = a + b*V + c*V**2
return ans
p0 = [0.5,0.5,0.5] #guess
xspace = np.linspace(21.45,23.15)
plsq, pcov = curve_fit(myfun, Voltage_Min21to24T186[50:210], Current_Min21to24T186[50:210], 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
yfit = myfun(xspace,plsq[0],plsq[1],plsq[2]) # use fit results for a, b, c
plt.figure(figsize=(10,6));
plt.scatter(Voltage_Min21to24T186[50:210],Current_Min21to24T186[50:210],marker='.',label='Data');
plt.xticks(size = 15);
plt.yticks(size = 15);
plt.xlim(21.45,23.15);
#plt.ylim(0,400);
plt.xlabel('Accelerating Voltage (V)',size=20);
plt.ylabel('Current (pA)',size=20);
plt.plot(xspace,yfit,label='Fit');
plt.text(21.8,40, '$V_{min} = %.1f \pm %.1f$ V' % (V_min,dV) ,size=20)
plt.legend(loc='best');
In [17]:
def myfun(V,a,b,c):
ans = a + b*V + c*V**2
return ans
p0 = [0.5,0.5,0.5] #guess
xspace = np.linspace(26.25,28.05)
plsq, pcov = curve_fit(myfun, Voltage_Min25to28T186[80:250], Current_Min25to28T186[80:250], 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
yfit = myfun(xspace,plsq[0],plsq[1],plsq[2]) # use fit results for a, b, c
plt.figure(figsize=(10,6));
plt.scatter(Voltage_Min25to28T186[80:250],Current_Min25to28T186[80:250],marker='.',label='Data');
plt.xticks(size = 15);
plt.yticks(size = 15);
plt.xlim(26.25,28.05);
#plt.ylim(0,400);
plt.xlabel('Accelerating Voltage (V)',size=20);
plt.ylabel('Current (pA)',size=20);
plt.plot(xspace,yfit,label='Fit');
plt.text(26.8,55, '$V_{min} = %.1f \pm %.1f$ V' % (V_min,dV) ,size=20)
plt.legend(loc='best');
In [18]:
def myfun(V,a,b,c):
ans = a + b*V + c*V**2
return ans
p0 = [0.5,0.5,0.5] #guess
xspace = np.linspace(31.2,32.9)
plsq, pcov = curve_fit(myfun, Voltage_Min31to34T186[30:180], Current_Min31to34T186[30:180], 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
yfit = myfun(xspace,plsq[0],plsq[1],plsq[2]) # use fit results for a, b, c
plt.figure(figsize=(10,6));
plt.scatter(Voltage_Min31to34T186[30:180],Current_Min31to34T186[30:180],marker='.',label='Data');
plt.xticks(size = 15);
plt.yticks(size = 15);
plt.xlim(31.2,32.9);
#plt.ylim(0,400);
plt.xlabel('Accelerating Voltage (V)',size=20);
plt.ylabel('Current (pA)',size=20);
plt.plot(xspace,yfit,label='Fit');
plt.text(31.5,65, '$V_{min} = %.1f \pm %.1f$ V' % (V_min,dV) ,size=20)
plt.legend(loc='best');
In [19]:
def myfun(V,a,b,c):
ans = a + b*V + c*V**2
return ans
p0 = [0.5,0.5,0.5] #guess
xspace = np.linspace(36.25,37.85)
plsq, pcov = curve_fit(myfun, Voltage_Min36to39T186[30:180], Current_Min36to39T186[30:180], 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
yfit = myfun(xspace,plsq[0],plsq[1],plsq[2]) # use fit results for a, b, c
plt.figure(figsize=(10,6));
plt.scatter(Voltage_Min36to39T186[30:180],Current_Min36to39T186[30:180],marker='.',label='Data');
plt.xticks(size = 15);
plt.yticks(size = 15);
plt.xlim(36.25,37.85);
#plt.ylim(0,400);
plt.xlabel('Accelerating Voltage (V)',size=20);
plt.ylabel('Current (pA)',size=20);
plt.plot(xspace,yfit,label='Fit');
plt.text(36.5,85, '$V_{min} = %.1f \pm %.1f$ V' % (V_min,dV) ,size=20)
plt.legend(loc='best');
In [20]:
f, axarr = plt.subplots(1, 2,figsize=(8,3));
axarr[0].scatter(Voltage_FST157,Current_FST157,marker='.');
axarr[0].set_xlabel('Accelerating Voltage (V)');
axarr[0].set_ylabel('Current Signal (pA)');
axarr[0].set_xlim(0,41);
axarr[0].set_ylim(0,375);
axarr[0].text(3,300,'T = 430 K');
axarr[1].scatter(Voltage_FST186,Current_FST186,marker='.');
axarr[1].set_xlabel('Accelerating Voltage (V)');
#axarr[1].set_ylabel('Current Signal (pA)');
axarr[1].set_xlim(0,41);
axarr[1].set_ylim(0,150);
axarr[1].text(3,117,'T = 459 K');
# Fine-tune figure; hide x ticks for top plots and y ticks for right plots
f.tight_layout()
#plt.setp([a.get_xticklabels() for a in axarr[0, :]], visible=False);
#plt.setp([a.get_yticklabels() for a in axarr[:, 1]], visible=False);
plt.savefig('BothIV.png')
The contact potential is independent of the accelerating voltage, so its presence is of equal strength for all dips. Naively we would expect, the dip energy when divided by the dip number to provide the excitation energy. But this is actually E_dip = n*E_ex + E_con
In [21]:
EDip430 = np.array([7.5,12.5,17.5,22.7,27.9,33.1,38.3])
dEDip430 = np.array([0.2,0.4,0.8,0.6,0.7,0.9,1.4])
EDip459 = np.array([7.8,12.9,17.5,22.2,27.1,32,37.1])
dEDip459 = np.array([1.6,0.3,0.5,0.6,0.7,1,0.6])
n = np.array([1,2,3,4,5,6,7])
In [30]:
def myfun(n,EHg,EContact):
ans = n*EHg + EContact
return ans
p0 = [0.5,0.5] #guess
xspace = np.linspace(1,7)
plsq, pcov = curve_fit(myfun, n, EDip430, p0) # curve fit returns p and covariance matrix
# these give the parameters and the uncertainties
EHg430 = plsq[0]
eEHg430 = np.sqrt(pcov[0,0])
EContact430 = plsq[1]
eEContact430 = np.sqrt(pcov[1,1])
yfit430 = myfun(xspace,plsq[0],plsq[1]) # use fit results for a, b, c
In [38]:
def myfun(n,EHg,EContact):
ans = n*EHg + EContact
return ans
p0 = [0.5,0.5] #guess
xspace = np.linspace(1,7)
plsq, pcov = curve_fit(myfun, n, EDip459, p0) # curve fit returns p and covariance matrix
# these give the parameters and the uncertainties
EHg459 = plsq[0]
eEHg459 = np.sqrt(pcov[0,0])
EContact459 = plsq[1]
eEContact459 = np.sqrt(pcov[1,1])
yfit459 = myfun(xspace,plsq[0],plsq[1]) # use fit results for a, b, c
In [51]:
f, axarr = plt.subplots(1, 2,figsize=(8,3));
axarr[0].scatter(n,EDip430,marker='.',label='T = 430 K');
axarr[0].errorbar(n,EDip430,yerr =dEDip430,fmt='none');
axarr[0].plot(xspace,yfit430,label='Fit')
axarr[0].legend(loc='best')
axarr[0].set_xlabel('$n$',size=20);
axarr[0].set_ylabel('$K_n$',size=20);
axarr[0].text(4.1,15,'$E_{Hg} = %.2f \pm %.2f$ eV' % (EHg430,eEHg430));
axarr[0].text(4.1,10,'$E_{Contact} = %.2f \pm %.2f$ eV' % (EContact430,eEContact430));
axarr[1].scatter(n,EDip459,marker='.',label='T = 459 K');
axarr[1].errorbar(n,EDip459,yerr =dEDip459,fmt='none');
axarr[1].set_xlabel('$n$',size=20);
axarr[1].text(4.1,10,'$E_{Hg} = %.2f \pm %.2f$ eV' % (EHg459,eEHg459));
axarr[1].text(4.1,5,'$E_{Contact} = %.2f \pm %.2f$ eV' % (EContact459,eEContact459));
axarr[1].plot(xspace,yfit459,label='Fit')
axarr[1].legend(loc='best')
#axarr[1].text(1,35,'T = 459 K');
# Fine-tune figure; hide x ticks for top plots and y ticks for right plots
f.tight_layout()
#plt.setp([a.get_xticklabels() for a in axarr[0, :]], visible=False);
#plt.setp([a.get_yticklabels() for a in axarr[:, 1]], visible=False);
plt.savefig('ContactPotential.png')
In [ ]:
EDip430 = np.array([7.5,12.5,17.5,22.7,27.9,33.1,38.3])
dEDip430 = np.array([0.2,0.4,0.8,0.6,0.7,0.9,1.4])
EDip459 = np.array([7.8,12.9,17.5,22.2,27.1,32,37.1])
dEDip459 = np.array([1.6,0.3,0.5,0.6,0.7,1,0.6])
n = np.array([1,2,3,4,5,6,7])
In [72]:
DeltaE430 = np.array([EDip430[i] - EDip430[i-1] for i in np.arange(1,7)])
eDeltaE430 = np.array([np.sqrt(dEDip430[i]**2 + dEDip430[i-1]**2) for i in np.arange(1,7)])
DeltaE459 = np.array([EDip459[i] - EDip459[i-1] for i in np.arange(1,7)])
eDeltaE459 = np.array([np.sqrt(dEDip459[i]**2 + dEDip459[i-1]**2) for i in np.arange(1,7)])
n = np.array([2,3,4,5,6,7])
In [96]:
def myfun(n,yl,EHg):
ans = (1+yl*(2*n-1))*EHg
return ans
p0 = [0.5,0.5] #guess
xspace = np.linspace(2,7)
plsq, pcov = curve_fit(myfun, n, DeltaE430, p0,sigma = eDeltaE430) # curve fit returns p and covariance matrix
# these give the parameters and the uncertainties
yl430 = plsq[0]
eyl430 = np.sqrt(pcov[0,0])
EHg430 = plsq[1]
eHg430 = np.sqrt(pcov[1,1])
yfit430 = myfun(xspace,plsq[0],plsq[1]) # use fit results for a, b, c
In [94]:
def myfun(n,yl,EHg):
ans = (1+yl*(2*n-1))*EHg
return ans
p0 = [0.5,0.5] #guess
xspace = np.linspace(2,7)
plsq, pcov = curve_fit(myfun, n, DeltaE459, p0,sigma = eDeltaE459) # curve fit returns p and covariance matrix
# these give the parameters and the uncertainties
yl459 = plsq[0]
eyl459 = np.sqrt(pcov[0,0])
EHg459 = plsq[1]
eHg459 = np.sqrt(pcov[1,1])
yfit459 = myfun(xspace,plsq[0],plsq[1]) # use fit results for a, b, c
In [98]:
f, axarr = plt.subplots(1, 2,figsize=(10,4));
axarr[0].scatter(n,DeltaE430,marker='.',label='T = 430 K');
axarr[0].errorbar(n,DeltaE430,yerr = eDeltaE430,fmt='none');
axarr[0].plot(xspace,yfit430,label='Fit')
axarr[0].legend(loc='best')
axarr[0].set_xlabel('$n$',size=20);
axarr[0].set_ylabel('$\Delta K_n$',size=20);
axarr[0].text(2.3,3.3,'$E_{Hg} = %.2f \pm %.2f$ eV' % (EHg430,eEHg430),size='20');
axarr[1].scatter(n,DeltaE459,marker='.',label='T = 459 K');
axarr[1].errorbar(n,DeltaE459,yerr = eDeltaE459,fmt='none');
axarr[1].set_xlabel('$n$',size=20);
axarr[1].text(2.5,3.2,'$E_{Hg} = %.2f \pm %.2f$ eV' % (EHg459,eEHg459),size='20');
axarr[1].plot(xspace,yfit459,label='Fit')
axarr[1].legend(loc='best')
#axarr[1].text(1,35,'T = 459 K');
# Fine-tune figure; hide x ticks for top plots and y ticks for right plots
f.tight_layout()
#plt.setp([a.get_xticklabels() for a in axarr[0, :]], visible=False);
#plt.setp([a.get_yticklabels() for a in axarr[:, 1]], visible=False);
plt.savefig('End.png')
In [100]:
f, axarr = plt.subplots(1, 2,figsize=(10,4));
axarr[0].scatter(n,DeltaE430,marker='.',label='T = 430 K');
#axarr[0].errorbar(n,DeltaE430,yerr = eDeltaE430,fmt='none');
#axarr[0].plot(xspace,yfit430,label='Fit')
axarr[0].legend(loc='best')
axarr[0].set_xlabel('$n$',size=20);
axarr[0].set_ylabel('$\Delta K_n$',size=20);
#axarr[0].text(2.3,3.3,'$E_{Hg} = %.2f \pm %.2f$ eV' % (EHg430,eEHg430),size='20');
axarr[1].scatter(n,DeltaE459,marker='.',label='T = 459 K');
#axarr[1].errorbar(n,DeltaE459,yerr = eDeltaE459,fmt='none');
axarr[1].set_xlabel('$n$',size=20);
#axarr[1].text(2.5,3.2,'$E_{Hg} = %.2f \pm %.2f$ eV' % (EHg459,eEHg459),size='20');
#axarr[1].plot(xspace,yfit459,label='Fit')
axarr[1].legend(loc='best')
#axarr[1].text(1,35,'T = 459 K');
# Fine-tune figure; hide x ticks for top plots and y ticks for right plots
f.tight_layout()
#plt.setp([a.get_xticklabels() for a in axarr[0, :]], visible=False);
#plt.setp([a.get_yticklabels() for a in axarr[:, 1]], visible=False);
plt.savefig('End2.png')
In [ ]: