Not quite sure what this is trying to fit, but seems to be some kind of line spectrum
In [4]:
%matplotlib inline
import matplotlib.pyplot as plt
import sys
import os
sys.path.append('..')
sys.path.append('../../spc')
import spectra, spc
In [7]:
raw_d = spc.File(os.path.join("../../data/data_spc/MERC.SPC"))
x = raw_d.x
y = raw_d.sub[0].y
In [8]:
plt.plot(x,y,'r-')
Out[8]:
In [9]:
from spectra import find_peaks
In [10]:
?find_peaks
In [11]:
pos = find_peaks(x, y)
plt.plot(x, y, 'r-', x[pos], y[pos], 'ro')
Out[11]:
In [14]:
from spectra import fit_data, output_results
out1 = fit_data(x, y, pos)
In [15]:
output_results(out1)
Out[15]:
In [28]:
plt.semilogy(x, y, 'r-', x, out1.best_fit, 'b--')
#plt.xlim(18000, 18500)
Out[28]:
In [ ]: