A short introduction in nonlinear dynamics (NLD) and nonlinear signal analysis (NSA) to determine whether a biomedical signal is generated by strange attractor and if it is characterized by fractality or self-similarity. By the end of this tutorial, you should master the following concepts:
- Fractal dimension and strange attractors
- Chaotic attractors and Lyapunov exponents
- Correlation dimension and Sample Entropy
- Hurst Exponent
- Dynamical Systems and maps vs time series analysis
This introduction would not be possible without the NOLDs, FATHON and MNE-python libraries.
Refer to the original pages of the two packages if you find the code and the concepts in this repo useful for your future work.
The NOLDs package is a rather comprehensive toolbox to make estimate nonlinear dynamics properties, while the FATHON is a specific toolbox to estimate the Hurst exponent via the detrend fluctuation analysis. The MNE is more generic toolbox for EEG and MEG analysis in Python.
- https://github.com/CSchoel/nolds
- https://github.com/stfbnc/fathon
- https://mne.tools/stable/index.html
Whenever you use these packages, please cite the library webpage and the appropriate references
This tutorial introduces all the key concepts on NLD and NSA, such as the difference between strange and chaotic attractors, fractal or geometrical dimension of the attractor basin, correlation dimension, sample entropy and the Hurst exponent. The concept of dynamical system/map is also introduced and how the Takens's theorem can extend NLD to any signal or observable.
By considering the Logistic Map as strange attractor, this tutorial gives a very similar introduction, by also taking a glimpse to Poincare Plots.
To validate the concepts shown in 1. and 2., this tutorial shows what happens when you remove the nonlinearities in a strange attractor such as the Henon map.
This tutorial just gives a more broader introduction to the Hurst exponent and the relationship with the spectrum beyond strange attractors.
The last tutorials took inspiration from the Sleep stages classification of the MNE python libraries (https://mne.tools/stable/auto_tutorials/clinical/60_sleep.html) to perform the same task with NSA.
If you have any questions, suggestions or corrections, you can find my contact information by browsing my personal website
This introduction has specifically been designed for biomedical signal processing and it targets master students or any student with a background in data processing and system theory background.
-
Clone this repo in your laptop
-
Open the terminal and run the command
-
git clone https://github.com/mlavanga/nonlinear_signals_analysis.git
-
-
You can always download this folder from the website
- Open the terminal and verify to have python3 by running
python3
The version should be < 3.9 if possible
- Change directory to the nonlinear_signal_analysis folder. Run the following commands.
rm -rf env
python3 -mvenv env
. env/bin/activate
pip3 install --upgrade pip
pip3 install wheel
pip3 install jupyterlab
pip3 install matplotlib
pip3 install nolds
pip3 install mne
pip3 install fathon
- Test the environment. Open a new tab on the terminal and run the following commands
. env/bin/activate
jupyter-lab
- Copy the paste the locahost link in your favourite browser or use the deafult opening session
- Test the tutorials (.ipynb file) by pressing Shift + Enter with your keyboard
- Enjoy
-
Create an Anaconda environment
-
Download an anaconda from the website
-
Download the zip folder from the github website and unzip it. We suggest to place it in the documents folder
-
Open the Anaconda prompt
-
Move to the folder of the project by running the command (modify accordingly)
-
cd C:\Users\<Username>\Documents\nonlinear_signal_analysis -
Run the following commands in the terminal
-
conda create -n env python=3.6 conda activate env pip3 install --upgrade pip pip3 install wheel pip3 install jupyterlab pip3 install matplotlib pip3 install nolds pip3 install mne pip3 install fathon -
Run the following command:
-
conda deactivate env conda activate env jupyter-lab -
Copy the paste the locahost link in your favourite browser or use the deafult opening session
-
Test the tutorials (.ipynb file) by pressing Shift + Enter with your keyboard
-
Enjoy
- Windows Linux Subsystem (WSL): You can repeat the step above in the new WSL terminal if installed in windows --> See https://docs.microsoft.com/en-us/windows/wsl/install-win10#simplified-installation-for-windows-insiders
- Enjoy again