find the change points except condition

68 Views Asked by At

I have an array

[
-670.0790336045966,
 -670.079352863881,
 -664.7769001654013,
 -662.655094599744,
 -662.6557553135007,
 -662.6551031804399,
 -667.966652577584,
 -670.0779722837389,
 -670.0789732042002]

.

I want to detect the changes but only 1 time per edge and remove noise as picture black circle are noises

I expect [1, 3, 5, 7]. But it showed [1, 2, 3, 5, 6, 7].

I tried:

Python

differences = np.abs(np.diff(array_L))

threshold = 1
distance = 1

change_points = np.where((differences > threshold) & (np.arange(len(array_L)-1) % distance == 0))[0] + 1
change_points1 = np.where((differences > threshold) & (np.arange(len(array_L)-1) % distance == 0))[0]
0

There are 0 best solutions below