Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #99852

Re: 4D arrays

From Manolo Martínez <manolo@austrohungaro.com>
Newsgroups comp.lang.python
Subject Re: 4D arrays
Date 2015-12-02 10:17 +0100
Message-ID <mailman.105.1449048026.14615.python-list@python.org> (permalink)
References <08275b89237d46ae87ff574db3748dc2@cptec.inpe.br> <n3kmeu$pi3$1@ger.gmane.org>

Show all headers | View raw


On 12/01/15 at 06:47pm, Peter Otten wrote:
> Extract 2D arrays:
> 
> >>> a[:,2,3]
> array([[ 55,  56,  57,  58,  59],
>        [115, 116, 117, 118, 119]])
> >>> a[1,:,2]
> array([[ 70,  71,  72,  73,  74],
>        [ 90,  91,  92,  93,  94],
>        [110, 111, 112, 113, 114]])

The first one is equivalent to a[:, 2, 3, :], which is perhaps clearer
in this context: you are singling out row 2 in axis 1, and row 3 in axis
2, and taking everything from axes 0 and 3.

Mutatis mutandis with the second example and a[1, :, 2, :], which is
different from a[1, :, :, 2], etc.

Manolo

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: 4D arrays Manolo Martínez <manolo@austrohungaro.com> - 2015-12-02 10:17 +0100

csiph-web