nengolib.synapses.DiscreteDelay

nengolib.synapses.DiscreteDelay(steps)[source]

A discrete (pure) time-delay: z**-steps.

Also equivalent to (~z)**steps or 1/z**steps.

Parameters:

steps : integer

Number of time-steps to delay the input signal.

Returns:

LinearSystem

Digital filter implementing the pure delay exactly.

See also

z, PadeDelay()

Notes

A single step of the delay will be removed if using the filt method. This is done for subtle reasons of consistency with Nengo. The correct delay will appear when passed to nengo.Connection.

Examples

Simulate a Nengo network using a discrete delay of half a second for a synapse:

>>> from nengolib.synapses import DiscreteDelay
>>> import nengo
>>> with nengo.Network() as model:
>>>     stim = nengo.Node(output=lambda t: np.sin(2*np.pi*t))
>>>     p_stim = nengo.Probe(stim)
>>>     p_delay = nengo.Probe(stim, synapse=DiscreteDelay(500))
>>> with nengo.Simulator(model) as sim:
>>>     sim.run(1.)
>>> import matplotlib.pyplot as plt
>>> plt.plot(sim.trange(), sim.data[p_stim], label="Stimulus")
>>> plt.plot(sim.trange(), sim.data[p_delay], label="Delayed")
>>> plt.xlabel("Time (s)")
>>> plt.legend()
>>> plt.show()

(Source code)

_images/nengolib-synapses-DiscreteDelay-1.png