Re: [Numpy-discussion] subsampling arrays without loops

2013-10-03 Thread Jaime Fernández del Río
On Thu, Oct 3, 2013 at 4:05 PM, Moroney, Catherine M (398D) < catherine.m.moro...@jpl.nasa.gov> wrote: > I know I have a lot yet to learn about array striding tricks, so please > pardon the triviality of this question. > > Here is the problem both in words and "dumb" python: > > I have a large NxM

[Numpy-discussion] subsampling arrays without loops

2013-10-03 Thread Moroney, Catherine M (398D)
I know I have a lot yet to learn about array striding tricks, so please pardon the triviality of this question. Here is the problem both in words and "dumb" python: I have a large NxM array that I want to break down into smaller nxn chunks where n divides evenly into both N and M. Then I want to

Re: [Numpy-discussion] Behavior of nan{max, min} and nanarg{max, min} for all-nan slices.

2013-10-03 Thread Charles R Harris
On Thu, Oct 3, 2013 at 2:38 PM, Nathaniel Smith wrote: > On Thu, Oct 3, 2013 at 8:40 PM, Charles R Harris > wrote: > > > > > > > > On Thu, Oct 3, 2013 at 1:11 PM, Nathaniel Smith wrote: > >> > >> On Thu, Oct 3, 2013 at 7:59 PM, Charles R Harris > >> wrote: > >> > > >> > > >> > > >> >> > >> >>

Re: [Numpy-discussion] Behavior of nan{max, min} and nanarg{max, min} for all-nan slices.

2013-10-03 Thread Nathaniel Smith
On Thu, Oct 3, 2013 at 8:40 PM, Charles R Harris wrote: > > > > On Thu, Oct 3, 2013 at 1:11 PM, Nathaniel Smith wrote: >> >> On Thu, Oct 3, 2013 at 7:59 PM, Charles R Harris >> wrote: >> > >> > >> > >> >> >> >> Please, no. It's another thing to remember and another way to shoot >> >> yourself i

Re: [Numpy-discussion] Behavior of nan{max, min} and nanarg{max, min} for all-nan slices.

2013-10-03 Thread Daniele Nicolodi
On 03/10/2013 20:59, Charles R Harris wrote: > Here is what I have currently implemented. First, define an AllNanError > > class AllNanError(ValueError): > def __init__(self, msg, result): > ValueError.__init__(self, msg) > self.result = result > > For nanmax/nanmin/nanargmax

Re: [Numpy-discussion] Behavior of nan{max, min} and nanarg{max, min} for all-nan slices.

2013-10-03 Thread Charles R Harris
On Thu, Oct 3, 2013 at 1:11 PM, Nathaniel Smith wrote: > On Thu, Oct 3, 2013 at 7:59 PM, Charles R Harris > wrote: > > > > > > > >> > >> Please, no. It's another thing to remember and another way to shoot > >> yourself in the foot and introduce casual bugs. > >> > >> FWIW, my vote is to raise a

Re: [Numpy-discussion] Behavior of nan{max, min} and nanarg{max, min} for all-nan slices.

2013-10-03 Thread Nathaniel Smith
On Thu, Oct 3, 2013 at 7:59 PM, Charles R Harris wrote: > > > >> >> Please, no. It's another thing to remember and another way to shoot >> yourself in the foot and introduce casual bugs. >> >> FWIW, my vote is to raise an error or return a nan, which will likely >> eventually raise an error. If I

Re: [Numpy-discussion] Behavior of nan{max, min} and nanarg{max, min} for all-nan slices.

2013-10-03 Thread Charles R Harris
> Please, no. It's another thing to remember and another way to shoot > yourself in the foot and introduce casual bugs. > > FWIW, my vote is to raise an error or return a nan, which will likely > eventually raise an error. If I have all nans, it's usually the case > that something's off, and I'd

Re: [Numpy-discussion] Behavior of nan{max, min} and nanarg{max, min} for all-nan slices.

2013-10-03 Thread Skipper Seabold
On Thu, Oct 3, 2013 at 9:10 AM, Benjamin Root wrote: > On Thu, Oct 3, 2013 at 6:06 AM, Daniele Nicolodi wrote: >> >> Hello, >> >> sorry, I don't know where exactly jump in in the thread, it is getting >> quite long and articulated... >> >> On 02/10/2013 21:19, Charles R Harris wrote: >> > The mai

Re: [Numpy-discussion] Behavior of nan{max, min} and nanarg{max, min} for all-nan slices.

2013-10-03 Thread Benjamin Root
On Thu, Oct 3, 2013 at 6:06 AM, Daniele Nicolodi wrote: > Hello, > > sorry, I don't know where exactly jump in in the thread, it is getting > quite long and articulated... > > On 02/10/2013 21:19, Charles R Harris wrote: > > The main problem I had was deciding what arg{max, min} should return as

Re: [Numpy-discussion] Behavior of nan{max, min} and nanarg{max, min} for all-nan slices.

2013-10-03 Thread Daniele Nicolodi
On 03/10/2013 13:56, Charles R Harris wrote: > On Thu, Oct 3, 2013 at 4:06 AM, Daniele Nicolodi > wrote: > > Hello, > > sorry, I don't know where exactly jump in in the thread, it is getting > quite long and articulated... > > On 02/10/2013 21:19, Char

Re: [Numpy-discussion] Behavior of nan{max, min} and nanarg{max, min} for all-nan slices.

2013-10-03 Thread Charles R Harris
On Thu, Oct 3, 2013 at 4:06 AM, Daniele Nicolodi wrote: > Hello, > > sorry, I don't know where exactly jump in in the thread, it is getting > quite long and articulated... > > On 02/10/2013 21:19, Charles R Harris wrote: > > The main problem I had was deciding what arg{max, min} should return as

Re: [Numpy-discussion] Behavior of nan{max, min} and nanarg{max, min} for all-nan slices.

2013-10-03 Thread Daniele Nicolodi
Hello, sorry, I don't know where exactly jump in in the thread, it is getting quite long and articulated... On 02/10/2013 21:19, Charles R Harris wrote: > The main problem I had was deciding what arg{max, min} should return as > the return value is an integer. I like your suggestion of returning