Re: [Numpy-discussion] Round away from zero (towards +/- infinity)

2014-10-04 Thread Charles R Harris
On Fri, Oct 3, 2014 at 11:28 AM, T J wrote: > It does, but it is not portable. That's why I was hoping NumPy might think > about supporting more rounding algorithms. > > On Thu, Oct 2, 2014 at 10:00 PM, John Zwinck wrote: > >> On 3 Oct 2014 07:09, "T J" wrote: >> > >> > Any bites on this? >> >

Re: [Numpy-discussion] Changed behavior of np.gradient

2014-10-04 Thread Stéfan van der Walt
On Oct 4, 2014 10:14 PM, "Derek Homeier" < de...@astro.physik.uni-goettingen.de> wrote: > > +1 for an order=2 or maxorder=2 flag If you parameterize that flag, users will want to change its value (above two). Perhaps rather use a boolean flag such as "second_order" or "high_order", unless it seems

Re: [Numpy-discussion] Changed behavior of np.gradient

2014-10-04 Thread Derek Homeier
Hi Ariel, > I think that the docstring in 1.9 is fine (has the 1.9 result). The docs > online (for all of numpy) are still on version 1.8, though. > > I think that enabling the old behavior might be useful, if only so that I can > write code that behaves consistently across these two versions

Re: [Numpy-discussion] Changed behavior of np.gradient

2014-10-04 Thread Ariel Rokem
On Sat, Oct 4, 2014 at 12:29 PM, Derek Homeier < de...@astro.physik.uni-goettingen.de> wrote: > On 4 Oct 2014, at 08:37 pm, Ariel Rokem wrote: > > > >>> import numpy as np > > >>> np.__version__ > > '1.9.0' > > >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=np.float)) > > [array([[ 2., 2

Re: [Numpy-discussion] Changed behavior of np.gradient

2014-10-04 Thread Derek Homeier
On 4 Oct 2014, at 08:37 pm, Ariel Rokem wrote: > >>> import numpy as np > >>> np.__version__ > '1.9.0' > >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=np.float)) > [array([[ 2., 2., -1.], >[ 2., 2., -1.]]), array([[-0.5, 2.5, 5.5], >[ 1. , 1. , 1. ]])] > > On the o

[Numpy-discussion] Changed behavior of np.gradient

2014-10-04 Thread Ariel Rokem
Hi everyone, >>> import numpy as np >>> np.__version__ '1.9.0' >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=np.float)) [array([[ 2., 2., -1.], [ 2., 2., -1.]]), array([[-0.5, 2.5, 5.5], [ 1. , 1. , 1. ]])] On the other hand: >>> import numpy as np >>> np.__v

Re: [Numpy-discussion] 0/0 == 0?

2014-10-04 Thread Robert Kern
On Sat, Oct 4, 2014 at 2:17 AM, Nathaniel Smith wrote: > On Sat, Oct 4, 2014 at 12:40 AM, Robert Kern wrote: >> On Sat, Oct 4, 2014 at 12:21 AM, Nathaniel Smith wrote: >>> On Fri, Oct 3, 2014 at 8:12 AM, Robert Kern wrote: On Fri, Oct 3, 2014 at 4:29 AM, Nathaniel Smith wrote: > On Fr

Re: [Numpy-discussion] 0/0 == 0?

2014-10-04 Thread Georg Brandl
On 10/03/2014 11:24 PM, Charles R Harris wrote: > What I want is that the following script would warn three times > > import numpy as np > > z = np.zeros(1, dtype=np.int ) > > def f(x): > return x/x > > f(z) > f(z) > f(z) > > But it only warns once. That is not helpful when