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


Groups > comp.lang.python > #100209

Re: 3D numpy array subset

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Oscar Benjamin <oscar.j.benjamin@gmail.com>
Newsgroups comp.lang.python
Subject Re: 3D numpy array subset
Date Wed, 9 Dec 2015 20:20:20 +0000
Lines 24
Message-ID <mailman.100.1449692427.12405.python-list@python.org> (permalink)
References <2e1a80e9-cd0a-46b5-a8c0-97f208f71f54@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de /5l/CWXijQNfwbge1AVD1w/Nbvs3g5ZfQeygh9CiFmfA==
Return-Path <oscar.j.benjamin@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.008
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'indices': 0.07; 'cc:addr :python-list': 0.09; '14:26,': 0.16; 'arrays.': 0.16; 'cc:name:python list': 0.16; 'datasets': 0.16; 'intersection': 0.16; 'numpy': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:array': 0.16; 'wrote:': 0.16; '&gt;': 0.18; 'email addr:gmail.com&gt;': 0.18; 'all,': 0.20; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'arrays': 0.22; 'file.': 0.22; 'dec': 0.23; 'elements': 0.23; 'header:In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; 'function': 0.28; 'finds': 0.29; 'subset': 0.29; 'array': 0.29; "i'm": 0.30; 'another': 0.32; 'common': 0.33; 'definition': 0.34; 'file': 0.34; 'received:google.com': 0.35; 'so,': 0.35; 'clear': 0.35; 'something': 0.35; 'but': 0.36; 'there': 0.36; 'url:org': 0.36; 'received:209.85': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'skip:& 10': 0.37; 'received:209': 0.38; 'mean': 0.38; 'sure': 0.39; 'does': 0.39; 'dear': 0.67; 'oscar': 0.84; 'url:scipy': 0.84; 'url:reference': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=vaF8uFZstQMF1SlseBReo4ZTCgy5GkW+/RN3cUH3JLc=; b=Q2GMCQFv9TtoRru0HRGgKbobnopNEI1XwBL4KdAbGzxuhQr5koq/rl/dZUyk0YchZA E09TDaFuEpf4W4vVMEtU6zNi9KaP75lVUz7WfC0T5yp4WdayAxMDg9g7qnFw+DI6aO1t UAksAM3b8IBivzChw+ThbB2E5Q05r4v7isxLFSyQ2tU5fjrj2/9HNgdG6h7UtOSaQroY D9dXDuuuMBetsaTraeCksolbh+6Z3hjs4xNuI5WEUBkM3LPpR/FqoXRWA3RQeMPi+iqO WVVQBjPR9xC6KeL5qzU1tqXMN65MmrfJgodcSby9vtBmstlIJBb5i+fZa5eHBhwc7em/ dp5w==
X-Received by 10.112.151.67 with SMTP id uo3mr2828481lbb.43.1449692420484; Wed, 09 Dec 2015 12:20:20 -0800 (PST)
In-Reply-To <2e1a80e9-cd0a-46b5-a8c0-97f208f71f54@googlegroups.com>
X-Content-Filtered-By Mailman/MimeDel 2.1.20+
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:100209

Show key headers only | View raw


On 9 Dec 2015 14:26, "Heli" <hemla21@gmail.com> wrote:
>
> Dear all,
>
> I am reading a dataset from a HDF5 file using h5py. my datasets are 3D.
>
> Then I will need to check if another 3d numpy array is a subset of this
3D array i am reading from the file.
>
> In general, is there any way to check if two 3d numpy arrays have
intersections and if so, get the indices of the intersection area.
>
> By intersection, I exactly mean the intersection definition used in set
theory.

Does this help:
http://docs.scipy.org/doc/numpy/reference/generated/numpy.intersect1d.html

I'm not sure how the 3d part is relevant but that function finds the common
elements of two arrays. Use .flat or something to make the 3d arrays be
treated as 1d. Otherwise it's not clear what you mean by intersection.

--
Oscar

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


Thread

3D numpy array subset Heli <hemla21@gmail.com> - 2015-12-09 06:23 -0800
  Re: 3D numpy array subset Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2015-12-09 20:20 +0000

csiph-web