Пример #1
0
def test_estimate_ringing():
    """Test our ringing estimation function."""
    # Actual values might differ based on system, so let's be approximate
    for kind in ('ba', 'sos'):
        for thresh, lims in ((0.1, (30, 60)),  # 47
                             (0.01, (300, 600)),  # 475
                             (0.001, (3000, 6000)),  # 4758
                             (0.0001, (30000, 60000))):  # 37993
            n_ring = estimate_ringing_samples(butter(3, thresh, output=kind))
            assert lims[0] <= n_ring <= lims[1], (
                '%s %s: %s <= %s <= %s'
                % (kind, thresh, lims[0], n_ring, lims[1]))
    with pytest.warns(RuntimeWarning, match='properly estimate'):
        assert estimate_ringing_samples(butter(4, 0.00001)) == 100000
Пример #2
0
def test_estimate_ringing():
    """Test our ringing estimation function."""
    # Actual values might differ based on system, so let's be approximate
    for kind in ('ba', 'sos'):
        for thresh, lims in ((0.1, (30, 60)),  # 47
                             (0.01, (300, 600)),  # 475
                             (0.001, (3000, 6000)),  # 4758
                             (0.0001, (30000, 60000))):  # 37993
            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, 0.00001)), 100000)
    assert_true(any('properly estimate' in str(ww.message) for ww in w))