[SciPy-user] Using mpfit

Jared Peacock jpeacock@mesoscopic.mines....
Tue Feb 27 14:54:07 CST 2007

I'm trying to use mpfit but I can't seem to get it to work.  I'm
testing the code using this program, which is similar to the example
from the mpfit text:

import mpfit2
import Numeric

p0=[5.7, 2.2, 500., 1.5, 2000.]

def myfunct(p,fjac=None,x=None,y=None,err=None):
    return [status,(y-f)/err]

fa = {'x':x, 'y':y, 'err':err}
m = mpfit2.mpfit(myfunct, xall=p0, functkw=fa)
print 'status = ', m.status
#if (m.status <= 0): print 'error message = ', m.errmsg
print 'parameters = ', m.params

But when I run it I get this error: 

    m = mpfit2.mpfit(myfunct, xall=p0, functkw=fa)
  File "mpfit2.py", line 1007, in __init__
    [self.status, fvec] = self.call(fcn, self.params, functkw)
TypeError: unpack non-sequence

I'm not sure what this means or how to fix it.  Does anybody have and
incite to this problem and using mpfit?

J. Peacock

More information about the SciPy-user mailing list