In [31]:
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import pandas as pd
from scipy.optimize import curve_fit
%matplotlib notebook
plt.style.use('ggplot')
T2* due to non-uniform field T2 is from spin interactions
In [32]:
def fit_func(x, a, b, c):
return a * np.exp(-b * x) + c
In [33]:
img=mpimg.imread('mineral_oil.png')
plt.imshow(img)
Out[33]:
In [34]:
diff = np.array([250.189,191.168])-np.array([186.052,240.584])
scale = abs(diff/np.array([10e-3,2]))
x = np.array([6.90,25.241,57.99,81.57,114.31,145.75,191.60,268.88])/scale[0]
y = 500 - np.array([95.16,155.42,209.12,240.56,270.67,292.96,322.22,341.42])/scale[1]
y = y-y.min()
pd.DataFrame(np.array([x,y]).T[::-1],index = np.arange(0,len(x)),columns = ['volts','seconds']).to_csv('mineral_oil.csv')
In [35]:
popt, pcov = curve_fit(fit_func, x, y)
a,b,c = popt
print 1.0/b # s
x_fit = np.arange(0,x.max(),x.max()/1000)
plt.close()
plt.plot(x_fit,fit_func(x_fit,a,b,c))
plt.xlabel('$t (s)$',size=14)
plt.ylabel('$Volt$',size=14)
plt.scatter(x,y)
plt.show()
In [36]:
plt.close()
img=mpimg.imread('glycerine.png')
plt.imshow(img)
Out[36]:
In [37]:
diff = np.array([527.971,239.949])-np.array([464.075,290.625])
scale = abs(diff/np.array([10.40e-3,1.16]))
x = np.array([66.37,91.22,133.58,177.65,201.88,245.95,301.03,343.00,392.47,449.76,515.85,577.55,633.73])/scale[0]
y = 500 - np.array([75.80,118.77,157.32,199.19,225.63,249.78,301.64,331.39,354.52,379.86,404.10,418.42,426.13])/scale[1]
y = y-y.min()
pd.DataFrame(np.array([x,y]).T[::-1],index = np.arange(0,len(x)),columns = ['volts','seconds']).to_csv('glycerine.csv')
In [38]:
popt, pcov = curve_fit(fit_func, x, y)
a,b,c = popt
print 1.0/b # s
x_fit = np.arange(0,x.max(),x.max()/1000)
plt.close()
plt.plot(x_fit,fit_func(x_fit,a,b,c))
plt.xlabel('$t (s)$',size=14)
plt.ylabel('$Volt$',size=14)
plt.scatter(x,y)
plt.show()
In [39]:
plt.close()
img=mpimg.imread('CuSO4.png')
plt.imshow(img)
Out[39]:
In [65]:
diff = np.array([464.672,240.472])-np.array([401.148,290.383])
scale = abs(diff/np.array([11e-3,1.44]))
x = np.array([73.42,99.22,129.87,163.74,196.00,241.16,284.71,323.42,387.93,471.80,576.64])/scale[0]
y = (500 - np.array([69.10,120.71,178.77,223.93,261.03,302.97,332.00,352.97,377.16,401.35,419.10]))/scale[1]
y = y-y.min()
pd.DataFrame(np.array([x,y]).T[::-1],index = np.arange(0,len(x)),columns = ['volts','seconds']).to_csv('CuSO4.csv')
In [66]:
popt, pcov = curve_fit(fit_func, x, y)
a,b,c = popt
print 1.0/b # s
x_fit = np.arange(0,x.max(),x.max()/1000)
plt.close()
plt.plot(x_fit,fit_func(x_fit,a,b,c))
plt.xlabel('$t (s)$',size=14)
plt.ylabel('$Volt$',size=14)
plt.scatter(x,y)
plt.show()
In [44]:
plt.close()
img=mpimg.imread('1_53.png')
plt.imshow(img)
Out[44]:
In [67]:
diff = np.array([601.1,300.6])-np.array([500.7,201.2])
scale = abs(diff/np.array([5e-3,1.08]))
x = np.array([319.3,332.4,357.2,383.0,408.3,434.6,460.0,485.7,511.0,536.8,562.7,587.9,613.8,639.0])/scale[0]
y = (500-np.array([250.1,254.8,268.5,280.1,289.1,295.4,296.0,299.6,310.1,315.4,312.8,320.7,321.7,324.4]))/scale[1]
y = y-y.min()
pd.DataFrame(np.array([x,y]).T[::-1],index = np.arange(0,len(x)),columns = ['volts','seconds']).to_csv('polystyrene1_53.csv')
popt, pcov = curve_fit(fit_func, x, y)
a,b,c = popt
print 1.0/b # s
x_fit = np.arange(x.min(),x.max(),x.max()/1000)
plt.close()
plt.plot(x_fit,fit_func(x_fit,a,b,c))
plt.xlabel('$t (s)$',size=14)
plt.ylabel('$Volt$',size=14)
plt.scatter(x,y)
plt.show()
In [69]:
plt.close()
img=mpimg.imread('0_81.png')
plt.imshow(img)
Out[69]:
In [70]:
diff = np.array([399.2,300.6])-np.array([300.8,199.0])
scale = abs(diff/np.array([5e-3,1.32]))
x = np.array([335.9,362.4,387.7,413.6,438.8,464.7,490.6,516.4,542.3,567.6])/scale[0]
y = (500-np.array([332.1,332.1,338.8,344.8,353.2,352.0,356.2,363.4,362.8,360.4]))/scale[1]
y = y-y.min()
pd.DataFrame(np.array([x,y]).T[::-1],index = np.arange(0,len(x)),columns = ['volts','seconds']).to_csv('polystyrene0_81.csv')
popt, pcov = curve_fit(fit_func, x, y)
a,b,c = popt
print 1.0/b # s
x_fit = np.arange(x.min(),x.max(),x.max()/1000)
plt.close()
plt.plot(x_fit,fit_func(x_fit,a,b,c))
plt.xlabel('$t (s)$',size=14)
plt.ylabel('$Volt$',size=14)
plt.scatter(x,y)
plt.show()
In [72]:
plt.close()
img=mpimg.imread('polystyrene_1_53_saturated.png')
plt.imshow(img)
Out[72]:
In [27]:
amplitude = np.array([10.88,9.8,8.6,7.32,6.24,5.64,4.64,3.76,2.84,2.04,1.16,0.44,1.08,
1.92,2.52,3.08,3.60,4.04,4.48,4.92,5.4,5.76,6.12,6.40,6.72,7.08,
7.40,7.68]) #V
delay = np.linspace(100,5400,len(amplitude))*1e-2 #ms
pd.DataFrame(np.array([delay,amplitude]).T,index = np.arange(0,len(delay)),columns = ['ms','volts']).to_csv('splin_lattice_interaction.csv')
In [28]:
plt.close()
plt.scatter(delay,amplitude)
plt.xlabel('$Delay \ (ms)$')
plt.ylabel('$Volts$')
Out[28]:
In [29]:
plt.close()
In [ ]: