import sys
sys.path.append('/Users/ck/devel/peak-o-mat/')
from peak_o_mat.model import Model
from peak_o_mat.spec import Spec
m = Model('CB LO1 GA1 LO2')
m.parse()
print m.CB
print m.LO1
m.LO1.amp.value = 3.4
print m['LO1']['amp'].value
s = Spec('/Users/ck/devel/peak-o-mat/data/ruby.dat')
plot(s.x,s.y,'o')
m = Model('CB LO1 GA LO2')
m.parse()
m.CB.const.value = 0.0
m.LO1.amp.value = 1.0
m.LO1.fwhm.value = 0.5
m.LO1.pos.value = 6930
m.GA.amp.value = 2.0
m.GA.fwhm.value = 0.2
m.GA.pos.value = 6934
m.LO2.amp.value = 2.0
m.LO2.fwhm.value = 0.5
m.LO2.pos.value = 6944
import numpy as np
x = np.linspace(6925,6950,500)
y = m.evaluate(x)
plot(s.x,s.y,'ko',alpha=0.2)
plot(x,y,'r-')
from peak_o_mat.fit import Fit
f = Fit(s, m)
res = f.run()
print res[-1]
m.update_from_fit(res)
y = m.evaluate(x)
plot(s.x,s.y,'ko',alpha=0.2)
plot(x,y,'r-')