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


Groups > comp.lang.python > #99852

Re: 4D arrays

Path csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From Manolo Martínez <manolo@austrohungaro.com>
Newsgroups comp.lang.python
Subject Re: 4D arrays
Date Wed, 2 Dec 2015 10:17:17 +0100
Lines 19
Message-ID <mailman.105.1449048026.14615.python-list@python.org> (permalink)
References <08275b89237d46ae87ff574db3748dc2@cptec.inpe.br> <n3kmeu$pi3$1@ger.gmane.org>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Trace news.uni-berlin.de i9pilpjyAJOAFZMYcVeS2gxrsYf9TCPHOCyHR4hfTyaQ==
Return-Path <manolo@austrohungaro.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.093
X-Spam-Evidence '*H*': 0.83; '*S*': 0.02; '2],': 0.16; '55,': 0.16; '57,': 0.16; '58,': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'row': 0.16; 'wrote:': 0.16; '>>>': 0.20; 'second': 0.24; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'example': 0.26; 'equivalent': 0.27; 'extract': 0.33; 'to:addr :python-list': 0.36; 'subject:: ': 0.37; 'charset:us-ascii': 0.37; 'to:addr:python.org': 0.40; 'different': 0.63; '71,': 0.84; '92,': 0.84; 'clearer': 0.84; 'otten': 0.84; 'received:82.223': 0.84
Content-Disposition inline
In-Reply-To <n3kmeu$pi3$1@ger.gmane.org>
User-Agent Mutt/1.5.24 (2015-08-30)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:99852

Show key headers only | 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