[NumPy-Tickets] [NumPy] #2149: interp(nan, ...) should yield nan
NumPy Trac
numpy-tickets@scipy....
Thu May 31 10:26:37 CDT 2012
#2149: interp(nan, ...) should yield nan
------------------------+---------------------------------------------------
Reporter: ehiggs | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone: Unscheduled
Component: Other | Version: 1.6.1
Keywords: nan interp |
------------------------+---------------------------------------------------
Passing nan to the first argument of interp appears to return the first
element of fp. This isn't a meaningful value and can silently corrupt data
since nan went in and undetectable garbage came out.
{{{
>>> import numpy as np
>>> np.interp(1, [-10, 10], [-2, 2])
0.20000000000000018
>>> np.interp(np.nan, [-10, 10], [-2, 2])
-2.0
>>> np.interp([np.nan, 1], [-10, 10], [-2, 2])
array([-2. , 0.2])
}}}
This -2.0 is not a meaningful answer. The interpolation of a nan value
should probably also be nan.
Thanks
--
Ticket URL: <http://projects.scipy.org/numpy/ticket/2149>
NumPy <http://projects.scipy.org/numpy>
My example project
More information about the NumPy-Tickets
mailing list