I would like to "concatenate" results of detections of positions of specific values in my array "Coord3".
I have a double criteria on my array for 2 specific dimension of it. I get some redondant positions and i would like to gather it in order to apply a mask of this values.
As example with a moderate array :
import numpy as np
Coord3 = np.array([[[[ 0., 0.],
[ 0., 1.],
[ 0., 2.]],
[[ 1., 0.],
[ 1., 1.],
[ 1., 2.]],
[[ 2., 0.],
[ 2., 1.],
[ 2., 2.]]],
[[[ 1., 0.],
[ 1., 1.],
[ 1., 2.]],
[[ 2., 0.],
[ 2., 1.],
[ 2., 2.]],
[[ 4., 0.],
[ 3., 1.],
[ 4., 2.]]],
[[[ 2., 0.],
[ 2., 1.],
[ 2., 2.]],
[[ 3., 0.],
[ 3., 1.],
[ 3., 2.]],
[[ 4., 0.],
[ 4., 1.],
[ 4., 4.]]]])
#I apply my double criteria in 2 shapes of my array Coord3
plaY=[]
for i in range(Coord3.shape[0]):
holding_list = zip(*np.where(Coord3[i,:,:,0] > 3))
plaY.append(holding_list)
plaY_array = np.asarray(plaY)
#plaY_array
#Out[1088]: array([[], [(2, 0), (2, 2)], [(2, 0), (2, 1), (2, 2)]], dtype=object)
plaX=[]
for i in range(Coord3.shape[0]):
holding_list = zip(*np.where(Coord3[i,:,:,1] > 2))
plaX.append(holding_list)
plaX_array = np.asarray(plaX)
#plaX_array
#Out[1097]: array([[], [], [(2, 2)]], dtype=object)
So (2,0) and (2,2) are redondant and i would like to supress it and to gather all in an unique array... as :
np.array([[2, 0], [2, 2],....])
--- EDIT LATER ------------------------------------------
I could concatenate for each specific time
plaY_array = plaY_array[:,np.newaxis]
plaX_array = plaX_array[:,np.newaxis]
test = plaX_array + plaY_array
#I get that :
#test
#array([[[[]]],
#[[[(2, 0), (2, 2)]]],
#[[[(2, 0), (2, 1), (2, 2), (2, 2)]]]], dtype=object)
So now i have to suppress just the (2,2) redondant in the "third slice", it could be interesting to know the coordinates for each specific time (so i let the (2,2) in "2nd slice"