Note

This documentation is for a development version. Click here for the latest stable release (v0.5.0).

Neuron types

These neuron types can be used in any place that Nengo neuron types can be used.

class nengo_extras.neurons.SoftLIFRate(sigma=1.0, **lif_args)[source]

LIF neuron with smoothing around the firing threshold.

This is a rate version of the LIF neuron whose tuning curve has a continuous first derivative, due to the smoothing around the firing threshold. It can be used as a substitute for LIF neurons in deep networks during training, and then replaced with LIF neurons when running the network [1].

Parameters
sigmafloat

Amount of smoothing around the firing threshold. Larger values mean more smoothing.

amplitudefloat

Scaling factor on the output. If 1 (default), output rates correspond to LIF neuron model rates.

tau_rcfloat

Membrane RC time constant, in seconds. Affects how quickly the membrane voltage decays to zero in the absence of input (larger = slower decay).

tau_reffloat

Absolute refractory period, in seconds. This is how long the membrane voltage is held at zero after a spike.

References

1

E. Hunsberger & C. Eliasmith (2015). Spiking Deep Networks with LIF Neurons. arXiv Preprint, 1510. https://export.arxiv.org/abs/1510.08829

rates(x, gain, bias)[source]

Always use LIFRate to determine rates.

step_math(dt, J, output)[source]

Compute rates in Hz for input current (incl. bias)

class nengo_extras.neurons.FastLIF(tau_rc=0.02, tau_ref=0.002, min_voltage=0, amplitude=1, initial_state=None)[source]

Faster version of the leaky integrate-and-fire (LIF) neuron model.

This neuron model is faster than LIF but does not produce the ideal firing rate for larger dt due to linearization of the tuning curves.

class nengo_extras.neurons.NumbaLIF(*args, **kwargs)[source]

Numba-compiled version of the LIF model.

Parameters
tau_rcfloat

Membrane RC time constant, in seconds. Affects how quickly the membrane voltage decays to zero in the absence of input (larger = slower decay).

tau_reffloat

Absolute refractory period, in seconds. This is how long the membrane voltage is held at zero after a spike.

min_voltagefloat

Minimum value for the membrane voltage. If -np.inf, the voltage is never clipped.

amplitudefloat

Scaling factor on the neuron output. Corresponds to the relative amplitude of the output spikes of the neuron.

Utilities

nengo_extras.neurons.spikes2events(t, spikes)[source]

Return an event-based representation of spikes (i.e. spike times)

nengo_extras.neurons.rates_isi(t, spikes, midpoint=False, interp='zero')[source]

Estimate firing rates from spikes using ISIs.

Parameters
t(M,) array_like

The times at which raw spike data (spikes) is defined.

spikes(M, N) array_like

The raw spike data from N neurons.

midpointbool, optional

If true, place interpolation points at midpoints of ISIs. Otherwise, the points are placed at the beginning of ISIs.

interpstring, optional

Interpolation type, passed to scipy.interpolate.interp1d as the kind parameter.

Returns
rates(M, N) array_like

The estimated neuron firing rates.

nengo_extras.neurons.rates_kernel(t, spikes, kind='gauss', tau=0.04)[source]

Estimate firing rates from spikes using a kernel.

Parameters
t(M,) array_like

The times at which raw spike data (spikes) is defined.

spikes(M, N) array_like

The raw spike data from N neurons.

kindstr {‘expon’, ‘gauss’, ‘expogauss’, ‘alpha’}, optional

The type of kernel to use. ‘expon’ is an exponential kernel, ‘gauss’ is a Gaussian (normal) kernel, ‘expogauss’ is an exponential followed by a Gaussian, and ‘alpha’ is an alpha function kernel.

taufloat

The time constant for the kernel. The optimal value will depend on the firing rate of the neurons, with a longer tau preferred for lower firing rates. The default value of 0.04 works well across a wide range of firing rates.