Question

I tried fitting a function to data from a matrix synthData in the form of arrays synthData[0,:], synthData[1,:], and the y-values synthData[2,:]. But the following snippet returns "name 'args' not defined"

guess = [16.200000, -0.700000, 5.900000, -0.200000]

def func(x, a, b, c, d):
    # fitter will understand that x[0] equiv. to synthData[:,0], etc.
    return a + b*x[0] + c*x[1] + d*x[0]*x[1]
scipy.optimize.leastsq(func,guess,args(synthData,synthData[2,:]))

I've fiddled with it and searched around in SO, but can't figure out what it's getting at.

Was it helpful?

Solution

I think you are missing an equals sign:

scipy.optimize.leastsq(func,guess,args=(synthData,synthData[2,:]))
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top