[Numpy-discussion] How to get the shape of an array slice without doing it
Fri Jan 29 11:10:42 CST 2010
On Fri, Jan 29, 2010 at 11:49 AM, David Huard <firstname.lastname@example.org> wrote:
> 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
> 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
> 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.
trying out some things, just because it's a puzzling question
>>> indi= (slice(2,5), np.arange(2), np.arange(3)[:,None])
I don't know if this is ok for all possible cases, (and there are some
confusing things with reordering axis, when slices and fancy indexing
> NumPy-Discussion mailing list
More information about the NumPy-Discussion