[SciPy-user] remove duplicate points...

Angus McMorland amcmorl@gmail....
Wed Apr 23 10:50:29 CDT 2008


On 23/04/2008, Stéfan van der Walt <stefan@sun.ac.za> wrote:
> 2008/4/23 Angus McMorland <amcmorl@gmail.com>:
>
> >  >  I have array of 3D points:
>  >  >
>  >  >  [x0, y0, z0, v0]
>  >  >  [x1, y1, z1, v1]
>  >  >  ...
>  >  >  [xn, yn, zn, vn]
>  >
>  >  >  This array have duplicate elements (points), by construction.
>  >  >
>  >  >  How could I remove these duplicate elements ?
>  >
>  >  I had to do this prior to Delaunay triangulation at one point, and
>  >  wrote a quick routine to remove the duplicates, which works on the
>  >  assumption that unique pts will have a unique product (x * y * z).
>
> That doesn't sound like a valid assumption?

At least in my scenario, where points exist in a large floating point
space, the probability of two unique points having the same product
is, I think, very small. It doesn't seem to have arisen in any of my
testing, but I'd be interested to hear if I've made an error of
judgement here.

As a quick test:

sz = 1e7
sz - np.unique(np.random.normal(size=(sz,3)).prod(axis=1)).size

returns 0 - i.e. no common products unless the points are deliberately
made the same. Am I mis-thinking this?

Thanks,

Angus.
-- 
AJC McMorland, PhD candidate
Physiology, University of Auckland

(Nearly) post-doctoral research fellow
Neurobiology, University of Pittsburgh


More information about the SciPy-user mailing list