Re: [Numpy-discussion] How to get the shape of an array slice without doing it

2010-01-29 Thread josef . pktd
On Fri, Jan 29, 2010 at 2:58 PM, David Huard wrote: > For the record, here is what I came up with. > > import numpy as np > > def expand_ellipsis(index, ndim): >    """Replace the ellipsis, real or implied, of an index expression by slices. > >    Parameters >    -- >    index : tuple >  

Re: [Numpy-discussion] How to get the shape of an array slice without doing it

2010-01-29 Thread josef . pktd
On Fri, Jan 29, 2010 at 2:58 PM, David Huard wrote: > For the record, here is what I came up with. > > import numpy as np > > def expand_ellipsis(index, ndim): >    """Replace the ellipsis, real or implied, of an index expression by slices. > >    Parameters >    -- >    index : tuple >  

Re: [Numpy-discussion] How to get the shape of an array slice without doing it

2010-01-29 Thread David Huard
For the record, here is what I came up with. import numpy as np def expand_ellipsis(index, ndim): """Replace the ellipsis, real or implied, of an index expression by slices. Parameters -- index : tuple Indexing expression. ndim : int Number of dimensions o

Re: [Numpy-discussion] How to get the shape of an array slice without doing it

2010-01-29 Thread josef . pktd
On Fri, Jan 29, 2010 at 1:03 PM, Keith Goodman wrote: > On Fri, Jan 29, 2010 at 9:53 AM,   wrote: >> I forgot about ellipsis, since I never use them, >> replace ellipsis by [slice(None)]*ndim or something like this >> >> I don't know how to access an ellipsis directly, is it even possible >> to co

Re: [Numpy-discussion] How to get the shape of an array slice without doing it

2010-01-29 Thread josef . pktd
On Fri, Jan 29, 2010 at 12:32 PM, David Huard wrote: > On Fri, Jan 29, 2010 at 12:10 PM,   wrote: >> On Fri, Jan 29, 2010 at 11:49 AM, David Huard wrote: >>> Hi, >>> >>> I have a 4D "array" with a given shape, but the array is never >>> actually created since it is large and distributed over mult

Re: [Numpy-discussion] How to get the shape of an array slice without doing it

2010-01-29 Thread Keith Goodman
On Fri, Jan 29, 2010 at 9:53 AM, wrote: > I forgot about ellipsis, since I never use them, > replace ellipsis by [slice(None)]*ndim or something like this > > I don't know how to access an ellipsis directly, is it even possible > to construct an index list that contains an ellipsis? > There is an

Re: [Numpy-discussion] How to get the shape of an array slice without doing it

2010-01-29 Thread josef . pktd
On Fri, Jan 29, 2010 at 12:48 PM, wrote: > On Fri, Jan 29, 2010 at 12:32 PM, David Huard wrote: >> On Fri, Jan 29, 2010 at 12:10 PM,   wrote: >>> On Fri, Jan 29, 2010 at 11:49 AM, David Huard wrote: Hi, I have a 4D "array" with a given shape, but the array is never actually

Re: [Numpy-discussion] How to get the shape of an array slice without doing it

2010-01-29 Thread josef . pktd
On Fri, Jan 29, 2010 at 12:32 PM, David Huard wrote: > On Fri, Jan 29, 2010 at 12:10 PM,   wrote: >> On Fri, Jan 29, 2010 at 11:49 AM, David Huard wrote: >>> Hi, >>> >>> I have a 4D "array" with a given shape, but the array is never >>> actually created since it is large and distributed over mult

Re: [Numpy-discussion] How to get the shape of an array slice without doing it

2010-01-29 Thread David Huard
On Fri, Jan 29, 2010 at 12:10 PM, wrote: > On Fri, Jan 29, 2010 at 11:49 AM, David Huard wrote: >> Hi, >> >> I have a 4D "array" with a given shape, but the array is never >> actually created since it is large and distributed over multiple >> binary files. Typical usage would be to take slices a

Re: [Numpy-discussion] How to get the shape of an array slice without doing it

2010-01-29 Thread josef . pktd
On Fri, Jan 29, 2010 at 11:49 AM, David Huard wrote: > Hi, > > I have a 4D "array" with a given shape, but the array is never > actually created since it is large and distributed over multiple > binary files. Typical usage would be to take slices across the 4D > array. > > I'd like to know what th

[Numpy-discussion] How to get the shape of an array slice without doing it

2010-01-29 Thread David Huard
Hi, I have a 4D "array" with a given shape, but the array is never actually created since it is large and distributed over multiple binary files. Typical usage would be to take slices across the 4D array. I'd like to know what the shape of the resulting array would be if I took a slice out of it.