I want to compare elements of two numpy arrays and delete the elements of one of those arrays if the eucledean distance between the coordinates is smaller than 1 and the time is the same. data_CD4 and data_CD8 are the arrays. The elements of the arrays are lists with 3D Coordinates and the time as 4th element (numpy.array([[x,y,z,time],[x,y,z,time].....]). Co is the Cutoff, here 1.
for i in data_CD8:
for m in data_CD4:
if distance.euclidean(tuple(i[:3]),tuple(m[:3])) < co and i[3]==m[3] :
data_CD8=np.delete(data_CD8, i, 0)
Is there a faster approach to do that? The first array has 5000 elements, the second 2000, so it tooks too much time.