[Numpy-discussion] suggested change of behavior for interp

Slavin, Jonathan jslavin at cfa.harvard.edu
Tue Jun 4 14:07:06 EDT 2013


Hi,

I would like to suggest that the behavior of numpy.interp be changed
regarding treatment of situations in which the x-coordinates are not
monotonically increasing.  Specifically, it seems to me that interp should
work correctly when the x-coordinate is decreasing monotonically.  Clearly
it cannot work if the x-coordinate is not monotonic, but in that case it
should raise an exception.  Currently if x is not increasing it simply
silently fails, providing incorrect values.  This fix could be as simple as
a monotonicity test and inversion if necessary (plus a raise statement for
non-monotonic cases).

Jon
________________________________________________________
Jonathan D. Slavin                 Harvard-Smithsonian CfA
jslavin at cfa.harvard.edu       60 Garden Street, MS 83
phone: (617) 496-7981       Cambridge, MA 02138-1516
fax: (617) 496-7577            USA
________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20130604/5e285005/attachment.html>


More information about the NumPy-Discussion mailing list