Is there a built-in function numpyto check from which index a signal (array) does not leave a certain range of errors?
When working with digital filters, I need to determine the impulse response length to use in scipy.signal.filtfilt. Quite easy with FIR filters, but seemingly impossible with Infinite Impulse Response (IIR) filters.
However, it will calculate the point from which the impulse response does not leave a certain range of errors:

I am currently using a quick and dirty workaround, manually checking the inverse array for the first value outside the error range:
def ringing_time(sig, th):
return len(sig) - np.argmax(np.abs(sig[::-1]) > th)
Is there any quick built-in approach numpyfor this?
source
share