@@ -221,11 +221,15 @@ other temperatures using curve fitting models:
221
221
param, cov = curve_fit(f, temp[np.isfinite(part)], part[np.isfinite(part)])
222
222
x = np.linspace(2.7,500)
223
223
y = f(x,param[0])
224
- plt.scatter(temp,part,c='r')
225
- plt.plot(x,y,'k')
224
+ plt.clf()
225
+ plt.scatter(temp,part,c='r',label='CDMS Data')
226
+ plt.plot(x,y,'k',label='Fitted')
227
+ interp_Q = np.interp(x, temp, 10**part)
228
+ plt.plot(x, np.log10(interp_Q), label='Interpolated')
226
229
plt.title('Partition Function vs Temperature')
227
230
plt.xlabel('Temperature')
228
231
plt.ylabel('Log10 of Partition Function')
232
+ plt.legend(loc='best')
229
233
230
234
231
235
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:
241
245
.. plot ::
242
246
:context:
243
247
244
- result = CDMS.get_species_table()
245
- mol = result[result['TAG'] == 30501] #do not include signs of TAG for this
246
- def f(T, a):
247
- return np.log10(a*T**(1.5))
248
- keys = [k for k in mol.keys() if 'lg' in k]
249
- def tryfloat(x):
250
- try:
251
- return float(x)
252
- except:
253
- return np.nan
254
- x = np.linspace(2.7,500)
255
- y = f(x,param[0])
256
- temp = np.array([float(k.split('(')[-1].split(')')[0]) for k in keys])
257
- part = np.array([tryfloat(x) for x in mol[keys][0]])
258
- param, cov = curve_fit(f, temp[np.isfinite(part)], part[np.isfinite(part)])
259
248
interp_Q = np.interp(x, temp, 10**part)
249
+ plt.clf()
260
250
plt.plot(x, (10**y-interp_Q)/10**y)
261
251
plt.xlabel("Temperature")
262
252
plt.ylabel("Fractional difference between linear and fitted")
0 commit comments