vcurve = numpy.vectorize(curve, excluded=set([1]))
truexdata = numpy.asarray([0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0])
trueydata = vcurve(truexdata, 1.0)
xdata = truexdata + 0.1 * numpy.random.randn(8)
ydata = trueydata + 0.1 * numpy.random.randn(8)
popt, pcov = scipy.optimize.curve_fit(vcurve, xdata, ydata, p0=[2.0])
print(popt)
Fitting data with integral function