DSP.jl icon indicating copy to clipboard operation
DSP.jl copied to clipboard

Magnitude squared coherence function

Open jfsantos opened this issue 11 years ago • 4 comments

We should add a function for computing the cross spectral density and magnitude squared coherence. Or maybe we could just bring @simonster's [Synchrony.jl]https://github.com/simonster/Synchrony.jl) implementations to DSP.jl?

jfsantos avatar Nov 01 '14 22:11 jfsantos

I'm working on revising Synchrony.jl to use BLAS where profitable, which can give a major speedup, but it may be a month before I get to finishing that. In general I'm not sure where to draw the boundary between Synchrony.jl and DSP.jl. Some of the things in Synchrony.jl are common DSP functionality that should be in DSP.jl (e.g. multitaper PSD estimates and coherence for two signals); others are pretty esoteric and probably not really useful outside of neuroscience (e.g. spike-field coherence); and others are potentially applicable outside of neuroscience but mostly used in neuroscience (e.g. PLV, which is the magnitude of the angular differences between signals, and PPC, which is the squared magnitude of the angular differences with the bias removed) . The current API is also really tailored to neuroscience data, but I'm hoping to make it more general.

simonster avatar Nov 02 '14 17:11 simonster

Great. Let's wait until you have time to update Synchrony.jl and then we can move the multitaper PSD and coherence functions to DSP.jl. Let me know if I can help with anything, be it coding, testing, docs...

Thanks!

jfsantos avatar Nov 02 '14 17:11 jfsantos

I second the addition of cross power spectrum computation. I had a look at Synchrony, but it seems abandoned (the last commit was one year ago, and building fails).

If nobody has implemented a function of this kind yet, I might venture in providing a PR for this. I checked how scipy.signal implements cross power spectrum, and it looks straightforward to do, as csd (the function used to compute the cross power spectrum) is used by the welch function. I would follow the same route.

ziotom78 avatar Aug 01 '18 07:08 ziotom78

Curious whether anything came of this. Aside from Synchrony.jl, I haven't seen a Julia implementation of magnitude squared coherence. 

beOn avatar Apr 08 '21 10:04 beOn