correlation_detector – Device for evaluating cross correlation between two spike sources

Description

The correlation_detector is a device that receives spikes from two pools of spike inputs and calculates the count_histogram of inter-spike intervals (raw cross correlation) binned to bins of duration \(\delta_\tau\). The corresponding parameter delta_tau defaults to 5 times the simulation resolution.

The result can be obtained from the node’s status dictionary under the key count_histogram.

In parallel it records a weighted histogram, where the connection weights are used to weight every count. In order to minimize numerical errors, the Kahan summation algorithm is used when calculating the weighted histogram. Both histogram and count_histogram are arrays of \(2\cdot\tau_{max}/\delta_{\tau}+1\) values, indexed by the bin number \(n\), and are filled in the following way:

Let \(t_{1,i}\) be the spike times of source 1 and \(t_{2,j}\) the spike times of source 2. histogram[n] then contains the sum of the weight products \(w_{1,i}\cdot w_{2,j}\), and count_histogram[n] contains 1 summed over all event pairs whose time difference \(t_{2,j}-t_{1,i}\) falls in the half-open interval

\[\left[ n\cdot\delta_\tau - \tau_{max} - \delta_\tau/2,\; n\cdot\delta_\tau - \tau_{max} + \delta_\tau/2 \right)\]

The bins are centered around the time difference they represent and are left-closed and right-open. This means that events with time difference \(-\tau_{max}-\delta_\tau/2\) are counted in the leftmost bin, but events with difference \(\tau_{max}+\delta_\tau/2\) are not counted at all.

The bin centers run from \(-\tau_{max}\) to \(+\tau_{max}\) in steps of \(\delta_\tau\). The corresponding array of time lags for the histogram bins can therefore be constructed in PyNEST as

import numpy as np

n_bins = int(2 * tau_max / delta_tau) + 1
times = np.linspace(-tau_max, tau_max, n_bins)

The correlation detector has exactly two inputs, which are selected via the receptor_type of the incoming connection: all incoming connections with receptor_type = 0 are pooled as spike source 1, the ones with receptor_type = 1 as spike source 2.

Correlation detectors ignore any connection delays.

This recorder does not record to file, screen, or memory in the usual sense. The recorded data is only available from the status dictionary.

Parameters

The following parameters can be set in the status dictionary.

Parameter

Unit

Description

Tstart

ms

Time at which to start counting events. Set this to at least tau_max in order to avoid edge effects of the correlation counts.

Tstop

ms

Time at which to stop counting events. Set this to at most Tsim - tau_max, where Tsim is the duration of the simulation, in order to avoid edge effects of the correlation counts.

delta_tau

ms

Bin width. This has to be an odd multiple of the simulation resolution, to allow the symmetry between positive and negative time lags. Defaults to 5 times the simulation resolution.

tau_max

ms

One-sided maximum absolute time lag. Time differences in the range [-tau_max - delta_tau/2, tau_max + delta_tau/2) are binned. Must be a multiple of delta_tau. Defaults to 10 times the value of delta_tau.

The following read-only quantities are available in the status dictionary.

Recordable

Description

count_histogram

Raw, unweighted cross-correlation counts (array of integers).

histogram

Weighted cross-correlation counts, where each count is weighted by the product of the connection weights. The unit is squared synaptic weights and depends on the model (array of doubles).

histogram_correction

Correction factors used internally for the Kahan summation algorithm (array of doubles).

n_events

Number of events from source 0 and source 1 (list of two integers). Setting n_events to [0, 0] clears the histograms.

Receives

SpikeEvent

See also

spike_recorder

Examples using this model