Curve fitting

Discussion in 'Python' started by Tom Anderson, May 8, 2005.

  1. Tom Anderson

    Tom Anderson Guest

    Hi,

    I'd like to fit a curve (a rectangular hyperbola, in fact) to some data
    points as part of a program i'm writing. Can anyone suggest a package
    which would help me do this?

    A bit of googling suggests that SciPy might be what i want. Does that
    sound likely?

    Thanks,
    tom

    --
    OBEY GIANT
     
    Tom Anderson, May 8, 2005
    #1
    1. Advertising

  2. On 2005-05-08, Tom Anderson <> wrote:

    > I'd like to fit a curve (a rectangular hyperbola, in fact) to
    > some data points as part of a program i'm writing. Can anyone
    > suggest a package which would help me do this?


    I use the LeastSquares function in Scientific Python:

    http://starship.python.net/~hinsen/ScientificPython/

    > A bit of googling suggests that SciPy might be what i want.
    > Does that sound likely?


    Sure.

    --
    Grant Edwards grante Yow! An air of FRENCH
    at FRIES permeates my
    visi.com nostrils!!
     
    Grant Edwards, May 8, 2005
    #2
    1. Advertising

  3. Tom Anderson

    Tom Anderson Guest

    On Sun, 8 May 2005, Grant Edwards wrote:

    > On 2005-05-08, Tom Anderson <> wrote:
    >
    > > I'd like to fit a curve (a rectangular hyperbola, in fact) to
    > > some data points as part of a program i'm writing. Can anyone
    > > suggest a package which would help me do this?

    >
    > I use the LeastSquares function in Scientific Python:
    >
    > http://starship.python.net/~hinsen/ScientificPython/


    I'll check that out, cheers.

    > > A bit of googling suggests that SciPy might be what i want. Does that
    > > sound likely?

    >
    > Sure.


    I ended up using scipy.optimize.minpack.leastsq, and it works brilliantly.
    The interface is a bit awkward - it wants a function from a guess at the
    parameters to a list of residuals; i'd rather give it a function from
    parameters + x-coordinate to y-coordinate plus a set of points, and have
    it work out the residuals for me - so i wrote a little wrapper to make it
    suit me better, and now i'm cooking with gas. The only problem is that the
    optimisation doesn't converge, but i think that's probably a bug in my
    code!

    tom

    --
    Punk's not sexual, it's just aggression.
     
    Tom Anderson, May 8, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?R2VvZmYgQyBNZWxib3VybmU=?=

    Fitting lots of fields on one web page

    =?Utf-8?B?R2VvZmYgQyBNZWxib3VybmU=?=, May 27, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    537
    John Timney \(ASP.NET MVP\)
    May 30, 2005
  2. Vinodh Kumar

    Quadratic curve fitting!

    Vinodh Kumar, Aug 11, 2003, in forum: C++
    Replies:
    6
    Views:
    5,250
    onetimeuser
    Dec 1, 2010
  3. Hicham Mouline
    Replies:
    2
    Views:
    390
    Jerry Coffin
    Sep 14, 2009
  4. Phil Rhoades

    Curve fitting to data

    Phil Rhoades, Dec 16, 2007, in forum: Ruby
    Replies:
    10
    Views:
    256
    zunzun
    Dec 18, 2007
  5. Fearless Fool
    Replies:
    2
    Views:
    247
    Fearless Fool
    May 6, 2011
Loading...

Share This Page