[SciPy-user] Polynomial interpolation

Anne Archibald peridot.faceted@gmail....
Tue Apr 29 15:54:10 CDT 2008

On 29/04/2008, Rob Hetland <hetland@tamu.edu> wrote:

>  I'm always glad to see more interpolation methods in scipy -- nice job
>  Anne.
>  My 2¢ on the discussion so far:  I think the best solution so far
>  suggested is no wrapper function in the package, but described in the
>  docstring (it is only two lines long, after all..).  Namespaces get
>  cluttered enough without all that extra stuff, and even if people
>  don't get OO, the can all certainly read a docstring.

Well, actually, this brings up a concern I have.

Suppose I want to use the class scipy.interpolate.interp1d, but I
don't know how.

In [18]: scipy.interpolate.interp1d?
Type:           type
Base Class:     <type 'type'>
String Form:    <class 'scipy.interpolate.interpolate.interp1d'>
Namespace:      Interactive
    Interpolate a 1D function.

    See Also
    splrep, splev - spline interpolation based on FITPACK
    UnivariateSpline - a more recent wrapper of the FITPACK routines

Uh, great, but how do I actually *use* it?

In [19]: scipy.interpolate.interp1d.__init__?
String Form:   <unbound method interp1d.__init__>
Namespace:        Interactive
Definition:       scipy.interpolate.interp1d.__init__(self, x, y,
kind='linear', axis=-1, copy=True, bounds_error=True, fill_value=nan)
    Initialize a 1D linear interpolation class.

    x and y are arrays of values used to approximate some function f:
        y = f(x)
    This class returns a function whose call method uses linear
    interpolation to find the value of new points.

    x : array

How are users supposed to find .__init__? This is what they need to
use to actually create an instance of the class, but the information
is not presented when they look at the class' docstring. Even a
moderately experienced user might have no idea there was a method
called __init__ whose docstring would have alleviated their suffering.

Should the class' docstring suggest users look at the docstring of
.__init__? Should it *include* that docstring? There must be a general
python solution to this...


More information about the SciPy-user mailing list