fixup Simu: add edge detection function

This commit is contained in:
Eric Teunis de Boone 2022-04-08 16:06:41 +02:00
parent c149389c84
commit 73b7fcb601

View file

@ -27,7 +27,7 @@ def detect_edges(threshold, data, rising=True, falling=False):
https://stackoverflow.com/a/50365462 https://stackoverflow.com/a/50365462
""" """
mask = np.full(len(data), False) mask = np.full(len(data)-1, False)
if rising: if rising:
mask |= (data[:-1] < threshold) & (data[1:] > threshold) mask |= (data[:-1] < threshold) & (data[1:] > threshold)