# Contributions:Coherence

Jump to: navigation, search

## Synopsis

The CoherenceFilter computes magnitude squared coherence between its input signals at a set of frequencies. The CoherenceSignalProcessing module computes a coherence-based feedback signal, including the SpatialFilter, LinearClassifier, and Normalizer processing stages.

## Versioning

### Author

juergen.mellinger@uni-tuebingen.de

### Source Code Revisions

• Initial development: 3340
• Tested under: 3340
• Known to compile under: 3340

## Functional Description

The CoherenceFilter computes magnitude squared coherence between pairs of input channels, applying the following computational steps:

• Maintaining a buffer of past data.
• Computing a time series of complex-valued Fourier coefficients $a(f,t)$ for a Fourier window moving over the data buffer with a specified window overlap. Windowing is done using a Hamming window.
• Computing the magnitude squared coherence between coefficient time series for different channels.

With $P_{12}(f)$ denoting the inner product of coefficient time series $a_1(f,t)$ and $a_2(f,t)$: $P_{12}(f)= \sum_t{a_1(f,t) \cdot a^*_2(f,t)}$,

the magnitude squared coherence between channel 1 and channel 2 at frequency $f$ is computed as: $C_{12}(f)=\frac{|P_{12}(f)|^2}{|P_{11}(f)||P_{22}(f)|}$.

In the output signal, channels correspond to pairs of input channels, enumerated by scanning the lower half of the channels-by-channels matrix in a row-wise manner: 21, 31, 32, 41, 42, 43, 51, 52, 53, 54, ...

For a more convenient configuration of the LinearClassifier filter, output channels are labeled, constructing labels from the labels of the input channels. Labels are formed like this: Coh-foo-bar when "foo" is the label of input channel 1, and "bar" is the label of input channel 2.

Elements in the output signal correspond to the frequencies given in the CohFrequencies parameter, and are labeled by the values entered there.

## Parameters

### CohBufferLength

Length of the past data buffer over which coherence is computed, in seconds (when followed with "s"), or blocks.

### CohWindowLength

Length of the Fourier window moving over the data buffer, in seconds (when followed with "s"), or blocks.

### CohWindowOverlap

Overlap between subsequent windows, in seconds (when followed with "s"), or blocks.

### CohFrequencies

List of frequencies where coherence is evaluated, corresponds to elements in the output signal.