# FourierAnalysis Documentation

## Requirements & Installation

**Julia** version ≥ 1.3

**Packages:** see the dependencies of the main module.

To install the package, execute the following command in Julia's REPL:

`]add FourierAnalysis`

## Contributions

Independent testing and reviewers for both the code and the documentation are welcome.

## About the Author

Marco Congedo is a research scientist of CNRS (Centre National de la Recherche Scientifique), working in UGA (University of Grenoble Alpes), in Grenoble, France, the city where Jean-Baptiste Joseph Fourier has served as a Governor. **Contact**: first name dot last name at gmail dot com

## Overview

*FourierAnalysis* allows the analysis of

- sets of
*real multivariate time-series*in the*frequency*domain, - sets of
*real univariate time-series*in the*time-frequency*domain.

The implemented tools may suit also other kind of data.

Frequency-domain representations include **spectra**, linear and non-linear **cross-spectral matrices** and several linear and non-linear **coherence matrices**, which are all estimated using the sliding-windows (Welch) method.

For those estimations, keep in mind that given sampling rate $sr$ and window length $wl$, the **discrete Fourier frequencies** are $0, 1r, 2r,..., qr$, where $r=sr/wl$ is the **frequency resolution** and $q=wl÷2$ (integer division). The 0 (zero) frequency corresponds to the **DC level**, which estimation in *FourierAnalysis* is always given as an option.

Time-frequency (TF) representations are obtained applying a filter-bank and the Hilbert transform. This way *FourierAnalysis* computes the **analytic signal**, from which the **instantaneous amplitude** (envelope) and **instantaneous phase** are obtained, 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**, **amplitude co-modulation**, **coherence**, the non-linear version of which is a synchronization measure known as **phase-locking values** or **phase coherence**, etc.

Such a large panel of measures is provided in a simple and unified fashion, following the approach illustrated in Congedo(2018) in the context of electroencephalography (EEG), for which all default settings have been tailored. The package has been written with the *do-it-with-one-line* spirit and with the aim of allowing full control over relevant options for the Fourier analysis of multivariate time-series.

For starting using this package, browse the code units listed here below and execute the many **code examples** you will find therein or execute the 'example.jl' units collected in the "example" folder distributed in the github repository.

## Code units

*FourierAnalysis* includes fourteen code units (.jl files):

Main API Units | Description |
---|---|

MainModule | (FourierAnalysis.jl) constants, types, some structs, tips & tricks |

tapers.jl | tapering windows for spectral, cross-spectral and coherence analysis |

spectra.jl | spectra of a time-series (set) or of a multivariate time series (set) |

crossspectra.jl | cross-spectral matrices of a multivariate time series (set) |

coherence.jl | coherence matrices of a multivariate time series (set) |

goertzel.jl | Goertzel's algorithms for estimating a single DFT coefficient |

timefrequency.jl | analytic signal, instantaneous amplitude and phase of a time-series set |

timefrequencyuni.jl | univariate measures of a time-series set |

timefrequencybi.jl | bivariate measures of a time-series set |

recipes.jl | plot recipes and tips to plot data created by Fourier Analysis |

tools.jl | collection of useful functions |

Other API Units | Description |
---|---|

fftw.jl | interface to FFTW.jl to obtain forward and backward FFT planners |

filters.jl | interface to DSP.jl to apply filter-banks |

hilbert.jl | computation of the analytic signal via Hilbert transform |

## Contents

- FourierAnalysis Documentation
- MainModule
- tapers.jl
- spectra.jl
- crossspectra.jl
- coherence.jl
- timefrequency.jl
- timefrequencyuni.jl
- timefrequencybi.jl
- recipes.jl
- tools.jl
- fftw.jl
- goertzel.jl
- filters.jl
- hilbert.jl

## Index

`FourierAnalysis.Planner`

`FourierAnalysis.TFamplitude`

`FourierAnalysis.TFanalyticsignal`

`FourierAnalysis.TFphase`

`FourierAnalysis.amplitude`

`FourierAnalysis.analyticsignal`

`FourierAnalysis.b2f`

`FourierAnalysis.bands`

`FourierAnalysis.bbands`

`FourierAnalysis.brange`

`FourierAnalysis.coherence`

`FourierAnalysis.comodulation`

`FourierAnalysis.concentration`

`FourierAnalysis.crossSpectra`

`FourierAnalysis.decibel`

`FourierAnalysis.extract`

`FourierAnalysis.f2b`

`FourierAnalysis.fbands`

`FourierAnalysis.fdf`

`FourierAnalysis.filterbank`

`FourierAnalysis.fres`

`FourierAnalysis.goertzel`

`FourierAnalysis.goertzel2`

`FourierAnalysis.goertzel_fast`

`FourierAnalysis.isLinear`

`FourierAnalysis.isNonLinear`

`FourierAnalysis.isUnwrapped`

`FourierAnalysis.meanAmplitude`

`FourierAnalysis.meanDirection`

`FourierAnalysis.phase`

`FourierAnalysis.polar`

`FourierAnalysis.sameParams`

`FourierAnalysis.sinusoidal`

`FourierAnalysis.slepians`

`FourierAnalysis.smooth`

`FourierAnalysis.spectra`

`FourierAnalysis.taper`

`FourierAnalysis.taperinfo`

`FourierAnalysis.tfAxes`

`FourierAnalysis.unwrapPhase`

`Statistics.mean`