[SciPy-user] Does scipy have a function to...?

Robert Kern robert.kern at gmail.com
Mon Sep 25 18:32:25 EDT 2006


Bill Dandreta wrote:
> What I want is a smooth curve that serves as an upper limit for a data
> plot. I would like it to be close to the data at the local maxima.
> 
> Does such a function exist?

No, not really. It would be quite tricky to construct such a beast. At the one 
end would be a complete interpolating curve that goes through every point; 
however, this will almost certainly not be as "smooth" as you want it. You would 
need to choose the length scale at which variations in the data are ignored. 
E.g. you need to find some means of determining why the curve should skip over A 
but try to get close to B.

   ________
  /*      *\
/    A     \
      *      \_______
                    *B

Possibly limiting the order of an interpolating polynomial or spline will be 
sufficient.

You might be able to formulate this as a constrained minimization problem using 
scipy.optimize.fmin_cobyla(). Take some curve f(x), minimize (f(x) - y) under 
the constraint (f(x) - y >= 0).

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco



More information about the SciPy-User mailing list