Re: [Numpy-discussion] slicing an n-dimensional array

2014-12-03 Thread Jaime Fernández del Río
On Wed, Dec 3, 2014 at 4:02 PM, Stefan van der Walt wrote: > Hi Catherine > > On 2014-12-04 01:12:30, Moroney, Catherine M (398E) < > catherine.m.moro...@jpl.nasa.gov> wrote: > > I have an array "A" of shape (NX, NY, NZ), and then I have a second > array "B" of shape (NX, NY) > > that ranges from

Re: [Numpy-discussion] slicing an n-dimensional array

2014-12-03 Thread Benjamin Root
Posting in the correct thread now... A slightly different way to look at it (I don't think it is exactly the same problem, but the description reminded me of it): http://mail.scipy.org/pipermail/numpy-discussion/2013-April/066269.html (and I think there are some things that can be done to make tha

Re: [Numpy-discussion] taking a 2D uneven surface slice

2014-12-03 Thread Benjamin Root
I am sorry, I meant to post this in a different thread... On Wed, Dec 3, 2014 at 8:32 PM, Benjamin Root wrote: > A slightly different way to look at it (I don't think it is exactly the > same problem, but the description reminded me of it): > > http://mail.scipy.org/pipermail/numpy-discussion/20

Re: [Numpy-discussion] taking a 2D uneven surface slice

2014-12-03 Thread Benjamin Root
A slightly different way to look at it (I don't think it is exactly the same problem, but the description reminded me of it): http://mail.scipy.org/pipermail/numpy-discussion/2013-April/066269.html (and I think there are some things that can be done to make that faster, but I don't recall it righ

Re: [Numpy-discussion] Uint64 casting bug for MSVC builds

2014-12-03 Thread Christoph Gohlke
On 12/3/2014 8:44 AM, Matthew Brett wrote: > Hi, > > I just noticed this using Christophe Gohlke's MKL builds of numpy: > import numpy as np val = 2**63 + 2**62 np.float64(val) > 1.3835058055282164e+19 np.float64(val).astype(np.uint64) > 9223372036854775808 > > In general it see

Re: [Numpy-discussion] slicing an n-dimensional array

2014-12-03 Thread Stefan van der Walt
Hi Catherine On 2014-12-04 01:12:30, Moroney, Catherine M (398E) wrote: > I have an array "A" of shape (NX, NY, NZ), and then I have a second array "B" > of shape (NX, NY) > that ranges from 0 to NZ in value. > > I want to create a third array "C" of shape (NX, NY) that holds the > "B"-th slice

[Numpy-discussion] slicing an n-dimensional array

2014-12-03 Thread Moroney, Catherine M (398E)
Hello, I'm sure there's a simple solution, but I'm not seeing it so any hints would be greatly appreciated. I have an array "A" of shape (NX, NY, NZ), and then I have a second array "B" of shape (NX, NY) that ranges from 0 to NZ in value. I want to create a third array "C" of shape (NX, NY) tha

Re: [Numpy-discussion] Uint64 casting bug for MSVC builds

2014-12-03 Thread Jaime Fernández del Río
On Wed, Dec 3, 2014 at 8:44 AM, Matthew Brett wrote: > Hi, > > I just noticed this using Christophe Gohlke's MKL builds of numpy: > > >>> import numpy as np > >>> val = 2**63 + 2**62 > >>> np.float64(val) > 1.3835058055282164e+19 > >>> np.float64(val).astype(np.uint64) > 9223372036854775808 > I

[Numpy-discussion] Uint64 casting bug for MSVC builds

2014-12-03 Thread Matthew Brett
Hi, I just noticed this using Christophe Gohlke's MKL builds of numpy: >>> import numpy as np >>> val = 2**63 + 2**62 >>> np.float64(val) 1.3835058055282164e+19 >>> np.float64(val).astype(np.uint64) 9223372036854775808 In general it seems that floats get clipped at 2**63 when casting to uint64.

Re: [Numpy-discussion] creation of ndarray with dtype=np.object : bug?

2014-12-03 Thread Emanuele Olivetti
On 12/03/2014 12:17 PM, Jaime Fernández del Río wrote: > > > The safe way to create 1D object arrays from a list is by preallocating them, > something like this: > > >>> a = [np.random.rand(2, 3), np.random.rand(2, 3)] > >>> b = np.empty(len(a), dtype=object) > >>> b[:] = a > >>> b > array([ array

Re: [Numpy-discussion] creation of ndarray with dtype=np.object : bug?

2014-12-03 Thread Jaime Fernández del Río
On Wed, Dec 3, 2014 at 2:21 AM, Emanuele Olivetti wrote: > On 12/03/2014 04:32 AM, Ryan Nelson wrote: > > Emanuele, > > > > This doesn't address your question directly. However, I wonder if you > > could approach this problem from a different way to get what you want. > > > > First of all, create

Re: [Numpy-discussion] creation of ndarray with dtype=np.object : bug?

2014-12-03 Thread Emanuele Olivetti
On 12/03/2014 04:32 AM, Ryan Nelson wrote: > Emanuele, > > This doesn't address your question directly. However, I wonder if you > could approach this problem from a different way to get what you want. > > First of all, create a "index" array and then just vstack all of your > arrays at once. > >