Removing duplicates (within a given tolerance) from a Numpy array of vectors

Posted by Brendan on Stack Overflow See other posts from Stack Overflow or by Brendan
Published on 2010-03-12T15:51:09Z Indexed on 2010/03/13 15:15 UTC
Read the original article Hit count: 200

Filed under:
|
|

I have an Nx5 array containing N vectors of form 'id', 'x', 'y', 'z' and 'energy'. I need to remove duplicate points (i.e. where x, y, z all match) within a tolerance of say 0.1. Ideally I could create a function where I pass in the array, columns that need to match and a tolerance on the match.

Following this thread on Scipy-user, I can remove duplicates based on a full array using record arrays, but I need to just match part of an array. Moreover this will not match within a certain tolerance.

I could laboriously iterate through with a for loop in Python but is there a better Numponic way?

© Stack Overflow or respective owner

Related posts about numpy

Related posts about python