def _check_coefficients(system):
 if isinstance(system, tuple):
  from scipy.signal import tf2zpk
  (z, p, k) = tf2zpk(*system)
 else:
  from scipy.signal import sos2zpk
  (z, p, k) = sos2zpk(system)
 if np.any((np.abs(p) > 1.0)):
  raise RuntimeError('Filter poles outside unit circle, filter will be unstable. Consider using different filter coefficients.')

def _check_coefficients ( system ) : if isinstance ( system , tuple ) : from scipy . signal import tf2zpk ( z , p , k ) = tf2zpk ( * system ) else : from scipy . signal import sos2zpk ( z , p , k ) = sos2zpk ( system ) if np . any ( ( np . abs ( p ) > 1.0 ) ) : raise RuntimeError ( 'Filter poles outside unit circle, filter will be unstable. Consider using different filter coefficients.' )
check for filter stability .