I have a numpy array being generated from a function as follows
circles = [[ 56, 152, 26],
[288, 300, 25],
[288, 362, 25],
[288, 238, 24],
[318, 298, 45],
[220, 366, 29]]
I want to check if all the values in the first element of each subarray are consistent (mathematically close, not differing by a large amount i.e. > 5) and remove the subarrays that don't conform to this condition.
So in this case, i want to remove any subarray that is greater than 288 + 5 or less than 288 - 5. Any thoughts?
[[288, 300, 25], [288, 362, 25], [288, 238, 24]]