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


Groups > comp.lang.python > #100198 > unrolled thread

3D numpy array subset

Started byHeli <hemla21@gmail.com>
First post2015-12-09 06:23 -0800
Last post2015-12-09 20:20 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  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

#100198 — 3D numpy array subset

FromHeli <hemla21@gmail.com>
Date2015-12-09 06:23 -0800
Subject3D numpy array subset
Message-ID<2e1a80e9-cd0a-46b5-a8c0-97f208f71f54@googlegroups.com>
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.


Thanks in Advance for your help, 

[toc] | [next] | [standalone]


#100209

FromOscar Benjamin <oscar.j.benjamin@gmail.com>
Date2015-12-09 20:20 +0000
Message-ID<mailman.100.1449692427.12405.python-list@python.org>
In reply to#100198
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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web