Skip to main content

Coherency

Namespace: CONNECTIVITYLIB  ·  Library: Connectivity Library

#include <connectivity/coherency.h>

class CONNECTIVITYLIB::Coherency

Shared core of the coherence / imaginary-coherence family.

CONNECTIVITYLIB::Coherency::compute "compute" fills the per-trial DPSS spectra and accumulates the cross- and auto-spectral sums in ConnectivitySettings::IntermediateSumData. The two public reductions then collapse the complex coherency to a real scalar per channel pair: calculateAbs returns |Coh_{xy}(f)|^2 (classical magnitude-squared coherence, symmetric, sensitive to zero-lag mixing) and calculateImag returns |Im(Coh_{xy}(f))|, the volume-conduction-robust imaginary coherence of Nolte et al. (2004).

Complex coherency core; produces magnitude-squared and imaginary-part reductions for downstream metrics.

src/examples/ex_connectivity_metrics/main.cpp
// Coherency fills a network whose nodes already exist; the metric classes above wrap this.
settings.clearIntermediateData();
Network coherency("COHY");
coherency.setSamplingFrequency(kSFreq);
coherency.setFFTSize(kSamples / 2 + 1);
coherency.setUsedFreqBins(kSamples / 2 + 1);
for (int i = 0; i < 3; ++i) {
coherency.append(NetworkNode::SPtr(new NetworkNode(i, positions.row(i))));
}
Coherency::calculateAbs(coherency, settings);
coherency.setFrequencyRange(8.0f, 12.0f);

Inheritance​


Public Methods​

Coherency()​

Constructs a Coherency object.


Static Methods​

calculateAbs(finalNetwork, connectivitySettings)​

Calculates the absolute value of coherency of the rows of the data matrix.

Parameters:


calculateImag(finalNetwork, connectivitySettings)​

Calculates the imaginary part of coherency of the rows of the data matrix.

Parameters:


Example​

Used in examples​

ex_connectivity_metrics​

Connectivity metrics on synthetic data with a known coupling.

src/examples/ex_connectivity_metrics/main.cpp, line 200
Coherency::calculateAbs(coherency, settings);
coherency.setFrequencyRange(8.0f, 12.0f);
ok &= expect(std::fabs(edgeWeight(coherency, 0, 1) - coh01) < 1e-9, "Coherency::calculateAbs equals Coherence");

Authors of this file​