def test_signal():
    length = 120
    x = np.sign(RandomState(0).normal(size=length))
    x[-20:] = 0  # make sure the signal has bounded support
    den = np.array([1, -0.6, 0.1])
    num = np.array([0.5])
    y = utils.lfilter(x=x, b=num, a=den)

    lookahead = 2
    h = equalizer.train(
        signal=y, expected=x, order=len(den), lookahead=lookahead)
    assert 1e-12 < dsp.norm(h[:lookahead])

    h = h[lookahead:]
    assert_approx(h, den / num)

    x_ = utils.lfilter(x=y, b=h, a=[1])
    assert_approx(x_, x)
dataset/ETHPy150Open romanz/amodem/amodem/tests/test_equalizer.py/test_signal/swapped operands of `<`