In [4]:
%matplotlib inline
In [1]:
from xastropy.xutils import afits as xafits
In [44]:
x = np.linspace(0.,np.pi,100)
y = np.sin(x)
In [46]:
reload(xafits)
fdict = xafits.func_fit(x,y,'polynomial',4)
In [16]:
xdb.xplot(x,y,xafits.func_val(x,fdict))
In [40]:
reload(xafits)
bfdict = xafits.func_fit(x,y,'bspline',3,everyn=25)
In [42]:
xdb.xplot(x,y,xafits.func_val(x,bfdict))
In [49]:
y[50] = 3.
# Fit
dfit, mask = xafits.iter_fit(x, y, 'bspline', 3, everyn=25)
assert np.sum(mask) == 1
x2 = np.linspace(0,np.pi,100)
y2 = xafits.func_val(x2,dfit)
np.testing.assert_allclose(y2[50], 1.000155331836333)
In [50]:
xdb.xplot(x,y,xafits.func_val(x,dfit))
In [51]:
dfit
Out[51]:
In [ ]: