Warning

This is A PREVIEW for NEST 3.0 and NOT an OFFICIAL RELEASE! Some functionality may not be available and information may be incomplete!

# correlation_detector – Device for evaluating cross correlation between two spike sources¶

## Description¶

The correlation_detector device is a recording device. It is used to record 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 result can be obtained via GetStatus 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 are arrays of $$2*\tau_{max}/\delta_{\tau}+1$$ values containing the histogram counts in the following way:

Let $$t_{1,i}$$ be the spike times of source 1, $$t_{2,j}$$ the spike times of source 2. histogram[n] then contains the sum of products of the weight $$w_{1,i}*w_{2,j}$$, count_histogram[n] contains 1 summed over all events with $$t_{2,j}-t_{1,i}$$ in

$n*\delta_\tau - \tau_{max} - \delta_\tau/2 n*\delta_\tau - \tau_{max} + \delta_\tau/2$

The bins are centered around the time difference they represent, but 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 event with difference tau_max+delta_tau/2 are not counted at all.

The correlation detector has two inputs, which are selected via the receptor_port of the incoming connection: All incoming connections with receptor_port = 0 will be pooled as the spike source 1, the ones with receptor_port = 1 will be used as spike source 2.

## Parameters¶

 Tstart real Time when to start counting events. This time should be set to at least start + tau_max in order to avoid edge effects of the correlation counts. Tstop real Time when to stop counting events. This time should be set to at most Tsim - tau_max, where Tsim is the duration of 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 resolution, to allow the symmetry between positive and negative time-lags. tau_max ms One-sided width. In the lower triagnular part events with differences in [0, tau_max+delta_tau/2) are counted. On the diagonal and in the upper triangular part events with differences in (0, tau_max+delta_tau/2]. N_channels integer The number of pools. This defines the range of receptor_type. Default is 1. Setting N_channels clears count_covariance, covariance and n_events. histogram squared read-only - raw, weighted, cross-correlation counts synaptic weights Unit depends on model histogram_correction list of integers read-only - Correction factors for Kahan summation algoritm n_events list of integers Number of events from source 0 and 1. By setting n_events to [0,0], the histogram is cleared.

Remarks:

This recorder does not record to file, screen or memory in the usual sense.

Correlation detectors IGNORE any connection delays.

Correlation detector breaks with the persistence scheme as follows: the internal buffers for storing spikes are part of State_, but are initialized by init_buffers_().

@todo The correlation detector could be made more efficient as follows (HEP 2008-07-01): - incoming_ is vector of two deques - let handle() push_back() entries in incoming_ and do nothing else - keep index to last “old spike” in each incoming_; cannot

be iterator since that may change

• update() deletes all entries before now-tau_max, sorts the new entries, then registers new entries in histogram

Example:

See Auto- and crosscorrelation functions for spike trains[cross_check_mip_corrdet.py] in pynest/examples.

SpikeEvent