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


Groups > comp.lang.python > #100209

Re: 3D numpy array subset

From Oscar Benjamin <oscar.j.benjamin@gmail.com>
Newsgroups comp.lang.python
Subject Re: 3D numpy array subset
Date 2015-12-09 20:20 +0000
Message-ID <mailman.100.1449692427.12405.python-list@python.org> (permalink)
References <2e1a80e9-cd0a-46b5-a8c0-97f208f71f54@googlegroups.com>

Show all headers | 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