Instrument2SpectralCoherence

This program computes the spectral coherence between two instrument files.

The (magnitude-squared) coherence is defined as \[ C_{xy}(f) = \frac{|P_{xy}(f)|^2}{P_{xx}(f)P_{yy}(f)} \]and is a measure in the range [0, 1] for the similarity of the signals $x$ and $y$ in frequency domain. $P_{xy}$ is the cross-spectral density between $x$ and $y$ and $P_{xx}$, $P_{yy}$ are auto-spectral densities. Auto- and cross-spectral densities are computed using Lomb's method (see Instrument2PowerSpectralDensity for details).

The resulting PSD is the average over all arcs. For regularly sampled time series, this method yields the same results as FFT based PSD estimates.

A regular frequency grid based on the longest arc and the median sampling is computed. The maximum number of epochs per arc is determined by \[ N = \frac{t_{\text{end}} - t_{\text{start}}}{\Delta t_{\text{median}} } + 1, \]the Nyquist frequency is given by \[ f_{\text{nyq}} = \frac{1}{2\Delta t_{\text{median}}}. \] If it is suspected that inputfileInstrument contains secular variations, the input should be detrended using InstrumentDetrend.

The outputfileCoherence contains a matrix with the frequency vector as first column, the coherence for each instrument channel is saved in the following columns.

NameTypeAnnotation
outputfileCoherence
filenamecolumn 1: frequency, column 2-n coherence
inputfileInstrument
filename
inputfileInstrumentReference
filename
This program is parallelized.