@requires_version('scipy', '0.16')
def test_estimate_ringing():
 for kind in ('ba', 'sos'):
  for (thresh, lims) in ((0.1, (30, 60)), (0.01, (300, 600)), (0.001, (3000, 6000)), (0.0001, (30000, 60000))):
   n_ring = estimate_ringing_samples(butter(3, thresh, output=kind))
   assert_true((lims[0] <= n_ring <= lims[1]), msg=('%s %s: %s <= %s <= %s' % (kind, thresh, lims[0], n_ring, lims[1])))
 with warnings.catch_warnings(record=True) as w:
  assert_equal(estimate_ringing_samples(butter(4, 1e-05)), 100000)
 assert_true(any((('properly estimate' in str(ww.message)) for ww in w)))

@ requires_version ( 'scipy' , '0.16' ) def test_estimate_ringing ( ) : for kind in ( 'ba' , 'sos' ) : for ( thresh , lims ) in ( ( 0.1 , ( 30 , 60 ) ) , ( 0.01 , ( 300 , 600 ) ) , ( 0.001 , ( 3000 , 6000 ) ) , ( 0.0001 , ( 30000 , 60000 ) ) ) : n_ring = estimate_ringing_samples ( butter ( 3 , thresh , output = kind ) ) assert_true ( ( lims [ 0 ] <= n_ring <= lims [ 1 ] ) , msg = ( '%s %s: %s <= %s <= %s' % ( kind , thresh , lims [ 0 ] , n_ring , lims [ 1 ] ) ) ) with warnings . catch_warnings ( record = True ) as w : assert_equal ( estimate_ringing_samples ( butter ( 4 , 1e-05 ) ) , 100000 ) assert_true ( any ( ( ( 'properly estimate' in str ( ww . message ) ) for ww in w ) ) )
test our ringing estimation function .