# 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 [R1313].

Parameters: sigma : float Amount of smoothing around the firing threshold. Larger values mean more smoothing. amplitude : float Scaling factor on the output. If 1 (default), output rates correspond to LIF neuron model rates. tau_rc : float Membrane RC time constant, in seconds. Affects how quickly the membrane voltage decays to zero in the absence of input (larger = slower decay). tau_ref : float Absolute refractory period, in seconds. This is how long the membrane voltage is held at zero after a spike.

References

 [R1313] (1, 2) E. Hunsberger & C. Eliasmith (2015). Spiking Deep Networks with LIF Neurons. arXiv Preprint, 1510. https://arxiv.org/abs/1510.08829
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)[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.

## 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. midpoint : bool, optional If true, place interpolation points at midpoints of ISIs. Otherwise, the points are placed at the beginning of ISIs. interp : string, optional Interpolation type, passed to scipy.interpolate.interp1d as the kind parameter. 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. kind : str {‘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. tau : float 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.