Exemplo n.º 1
0
def test_filtfilt(plt, rng):
    dt = 1e-3
    tend = 3.
    t = dt * np.arange(tend / dt)
    nt = len(t)

    tau = 0.03

    u = rng.normal(size=nt)
    x = filt(u, tau, dt=dt)
    x = filt(x[::-1], tau, x0=x[-1], dt=dt)[::-1]
    y = filtfilt(u, tau, dt=dt)

    plt.plot(t, x)
    plt.plot(t, y, '--')

    assert np.allclose(x, y)
Exemplo n.º 2
0
def test_filtfilt(plt, rng):
    dt = 1e-3
    tend = 3.
    t = dt * np.arange(tend / dt)
    nt = len(t)

    tau = 0.03

    u = rng.normal(size=nt)
    x = filt(u, tau, dt=dt)
    x = filt(x[::-1], tau, x0=x[-1], dt=dt)[::-1]
    y = filtfilt(u, tau, dt=dt)

    plt.plot(t, x)
    plt.plot(t, y, '--')

    assert np.allclose(x, y)