def function(x, lamb, offsX, offsY, scaleX, scaleY): # poisson function, parameter lamb is the fit parameter x = (x - offsX) / scaleX y = (lamb**x / factorial(x)) * np.exp(-lamb) return scaleY * y + offsY