Data Lab node

Correlation

Matrix: Pearson r between every pair of channels as a matrix Signal (Plot Heatmap, diverging ramp). Autocorrelation: channel A against its own past, over lags up to Max Lag — periodicity shows as peaks. Cross-correlation: channel A against channel B (or Signal B’s channel), lags −Max Lag…+Max Lag, positive = A leads. The lag functions are Signals over a seconds axis, ready for Plot.

Inputs

PortTypeDefault
SignalThe Data Lab signal to analyse — a Signal node's output, a Window, or any float array with its sample rate. Multi-channel signals are handled per channel.structure—
Signal BOptional second Signal for Cross-correlation; its Channel B is compared to Channel A of the first (resampled to the same rate).structure—
ModeMatrix: Pearson r between every pair of channels (a matrix for Plot Heatmap, diverging ramp). Autocorrelation: channel A against its own past. Cross-correlation: channel A against channel B, positive lag = A leads.int0
Channel AThe channel for the lag functions.int0
Channel BThe other channel (of this Signal, or of Signal B when cabled).int1
Max LagHow far the lag axis reaches, ms.float500
Update RateHow many times per second the analysis is recomputed (default 10); 0 = every frame. Lower rates save CPU on long windows — a moved parameter always recomputes at once.float10

Outputs

PortType
SignalThe Data Lab signal to analyse — a Signal node's output, a Window, or any float array with its sample rate. Multi-channel signals are handled per channel.structure
Valuesfloat
Peak Lagfloat
Peak Valuefloat
Mean Correlationfloat

How It Works

Correlation answers "do these move together", in three modes.

Matrix — the Pearson r between every pair of channels, as a matrix Signal ready for Plot's Heatmap with a diverging ramp. One picture of how a whole multi-channel source hangs together.

Autocorrelation — channel A against its own past, over lags up to Max Lag. Periodicity shows up as peaks, and the first strong peak is the period.

Cross-correlation — channel A against channel B (or against Signal B's channel), over lags from −Max Lag to +Max Lag, with positive meaning A leads.

The two lag functions come out as Signals over a seconds axis, so Plot draws them with correct tick labels. Peak Lag, Peak Value and Mean Correlation summarise the result as numbers.

Use Cases

  • Find the period — Autocorrelation of anything rhythmic: a gait, a breath, a beat, an oscillation.
  • Channel structure — The matrix heatmap of a 16-channel EEG shows which electrodes belong together.
  • Measure a delay — Cross-correlation between a source and its echo gives the delay in milliseconds.
  • Coupling as a control — Mean Correlation is a single number describing how coherent a multi-channel source currently is.
  • Data art — The correlation matrix is a beautiful picture in its own right, and Plot 3D's Surface makes it a landscape.

Tips

  • Detrend or high-pass before autocorrelation; a slow drift correlates with everything and hides the real peak.
  • The autocorrelation always peaks at lag 0 — look for the second peak for the period.
  • Max Lag bounds both the search and the cost. Keep it near the longest period you actually expect.
  • Correlation is not causation, and a lag is not a cause. It is still the fastest way to see structure.
  • Use a diverging colour ramp on the matrix heatmap so that zero sits in the middle.

Open Correlation in the interactive catalog →

Correlation is one of 381 nodes in Grafit Pro.

Free download. Every feature for 7 days, no card. Then €99.99 once — or keep playing your projects as a Player.

More Data Lab nodes