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

David Huard david.huard at gmail.com
Fri Jan 29 11:49:20 EST 2010


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.
That is, let's say my 4D array is A, I'd like to know

A[ndindex].shape

without actually creating A.

ndindex should support all numpy constructions (integer, boolean,
array, slice, ...). I am guessing something already exists to do this,
but I just can't put my finger on it.

Thanks.

David



More information about the NumPy-Discussion mailing list