def test_curveFitdemo(self): real = lambda p, x: p[0] * scipy.exp(-((x-p[1])/p[2])**2) + scipy.rand(100) functionToFit = lambda p, x: p[0] * scipy.exp(-((x-p[1])/p[2])**2) initialParameters = [5., 7., 3.] dataX = scipy.linspace(0, 10, 100) dataY = real(initialParameters, dataX) cf = CurveFit(functionToFit, initialParameters, dataX, dataY) cf.estimate() cf.plot()
def test_curveFitdemo(self): real = lambda p, x: p[0] * scipy.exp(-( (x - p[1]) / p[2])**2) + scipy.rand(100) functionToFit = lambda p, x: p[0] * scipy.exp(-((x - p[1]) / p[2])**2) initialParameters = [5., 7., 3.] dataX = scipy.linspace(0, 10, 100) dataY = real(initialParameters, dataX) cf = CurveFit(functionToFit, initialParameters, dataX, dataY) cf.estimate() cf.plot()