refactor plots
@@ -221,11 +221,15 @@ other temperatures using curve fitting models:
param, cov = curve_fit(f, temp[np.isfinite(part)], part[np.isfinite(part)])
x = np.linspace(2.7,500)
y = f(x,param[0])
- plt.scatter(temp,part,c='r')
- plt.plot(x,y,'k')
+ plt.clf()
+ plt.scatter(temp,part,c='r',label='CDMS Data')
+ plt.plot(x,y,'k',label='Fitted')
+ interp_Q = np.interp(x, temp, 10**part)
+ plt.plot(x, np.log10(interp_Q), label='Interpolated')
plt.title('Partition Function vs Temperature')
plt.xlabel('Temperature')
plt.ylabel('Log10 of Partition Function')
+ plt.legend(loc='best')
We can then compare linear interpolation to the fitted interpolation above:
@@ -241,22 +245,8 @@ We can then compare linear interpolation to the fitted interpolation above:
.. plot::
:context:
- result = CDMS.get_species_table()
- mol = result[result['TAG'] == 30501] #do not include signs of TAG for this
- def f(T, a):
- return np.log10(a*T**(1.5))
- keys = [k for k in mol.keys() if 'lg' in k]
- def tryfloat(x):
- try:
- return float(x)
- except:
- return np.nan
- x = np.linspace(2.7,500)
- y = f(x,param[0])
- temp = np.array([float(k.split('(')[-1].split(')')[0]) for k in keys])
- part = np.array([tryfloat(x) for x in mol[keys][0]])
- param, cov = curve_fit(f, temp[np.isfinite(part)], part[np.isfinite(part)])
interp_Q = np.interp(x, temp, 10**part)
+ plt.clf()
plt.plot(x, (10**y-interp_Q)/10**y)
plt.xlabel("Temperature")
plt.ylabel("Fractional difference between linear and fitted")
