Problems with LeastSquares

Ben Freasier bcf@pegasus.ch.adfa.oz.au
Fri, 24 Oct 1997 14:43:04 +1000


We recently put MMTK up on a Sun here. We don't have a great
 deal of experience with Python, but I was interested in using 
the non-linear least squares module. I got the following message
when I ran the module as a test script:

[onsager]: python /opt/lib/python1.4/LeastSquares.py
Traceback (innermost last):
  File "/opt/lib/python1.4/LeastSquares.py", line 97, in ?
    print leastSquaresFit(f, (1e13,4700), data_classical)
  File "/opt/lib/python1.4/LeastSquares.py", line 66, in leastSquaresFit
    chi_sq, alpha = _chiSquare(model, p, data)
  File "/opt/lib/python1.4/LeastSquares.py", line 51, in _chiSquare
    f = model(tuple(parameters), tuple(point[0]))
TypeError: tuple() argument must be a sequence
[onsager]: exit
 
script done on Fri Oct 24 14:27:19 1997

I can get the script to work by changin the lines in the script to
#       f = model(tuple(parameters), tuple(point[0]))
        f = model(parameters, point[0])

However, I would like to use the script on a multivariate model function, so it
would be preferable if I could get things going as I understand the 
documentation (which I certainly haven't been able to do yet).

It is obvious to anybody what is going on here? Thanks for any help you can 
give me.

Cheers,

Ben Freasier