[SciPy-user] remove duplicate points...
Wed Apr 23 10:50:29 CDT 2008
On 23/04/2008, Stéfan van der Walt <firstname.lastname@example.org> wrote:
> 2008/4/23 Angus McMorland <email@example.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
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?
AJC McMorland, PhD candidate
Physiology, University of Auckland
(Nearly) post-doctoral research fellow
Neurobiology, University of Pittsburgh
More information about the SciPy-user