Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
902c3d1
- Improve systole.detection docstrings
LegrandNico Sep 30, 2020
6ad145d
README: add reference to Artiifact
LegrandNico Oct 12, 2020
660464b
Download dataset from github instead of copying files when installing…
LegrandNico Oct 12, 2020
c0c1949
Fix test (downloading dataset)
LegrandNico Oct 12, 2020
8ad970a
Add requests to requirements-test
LegrandNico Oct 12, 2020
f5f7506
* plotly plot_raw(): add ecg_method parameter for peak detection.
LegrandNico Oct 27, 2020
8e8e9c5
Resample task1 dataset
LegrandNico Oct 27, 2020
c8b1c56
Change download path to dev branch
LegrandNico Oct 27, 2020
9aa2f7d
Task1 resample
LegrandNico Oct 27, 2020
0eef3a8
Task1 resample
LegrandNico Oct 27, 2020
d4e215f
New Task 1 dataset
LegrandNico Oct 30, 2020
2ce6735
Add tutorial notebook
LegrandNico Oct 30, 2020
684c284
Add tutorial colab link on readme
LegrandNico Oct 30, 2020
5f17eb6
colab link
LegrandNico Oct 30, 2020
97a9bcd
Update notebook
LegrandNico Oct 30, 2020
d4a17b0
Add jupyter-book version
LegrandNico Nov 2, 2020
d9108a6
- plotly.plot_subspaces: add `height` parameter to control the size o…
LegrandNico Nov 2, 2020
1a712ad
height parameter
LegrandNico Nov 2, 2020
c70e97a
Remove notebooks, will be hosted on LegrandNico/notebokks instead
LegrandNico Nov 2, 2020
13d5bcc
Update links to books
LegrandNico Nov 2, 2020
7cb4293
Update badges and links to notebooks
LegrandNico Nov 2, 2020
9ffad5d
rst formatting
LegrandNico Nov 2, 2020
2c8da45
Harmonisation of the `plot_raw` and `plot_subspaces` functions betwee…
LegrandNico Jan 4, 2021
3c5d395
Apply Black formatting
LegrandNico Jan 5, 2021
40dad05
Fix plotting test
LegrandNico Jan 5, 2021
c9b33f4
Add `nAttemps` parameters so recording.Oximeter.setup will return out…
LegrandNico Feb 18, 2021
32e95f9
Update Oximeter.check so it can record Nonin data format 7
LegrandNico Feb 18, 2021
8d21ea4
Update version
LegrandNico Feb 18, 2021
43f23fc
Add get_value function for data foramt 2 and 7 + some type hints
LegrandNico Feb 24, 2021
6e9f1e8
Fix data format 7
LegrandNico Feb 24, 2021
fdafd3b
Fix data format when using setup
LegrandNico Feb 24, 2021
f017ec9
recording.Oximeter.save support txt and npy files and save additional…
LegrandNico Feb 26, 2021
6bafc50
recording.Oximeter: add reset method
LegrandNico Feb 26, 2021
3a4aafc
Add pre-commit hooks, flake8, black and isort test + add correspondin…
LegrandNico Feb 26, 2021
431027d
Remove unused file
LegrandNico Feb 26, 2021
c3506a0
Minor fix
LegrandNico Feb 26, 2021
bca2ffa
Add type hints
LegrandNico Apr 3, 2021
da19b9c
Update README
LegrandNico Apr 4, 2021
871e938
Improve docstrings and prepare for v0.1.3
LegrandNico Apr 5, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[flake8]
max-line-length = 88
extend-ignore = E203, E722, E501
exclude =
__init__.py
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.pyc
*-checkpoint.ipynb
mypyreports/
8 changes: 8 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[settings]
known_third_party = ecgdetectors,matplotlib,numpy,pandas,plotly,psychopy,pytest,requests,scipy,seaborn,serial,sphinx_bootstrap_theme,tqdm
multi_line_output = 3
include_trailing_comma = True
force_grid_wrap = 0
use_parentheses = True
ensure_newline_before_comments = True
line_length = 88
23 changes: 23 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
repos:
- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.21
hooks:
- id: isort
files: ^systole/
- repo: https://github.com/ambv/black
rev: stable
hooks:
- id: black
language_version: python3
files: ^systole/
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: flake8
files: ^systole/
- repo: https://github.com/pre-commit/mirrors-mypy
rev: '' # Use the sha / tag you want to point at
hooks:
- id: mypy
files: ^systole/
args: [--ignore-missing-imports]
7 changes: 6 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@ python:
- "3.6"
- "3.7"
- "3.8"
- "3.9"

install:
- pip install -r requirements-test.txt
- pip install -r requirements.txt
- pip install coverage pytest
- pip install coverage pytest black mypy flake8 isort

script:
- coverage run -m pytest
- black --check ./systole/
- isort ./systole/
- mypy ./systole/ --ignore-missing-imports --follow-imports=skip
- flake8 ./systole/

after_success:
- bash <(curl -s https://codecov.io/bash)
Binary file removed Images/recording.png
Binary file not shown.
8 changes: 0 additions & 8 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,3 @@
include README.rst
include LICENSE
include requirements.txt

# Add datasets files
include systole/datasets/ppg.npy
include systole/datasets/rr.txt
include systole/datasets/Task1_ECG.npy
include systole/datasets/Task1_EDA.npy
include systole/datasets/Task1_Respiration.npy
include systole/datasets/Task1_Stim.npy
45 changes: 33 additions & 12 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@
.. image:: https://codecov.io/gh/embodied-computation-group/systole/branch/master/graph/badge.svg
:target: https://codecov.io/gh/embodied-computation-group/systole

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black

.. image:: https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336
:target: https://pycqa.github.io/isort/

.. image:: http://www.mypy-lang.org/static/mypy_badge.svg
:target: http://mypy-lang.org/

.. image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white
:target: https://github.com/pre-commit/pre-commit

================

.. figure:: https://github.com/embodied-computation-group/systole/raw/master/source/images/banner.png
Expand All @@ -38,35 +50,44 @@ Systole can be installed using pip:

The following packages are required to use Systole:

* Numpy (>=1.15)
* SciPy (>=1.3.0)
* Pandas (>=0.24)
* Matplotlib (>=3.0.2)
* Seaborn (>=0.9.0)
* py-ecg-detectors (>=1.0.2)
* `Numpy <https://numpy.org/>`_ (>=1.15)
* `SciPy <https://www.scipy.org/>`_ (>=1.3.0)
* `Pandas <https://pandas.pydata.org/>`_ (>=0.24)
* `Matplotlib <https://matplotlib.org/>`_ (>=3.0.2)
* `Seaborn <https://seaborn.pydata.org/>`_ (>=0.9.0)
* `py-ecg-detectors <https://github.com/berndporr/py-ecg-detectors>`_ (>=1.0.2)

Interactive plotting functions and reports generation will also require the following packages to be installed:

* plotly (>=4.8.0)
* plotly_express (>=0.4.1)
* `Plotly <https://plotly.com/>`_ (>=4.8.0)

For an overview of all the recording functionalities, you can refer to the following tutorials:
Tutorial
========

For an overview of all the recording functionalities, you can refer to the following examples:

* Recording
* Artefacts detection and artefacts correction
* Heart rate variability

For an introduction to Systole and cardiac signal analysis, you can refer to the following tutorial:

* Introduction to cardiac signal analysis - |Colab badge| - `Jupyter Book <https://legrandnico.github.io/Notebooks/IntroductionCardiacSignalAnalysis.html>`_

.. |Colab badge| image:: https://colab.research.google.com/assets/colab-badge.svg
:target: https://colab.research.google.com/github/LegrandNico/Notebooks/blob/main/IntroductionCardiacSignalAnalysis.ipynb

Recording
=========

Systole natively supports recording of physiological signals from the following setups:
* `Nonin 3012LP Xpod USB pulse oximeter <https://www.nonin.com/products/xpod/>`_ together with the `Nonin 8000SM 'soft-clip' fingertip sensors <https://www.nonin.com/products/8000s/>`_ (USB).
* Remote Data Access (RDA) via BrainVision Recorder together with Brain product ExG amplifier `<https://www.brainproducts.com/>`_ (Ethernet).
* Remote Data Access (RDA) via BrainVision Recorder together with `Brain product ExG amplifier <https://www.brainproducts.com/>`_ (Ethernet).

Artefact correction
===================

Systole implements the artefact rejection method recently proposed by Lipponen & Tarvainen (2019) [#]_.
Systole implements systolic peak detection inspired by van Gent et al. (2019) [#]_ and the artefact rejection method recently proposed by Lipponen & Tarvainen (2019) [#]_.

.. code-block:: python

Expand Down Expand Up @@ -137,7 +158,7 @@ References

**Peak detection (PPG signal)**

.. [#] van Gent, P., Farah, H., van Nes, N., & van Arem, B. (2019). HeartPy: A novel heart rate algorithm for the analysis of noisy signals. Transportation Research Part F: Traffic Psychology and Behaviour, 66, 368–378. https://doi.org/10.1016/j.trf.2019.09.015
.. [#] van Gent, P., Farah, H., van Nes, N., & van Arem, B. (2019). HeartPy: A novel heart rate algorithm for the analysis of noisy signals. *Transportation Research Part F: Traffic Psychology and Behaviour, 66, 368–378*. https://doi.org/10.1016/j.trf.2019.09.015

**Artefact detection and correction:**

Expand Down
54 changes: 0 additions & 54 deletions examples/Tutorial_HRV.py

This file was deleted.

15 changes: 8 additions & 7 deletions examples/Tutorial_recording.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@
# Recording and plotting your first time-series will only require 5 lines
# of code:

import time

import serial

from systole.recording import Oximeter
ser = serial.Serial('COM4') # Add your USB port here

ser = serial.Serial("COM4") # Add your USB port here

# Open serial port, initialize and plot recording for Oximeter
oxi = Oximeter(serial=ser).setup().read(duration=10)
Expand Down Expand Up @@ -56,7 +60,7 @@
# seconds for a continuous recording). When inserted into a while loop, it can
# record PPG signal in parallel with other commands.

import time

tstart = time.time()
while time.time() - tstart < 10:
oximeter.readInWaiting()
Expand All @@ -67,12 +71,9 @@
# ----------------
# Online heart beat detection, for cardiac-stimulus synchrony

import serial
import time
from systole.recording import Oximeter

# Open serial port
ser = serial.Serial('COM4') # Change this value according to your setup
ser = serial.Serial("COM4") # Change this value according to your setup

# Create an Oxymeter instance and initialize recording
oxi = Oximeter(serial=ser, sfreq=75, add_channels=4).setup()
Expand All @@ -84,4 +85,4 @@
paquet = list(oxi.serial.read(5))
oxi.add_paquet(paquet[2]) # Add new data point
if oxi.peaks[-1] == 1:
print('Heartbeat detected')
print("Heartbeat detected")
6 changes: 3 additions & 3 deletions examples/plot_ArtefactsCorrection.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
# ectopic beats. This method is more relevant for HRV analyse of long recording
# where the timing of experimental events is not important.

import matplotlib.pyplot as plt
#%%
import numpy as np
import matplotlib.pyplot as plt

from systole import simulate_rr
from systole.plotting import plot_subspaces
from systole.correction import correct_peaks, correct_rr

from systole.plotting import plot_subspaces

#%% Method 1 - Peaks correction
# #############################
Expand Down
2 changes: 1 addition & 1 deletion examples/plot_ArtefactsDetection.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

#%%
from systole.detection import rr_artefacts
from systole.utils import simulate_rr
from systole.plotting import plot_subspaces
from systole.utils import simulate_rr

#%%
# RR artefacts
Expand Down
86 changes: 0 additions & 86 deletions examples/plot_ECGProcessing.py

This file was deleted.

Loading