@@ -156,7 +156,6 @@ shown below:
156
156
157
157
import matplotlib.pyplot as plt
158
158
from astroquery.linelists.cdms import CDMS
159
- from scipy.optimize import curve_fit
160
159
161
160
result = CDMS.get_species_table()
162
161
mol = result[result['TAG'] == 28503] #do not include signs of TAG for this
@@ -203,11 +202,14 @@ other temperatures using curve fitting models:
203
202
204
203
205
204
.. plot ::
206
- :context:
205
+ :context: reset
206
+
207
+ import matplotlib.pyplot as plt
208
+ from astroquery.linelists.cdms import CDMS
209
+ from scipy.optimize import curve_fit
207
210
208
211
result = CDMS.get_species_table()
209
212
mol = result[result['TAG'] == 30501] #do not include signs of TAG for this
210
- from scipy.optimize import curve_fit
211
213
def f(T, a):
212
214
return np.log10(a*T**(1.5))
213
215
keys = [k for k in mol.keys() if 'lg' in k]
@@ -244,7 +246,27 @@ We can then compare linear interpolation to the fitted interpolation above:
244
246
>>> plt.ylabel(" Fractional difference between linear and fitted" )
245
247
246
248
.. plot ::
247
- :context:
249
+ :context: reset
250
+
251
+ import matplotlib.pyplot as plt
252
+ from astroquery.linelists.cdms import CDMS
253
+ from scipy.optimize import curve_fit
254
+
255
+ result = CDMS.get_species_table()
256
+ mol = result[result['TAG'] == 30501] #do not include signs of TAG for this
257
+ def f(T, a):
258
+ return np.log10(a*T**(1.5))
259
+ keys = [k for k in mol.keys() if 'lg' in k]
260
+ def tryfloat(x):
261
+ try:
262
+ return float(x)
263
+ except:
264
+ return np.nan
265
+ temp = np.array([float(k.split('(')[-1].split(')')[0]) for k in keys])
266
+ part = np.array([tryfloat(x) for x in mol[keys][0]])
267
+ param, cov = curve_fit(f, temp[np.isfinite(part)], part[np.isfinite(part)])
268
+ x = np.linspace(2.7,500)
269
+ y = f(x,param[0])
248
270
249
271
plt.clf()
250
272
plt.plot(x, (10**y-interp_Q)/10**y)
0 commit comments