Re: [Numpy-discussion] suggested change of behavior for interp

2013-06-05 Thread Nathaniel Smith
On 5 Jun 2013 03:21, Eric Firing efir...@hawaii.edu wrote: On 2013/06/04 4:15 PM, Benjamin Root wrote: Could non-monotonicity be detected as part of the interp process? Perhaps a sign switch in the deltas? There are two code paths, depending on the number of points to be interpolated.

Re: [Numpy-discussion] suggested change of behavior for interp

2013-06-05 Thread Slavin, Jonathan
. Jon On Tue, Jun 4, 2013 at 9:03 PM, numpy-discussion-requ...@scipy.org wrote: From: Eric Firing efir...@hawaii.edu To: numpy-discussion@scipy.org Cc: Date: Tue, 04 Jun 2013 15:08:29 -1000 Subject: Re: [Numpy-discussion] suggested change of behavior for interp On 2013/06/04 2:05 PM, Charles

Re: [Numpy-discussion] suggested change of behavior for interp

2013-06-05 Thread Nathaniel Smith
On Wed, Jun 5, 2013 at 3:16 PM, Slavin, Jonathan jsla...@cfa.harvard.edu wrote: The simplest monotonicity test that I've seen is: dx = np.diff(x) monotonic = np.all(dx 0.) or np.all(dx 0.) I expect that this is pretty fast, though I haven't tested it yet. If we want to make checking

Re: [Numpy-discussion] suggested change of behavior for interp

2013-06-05 Thread Julian Taylor
On 05.06.2013 16:33, Nathaniel Smith wrote: On Wed, Jun 5, 2013 at 3:16 PM, Slavin, Jonathan jsla...@cfa.harvard.edu wrote: The simplest monotonicity test that I've seen is: dx = np.diff(x) monotonic = np.all(dx 0.) or np.all(dx 0.) I expect that this is pretty fast, though I haven't

Re: [Numpy-discussion] suggested change of behavior for interp

2013-06-05 Thread Nathaniel Smith
On Wed, Jun 5, 2013 at 6:08 PM, Julian Taylor jtaylor.deb...@googlemail.com wrote: On 05.06.2013 16:33, Nathaniel Smith wrote: The slow down people are worried about is, suppose that 'xp' has 1,000,000 entries, and the user wants to interpolate 1 point. If we can assume the array is sorted,

Re: [Numpy-discussion] suggested change of behavior for interp

2013-06-05 Thread Charles R Harris
On Wed, Jun 5, 2013 at 11:48 AM, Nathaniel Smith n...@pobox.com wrote: On Wed, Jun 5, 2013 at 6:08 PM, Julian Taylor jtaylor.deb...@googlemail.com wrote: On 05.06.2013 16:33, Nathaniel Smith wrote: The slow down people are worried about is, suppose that 'xp' has 1,000,000 entries, and the

Re: [Numpy-discussion] suggested change of behavior for interp

2013-06-05 Thread Charles R Harris
On Wed, Jun 5, 2013 at 11:59 AM, Charles R Harris charlesr.har...@gmail.com wrote: On Wed, Jun 5, 2013 at 11:48 AM, Nathaniel Smith n...@pobox.com wrote: On Wed, Jun 5, 2013 at 6:08 PM, Julian Taylor jtaylor.deb...@googlemail.com wrote: On 05.06.2013 16:33, Nathaniel Smith wrote: The

Re: [Numpy-discussion] suggested change of behavior for interp

2013-06-05 Thread Charles R Harris
On Wed, Jun 5, 2013 at 12:00 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Wed, Jun 5, 2013 at 11:59 AM, Charles R Harris charlesr.har...@gmail.com wrote: On Wed, Jun 5, 2013 at 11:48 AM, Nathaniel Smith n...@pobox.com wrote: On Wed, Jun 5, 2013 at 6:08 PM, Julian Taylor

[Numpy-discussion] suggested change of behavior for interp

2013-06-04 Thread Slavin, Jonathan
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

Re: [Numpy-discussion] suggested change of behavior for interp

2013-06-04 Thread Charles R Harris
On Tue, Jun 4, 2013 at 12:07 PM, Slavin, Jonathan jsla...@cfa.harvard.eduwrote: 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

Re: [Numpy-discussion] suggested change of behavior for interp

2013-06-04 Thread Eric Firing
On 2013/06/04 2:05 PM, Charles R Harris wrote: On Tue, Jun 4, 2013 at 12:07 PM, Slavin, Jonathan jsla...@cfa.harvard.edu mailto:jsla...@cfa.harvard.edu wrote: Hi, I would like to suggest that the behavior of numpy.interp be changed regarding treatment of situations in which

Re: [Numpy-discussion] suggested change of behavior for interp

2013-06-04 Thread Benjamin Root
Could non-monotonicity be detected as part of the interp process? Perhaps a sign switch in the deltas? I have been bitten by this problem too. Cheers! Ben Root On Jun 4, 2013 9:08 PM, Eric Firing efir...@hawaii.edu wrote: On 2013/06/04 2:05 PM, Charles R Harris wrote: On Tue, Jun 4,

Re: [Numpy-discussion] suggested change of behavior for interp

2013-06-04 Thread Eric Firing
On 2013/06/04 4:15 PM, Benjamin Root wrote: Could non-monotonicity be detected as part of the interp process? Perhaps a sign switch in the deltas? There are two code paths, depending on the number of points to be interpolated. When it is greater than the size of the table, the deltas are