Skip to content

Commit 21b3eab

Browse files
authored
Merge pull request #9 from embodied-computation-group/dev
Push v0.1.3 from dev branch
2 parents 235c1d2 + 871e938 commit 21b3eab

File tree

194 files changed

+3686
-2162
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

194 files changed

+3686
-2162
lines changed

.flake8

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[flake8]
2+
max-line-length = 88
3+
extend-ignore = E203, E722, E501
4+
exclude =
5+
__init__.py

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.pyc
2+
*-checkpoint.ipynb
3+
mypyreports/

.isort.cfg

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[settings]
2+
known_third_party = ecgdetectors,matplotlib,numpy,pandas,plotly,psychopy,pytest,requests,scipy,seaborn,serial,sphinx_bootstrap_theme,tqdm
3+
multi_line_output = 3
4+
include_trailing_comma = True
5+
force_grid_wrap = 0
6+
use_parentheses = True
7+
ensure_newline_before_comments = True
8+
line_length = 88

.pre-commit-config.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/mirrors-isort
3+
rev: v4.3.21
4+
hooks:
5+
- id: isort
6+
files: ^systole/
7+
- repo: https://github.com/ambv/black
8+
rev: stable
9+
hooks:
10+
- id: black
11+
language_version: python3
12+
files: ^systole/
13+
- repo: https://github.com/pre-commit/pre-commit-hooks
14+
rev: v2.3.0
15+
hooks:
16+
- id: flake8
17+
files: ^systole/
18+
- repo: https://github.com/pre-commit/mirrors-mypy
19+
rev: '' # Use the sha / tag you want to point at
20+
hooks:
21+
- id: mypy
22+
files: ^systole/
23+
args: [--ignore-missing-imports]

.travis.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,19 @@ python:
44
- "3.6"
55
- "3.7"
66
- "3.8"
7+
- "3.9"
78

89
install:
910
- pip install -r requirements-test.txt
1011
- pip install -r requirements.txt
11-
- pip install coverage pytest
12+
- pip install coverage pytest black mypy flake8 isort
1213

1314
script:
1415
- coverage run -m pytest
16+
- black --check ./systole/
17+
- isort ./systole/
18+
- mypy ./systole/ --ignore-missing-imports --follow-imports=skip
19+
- flake8 ./systole/
1520

1621
after_success:
1722
- bash <(curl -s https://codecov.io/bash)

Images/recording.png

-658 KB
Binary file not shown.

MANIFEST.in

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,3 @@
22
include README.rst
33
include LICENSE
44
include requirements.txt
5-
6-
# Add datasets files
7-
include systole/datasets/ppg.npy
8-
include systole/datasets/rr.txt
9-
include systole/datasets/Task1_ECG.npy
10-
include systole/datasets/Task1_EDA.npy
11-
include systole/datasets/Task1_Respiration.npy
12-
include systole/datasets/Task1_Stim.npy

README.rst

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@
1414
.. image:: https://codecov.io/gh/embodied-computation-group/systole/branch/master/graph/badge.svg
1515
:target: https://codecov.io/gh/embodied-computation-group/systole
1616

17+
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
18+
:target: https://github.com/psf/black
19+
20+
.. image:: https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336
21+
:target: https://pycqa.github.io/isort/
22+
23+
.. image:: http://www.mypy-lang.org/static/mypy_badge.svg
24+
:target: http://mypy-lang.org/
25+
26+
.. image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white
27+
:target: https://github.com/pre-commit/pre-commit
28+
1729
================
1830

1931
.. figure:: https://github.com/embodied-computation-group/systole/raw/master/source/images/banner.png
@@ -38,35 +50,44 @@ Systole can be installed using pip:
3850
3951
The following packages are required to use Systole:
4052

41-
* Numpy (>=1.15)
42-
* SciPy (>=1.3.0)
43-
* Pandas (>=0.24)
44-
* Matplotlib (>=3.0.2)
45-
* Seaborn (>=0.9.0)
46-
* py-ecg-detectors (>=1.0.2)
53+
* `Numpy <https://numpy.org/>`_ (>=1.15)
54+
* `SciPy <https://www.scipy.org/>`_ (>=1.3.0)
55+
* `Pandas <https://pandas.pydata.org/>`_ (>=0.24)
56+
* `Matplotlib <https://matplotlib.org/>`_ (>=3.0.2)
57+
* `Seaborn <https://seaborn.pydata.org/>`_ (>=0.9.0)
58+
* `py-ecg-detectors <https://github.com/berndporr/py-ecg-detectors>`_ (>=1.0.2)
4759

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

50-
* plotly (>=4.8.0)
51-
* plotly_express (>=0.4.1)
62+
* `Plotly <https://plotly.com/>`_ (>=4.8.0)
5263

53-
For an overview of all the recording functionalities, you can refer to the following tutorials:
64+
Tutorial
65+
========
66+
67+
For an overview of all the recording functionalities, you can refer to the following examples:
5468

5569
* Recording
5670
* Artefacts detection and artefacts correction
5771
* Heart rate variability
5872

73+
For an introduction to Systole and cardiac signal analysis, you can refer to the following tutorial:
74+
75+
* Introduction to cardiac signal analysis - |Colab badge| - `Jupyter Book <https://legrandnico.github.io/Notebooks/IntroductionCardiacSignalAnalysis.html>`_
76+
77+
.. |Colab badge| image:: https://colab.research.google.com/assets/colab-badge.svg
78+
:target: https://colab.research.google.com/github/LegrandNico/Notebooks/blob/main/IntroductionCardiacSignalAnalysis.ipynb
79+
5980
Recording
6081
=========
6182

6283
Systole natively supports recording of physiological signals from the following setups:
6384
* `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).
64-
* Remote Data Access (RDA) via BrainVision Recorder together with Brain product ExG amplifier `<https://www.brainproducts.com/>`_ (Ethernet).
85+
* Remote Data Access (RDA) via BrainVision Recorder together with `Brain product ExG amplifier <https://www.brainproducts.com/>`_ (Ethernet).
6586

6687
Artefact correction
6788
===================
6889

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

7192
.. code-block:: python
7293
@@ -137,7 +158,7 @@ References
137158

138159
**Peak detection (PPG signal)**
139160

140-
.. [#] 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
161+
.. [#] 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
141162
142163
**Artefact detection and correction:**
143164

examples/Tutorial_HRV.py

Lines changed: 0 additions & 54 deletions
This file was deleted.

examples/Tutorial_recording.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,13 @@
2222
# Recording and plotting your first time-series will only require 5 lines
2323
# of code:
2424

25+
import time
26+
2527
import serial
28+
2629
from systole.recording import Oximeter
27-
ser = serial.Serial('COM4') # Add your USB port here
30+
31+
ser = serial.Serial("COM4") # Add your USB port here
2832

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

59-
import time
63+
6064
tstart = time.time()
6165
while time.time() - tstart < 10:
6266
oximeter.readInWaiting()
@@ -67,12 +71,9 @@
6771
# ----------------
6872
# Online heart beat detection, for cardiac-stimulus synchrony
6973

70-
import serial
71-
import time
72-
from systole.recording import Oximeter
7374

7475
# Open serial port
75-
ser = serial.Serial('COM4') # Change this value according to your setup
76+
ser = serial.Serial("COM4") # Change this value according to your setup
7677

7778
# Create an Oxymeter instance and initialize recording
7879
oxi = Oximeter(serial=ser, sfreq=75, add_channels=4).setup()
@@ -84,4 +85,4 @@
8485
paquet = list(oxi.serial.read(5))
8586
oxi.add_paquet(paquet[2]) # Add new data point
8687
if oxi.peaks[-1] == 1:
87-
print('Heartbeat detected')
88+
print("Heartbeat detected")

examples/plot_ArtefactsCorrection.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
# ectopic beats. This method is more relevant for HRV analyse of long recording
2121
# where the timing of experimental events is not important.
2222

23+
import matplotlib.pyplot as plt
2324
#%%
2425
import numpy as np
25-
import matplotlib.pyplot as plt
26+
2627
from systole import simulate_rr
27-
from systole.plotting import plot_subspaces
2828
from systole.correction import correct_peaks, correct_rr
29-
29+
from systole.plotting import plot_subspaces
3030

3131
#%% Method 1 - Peaks correction
3232
# #############################

examples/plot_ArtefactsDetection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
#%%
1414
from systole.detection import rr_artefacts
15-
from systole.utils import simulate_rr
1615
from systole.plotting import plot_subspaces
16+
from systole.utils import simulate_rr
1717

1818
#%%
1919
# RR artefacts

examples/plot_ECGProcessing.py

Lines changed: 0 additions & 86 deletions
This file was deleted.

0 commit comments

Comments
 (0)