Пример #1
0
def test_filtfilt(plt, rng, allclose):
    dt = 1e-3
    tend = 3.0
    t = dt * np.arange(tend / dt)
    nt = len(t)
    synapse = Lowpass(0.03)

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

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

    assert allclose(x, y)
Пример #2
0
def plot_angles(x, label=None):
    filt = Lowpass(10, default_dt=n_per_batch)
    y = filt.filtfilt(x) if len(x) > 0 else []
    batch_inds = n_per_batch * np.arange(len(x))
    plt.plot(batch_inds, y, label=label)
Пример #3
0
def plot_batches(x, label=None, color=None):
    filt = Lowpass(10, default_dt=n_per_batch)
    y = filt.filtfilt(x) if len(x) > 0 else []
    batch_inds = n_per_batch * np.arange(len(x))
    plt.semilogy(batch_inds, y, label=label, color=color)