[SciPy-User] scipy.optimize leastsq with numpy longdouble?

Joan Smith joans@MIT....
Wed Nov 17 11:13:56 CST 2010


I'm fitting a maxwell-botlzmann distribution, using SciPy leastsq. Because of the data I'm fitting, I need high precision (on both the high and low ends), so I'm using numpy.longdouble for my types. Is there a way to use this type with leastsq? As it stands, I'm getting this error:

    v = leastsq(self.chi_squared, self.v_0,  args=self.args, full_output=1)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/optimize/minpack.py", line 281, in leastsq
    maxfev, epsfcn, factor, diag)
TypeError: array cannot be safely cast to required type

I've been using leastsq for a while, and haven't seen this error before, so I suspect it has to do with using an unusual type.

Thanks in advance,

More information about the SciPy-User mailing list