FourierAnalysis.jl - a package for the analysis of multivariate time-series in the frequency and time-frequency domain

Hello all,

I wrote a package for performing the analysis of real multivariate time series both in the frequency domain and in the time-frequency domain, based on DSP.jl, FFTW.jl and AbstractFFTs.jl.

In the frequency domain FourierAnalysis computes spectra, linear and non-linear cross-spectral matrices and several linear and non-linear coherence matrices using the sliding-windows Welch method.

Time-frequency representations are obtained applying a filter-bank and the Hilber transform. This way one obtains the analytic signal, the instantaneous amplitude (envelope) and the instantaneous phase, along with several popular linear and non-linear , weighted , univariate and bivariate statistics, such as the mean amplitude , mean direction, phase concentration, the non-linear version of which is a directional statistic known as circular mean resultant length, comodulation and coherence , the non-linear version of which is a synchronization statistic known as phase-locking values or phase coherence .

Such a tool is basic in signal-processing and data science. I wrote if for electroencephalographic data, but it may turn useful to many people. The usage has been kept as simple as possible, without sacrificing relevant options.

The package is in a pre-release stage. If you are willing to reviewing the code and/or the documentation, you are more then welcome!

13 Likes

Looks great, the biggest issue at first sight is the lack of tests. Otherwise adding a nice image to the readme always makes it more appealing (and I see you have methods to make plots).

1 Like

Looks really cool. I work with multivariate time-series data in the form of multichannel audio from a large microphone array (distances on the order of 10s of meters). I use a lot of time-frequency representations but am not very familiar with most of the cross-spectral techniques you’re using (at least not by those names). Are they generally applicable when the time delays between channels are large?

Actually there are several tests in the ‘examples’ units, but i did not set up a formal test unit.

As per the picture, it is a good idea indeed, thanks, i will do it.

1 Like

I am not familiar with your kind of data, but i would not be surprised that you know the bivariate time-frequency measures i implemented as they are named very differently by different authors and even more differently in different fields.
Take a look to Congedo, 2018 to check what they correspond to in mathematical terms. Also, it is pretty simple to implement related measures. Let me know if you want to add more.

Thanks for sharing this - looks very useful!

I wonder why you use as a parameter for something like threading. This symbol appears to be a needless hurdle.

Hello, thanks for the remark. I used that symbol for consistency with a package i wrote previously. I later realised that using unicode symbols as arguments’ name is not very handy working in the REPL. However, in practice you can ignore completely that argument, as FourierAnalysis automatically check if it is worth multi-threading the operations and, if not, it switches to single-threading mode. All this will change with julia v1.3, when the new multi-threading will be released. I will drop the symbol then.

1 Like