Ejemplo n.º 1
0
def test___eq___notEqual(filter, coeffs, state):
    actual = fo.Filter(coefficients=2 * coeffs, state=state)
    assert not filter == actual
    actual = fo.Filter(coefficients=coeffs, state=2 * state)
    assert not filter == actual
    actual = filter.copy()
    actual.comment = f'{actual.comment} A completely different thing'
    assert not filter == actual
Ejemplo n.º 2
0
def test_filter_comment():
    filt = fo.Filter(coefficients=None, state=None, comment='Bla')
    assert filt.comment == 'Bla'
    filt.comment = 'Blub'
    assert filt.comment == 'Blub'
    filt.comment = 500
    assert filt.comment == '500'
Ejemplo n.º 3
0
def filter(coeffs, state):
    """ Filter object.
    """
    return fo.Filter(coefficients=coeffs, state=state)
Ejemplo n.º 4
0
def test_filter_init_empty_coefficients():
    filt = fo.Filter(coefficients=None, state=None, sampling_rate=None)
    assert filt._coefficients is None
    assert filt._state is None
    assert filt.comment is None
Ejemplo n.º 5
0
def test_filter_init_with_state():
    coeff = np.array([[[1, 0, 0], [1, 0, 0]]])
    state = np.array([[[1, 0]]])
    filt = fo.Filter(coefficients=coeff, state=state)
    npt.assert_array_equal(filt._coefficients, coeff)
    npt.assert_array_equal(filt._state, state)
Ejemplo n.º 6
0
def test_filter_init_empty_state():
    coeff = np.array([[[1, 0, 0], [1, 0, 0]]])
    filt = fo.Filter(coefficients=coeff, state=None)
    npt.assert_array_equal(filt._coefficients, coeff)
    assert filt._state is None
Ejemplo n.º 7
0
def test_filter_init():
    coeff = np.array([[[1, 0, 0], [1, 0, 0]]])
    filt = fo.Filter(coefficients=coeff, sampling_rate=None)
    npt.assert_array_equal(filt._coefficients, coeff)
Ejemplo n.º 8
0
def test_filter_init_empty_coefficients_with_state():
    with pytest.raises(ValueError):
        fo.Filter(coefficients=None, state=[1, 0], sampling_rate=None)