How to quickly measure the rise time of a signal represented inside a numpy array

  Kiến thức lập trình

I have a numpy array called voltage which is supposed to go from 0 to 1, in 1ps time steps. Thing is some times it may not go from 0 to 1, it might rise from zero and come back to 1.
I want to measure the rise time, time taken to go from 0 to 0.9, if the voltage is coming back to 0 or close to zero, lets say below 0.5, I want to mark it as a failure by marking rise time as -1.

I can do this by looking at the whole array elements 1 by 1, I want to know if there is a faster way to do this, as I need to do this fro several thousand arrays.