I have a measurement, where after about 50 points I start to look for the point where…
Jump to turn (7)
- 1I have a measurement, where after about 50 points I start to look for the point
- 2there could be some false positives at beginning of the measurement, can you mak
- 3this code shows zero-crossing point while still accelerating, please review and
- 4can you add a window, like if the deceleration exists for more than 10 samples,
- 5I get "None" all the time, even though I have negative trend at the end lasting
- 6I think that calculating derivates here could be the issua as "data" array is an
- 7I think it's better, but still we are missing the point, that deceleration is wh
- User
I have a measurement, where after about 50 points I start to look for the point where acceleration turns into deceleration. My code needs to be corrected, can you help me?
def seekZeroCrossing(data): # if the data array is empty or not a list, return None if (isinstance(data, list) == False and isinstance(data, np.ndarray) == False): return None
code# Initialize previous sign to 0 prev_sign = 0 position = None for i, element in enumerate(data): if isinstance(element, (int, float)): current_sign = 1 if element > 0 else -1 # Determine the sign of the current number if current_sign != prev_sign and prev_sign != 0: # Check for zero-crossing condition position = i break prev_sign = current_sign return position - Assistant