Skip to content

Commit f3333c3

Browse files
Nicolas Legrandalexvasilichilbanellis
authored
v0.2.3 (#42)
* Fix typo * [Git actions] : add linting, type checking and code coverage. * Rename requirements file * Update codecov.yml * Fix Git action for code coverage * Add citation in the text * Git actions: using pytest-cov and another black version * Fix test workflow * added plot_rsp() to plots, backends, init, test_plots * liting fix * First version of the BIDS report module. - Create individual HTML reports, summary dataframes and physio dataframes. - Create group-level HTML reports. * [Git Actions] : Remove unused package from testing. * Fix linting package error. * [tests] : close Matplotlib figures after test to avoid memory overload. * Formatting issue in README * [reports] : Add command line functionalities. * [reports] : Add show_raw parameter and set to False as defaults to save memory. * [reports] : load participants ID automatically if not provided. * [utils] : Add a nan_cleaning function that can be called before peaks detection (optional). * [PPG] : Add a find_clipping function to automatically find clipping threshold. This function is called by ppg_peaks when clipping=True and clipping_threshold="auto". [detection]: ecg_peaks, ppg_peaks and rsp_peaks accept pd.Series as input. Defalt input variable named signal for consistency. * [notebooks] : Clean imports, fix use of interpolate_clipping and use keyword args. * Minor API docs. * [detection] : remove default values for `sfreq` and standardize outputs for the 3 modalities. * Doctrings and minor change in tests. * [hrv] Minor fix: use pd.concat instead of the append method. * [correction] : Add a correct_ectopic_peaks to correct pseudo-ectopic heart beatd in peaks vector. * [plots] : plot_raw accept a `decim` parameter to control raw signal downsamplig. * Use pd.concat * Use pd.concat * Move the tables function into the reports sub-module. Update the reports function to current (non working) version. * [plots] Improve plot_events and its integration with plot_rr. * [plots]: fix plot_evoked and allow to pass arguments to seaborn.lineplot more easily. * [detection]: Add sleepecg peak detector as default for Systole * [plots]: plot_raws now accept an events_params parameter to be passed to plot_rr. * Add sleepecg in the requirements * Drop CI for Python 3.7 * Update pre-commit * [reports]: Add logs for artefatcs in the subject level function. * [test] : Fix error in plot_raw * Fix CI error (black) * Minor fixes * [reports] : Add artefacts visualization at the group level. * [reports] Use Joblib for paralellization. * [detection] - PPG: change `noise_removal` to moving_average and add a `moving_average_length` parameter to control the window length. - Fix interpolate_clipping() as it was not handling thresholds correctly if the provided threshold is not the max/min of the time series. * Fix the test after clipping error. * [requirements]: include Numpy 1.21 * [reports] : The command line function find the relevant files automatically. The signals are automatically trimmed when starting and ending times are provided. Also start using pathlib instead of strings for paths. * Typos and changelogs. * - Fix bug in interpolate_clipping() and add corresponding tests - Linting * [detection] : interpolate_clipping - fix the way first and last values are corrected. Look at all values more/less or equal than thr and substract the smallest diff from the time serie. * [plots] : Minor change in matplotlib defaults * Update pre-commit config * Fix formatting and mypy errors * Add Git action for automated docs deployment (first trial). * [docs] : Fix small errors in the examples * [docs] : Drop Psychopy import in the examples * isort config file * Update the requirement files. * [docs] : - Automatic docs construction now working and moved to https://embodied-computation-group.github.io/systole/ - Minor fixes in the docstrings * Update notebooks * Remove docs api example from the code base. * Update docs link * Remove the findOximeter function #8 * [docs]: link to paper * CI minor updates * [plots]: Fix decim function and error in the docstring examples. * [correction] : Rewrite correct_missed (to correct_missed_rr) and correct_extra (to correct_extra_rr) to better control for RR insertion and deletion. Rewrite correct_rr. All interpolations in a single pass. All function use jit. (see #40). Update pre-commit hooks. * [correction] : Add extensive testing suite for correct_extra_rr, correct_missed_rr and correct_rr (#40). * [correction] : Fix errors in the arrays update for missed and etra peaks. Update the corresponding notebooks. Add entry in changelogs (#40). * Fix mypy errors * [correction] : Update the dcumentation for API changes. * changelogs * [docs] : Add instruction for using dev branch * [reports] : Fix defaults paths and add the patterns parameter for more flexibility in the files selection. * [docs] : Add docs for BIDS folder. * Update requirements.txt. Fix reports tests. * [viewer] : Add first version of Systole viewer for manual peaks correction. * [docs] Myst parser * [viewer] : Use empty path names by default. * [viewer] : more docs and small fix * [docs] : Reorganize folders * [plots] : plot_subspaces accepts an ax argument. * Autodocs link * [test] : Remove notebooks from the test suite now that we have autodocs jobs (for now). * Links * Change version to 0.2.3dev * [reports] : Use the file name from the BIDS folder to save derivatives. This will avoid duplicates in case of different patterns been used. * [reports] : Automatically retrieve file_name template when creating group level reports. * [docs] Image link * [viewer] : Automatically loading and processing data depending on the modality. * [viewer] : Create method for plotting and add some aesthetic features. * [viewer] : Fix several errors during import and add more menues in the Viewer. * [viewer] : Add option to mark the signal or segments of the signal as bads. * [plots] Prepare merge plot_raw and plot_resp and remove tight layout from the deault. * [plots] : Error in plot_raw * [viewer] : Fix save button * [viewer] : Better output when files are not found. * [viewer] : Error with the logs of bad segments. * [plots] : Add possibe `bad_segments` parameter as input for plot_raw and plot_rr. * [plots] : Merge plot_resp into plot raw. Use modality strings defined at the package level. [viewer] : allow full file name to be provided. * [pre-commit] Autoupdate * Typing * docstring * [utils] : Add tools to handle bad segments and use it in the plotting functions. * [requirements] : last pydata theme * Add docs. * Fix bad_segments utills (flake8 error) * requirements (bibtex) * Use sleepecg as default R-peaks detector * [docs] * [docs] * [docs] More examples * [docs] Links * [docs] plotting examples * [docs] * [docs] * [viewer] : Save the entire corrected peaks. Load corrected peaks and bad segments automatically with signal. * [viewer] : fix file name for corrected peaks. * Add import function for manually corrected peaks (#41) * [docs] Pair noteboks with md files * dev version * [viewer] : Fix the way corrected peaks are imported. * [docs] Citations * Rename ref.bib * [reports] : Improve the reports and fix filename error. * [reports] : Save a JSON and the raw signal in the preprocessed folder. * [viewer] : Retrieve the list of participants from the folder names. * [docs] documenting Viewer usages * [docs] remove citation that is not rendering correctly * [docs] images links * version bump Co-authored-by: alexvasilichi <[email protected]> Co-authored-by: Leah banellis <[email protected]>
1 parent 63bdad2 commit f3333c3

File tree

215 files changed

+12193
-5651
lines changed

Some content is hidden

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

215 files changed

+12193
-5651
lines changed

.github/workflows/docs.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Build and Deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
pull_request:
8+
branches:
9+
- master
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
build-and-deploy:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout 🛎️
18+
uses: actions/checkout@v3
19+
20+
- name: Set up Python 3.9
21+
uses: actions/setup-python@v1
22+
with:
23+
python-version: 3.9
24+
25+
- name: Build
26+
run: |
27+
pip install .
28+
pip install -r requirements-docs.txt
29+
sphinx-build -b html docs/source docs/build/html
30+
31+
- name: Deploy 🚀
32+
uses: JamesIves/github-pages-deploy-action@v4
33+
with:
34+
folder: docs/build/html
35+
BRANCH: gh-pages

.github/workflows/linting.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Linting
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
python-version: [3.9]
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: Set up Python ${{ matrix.python-version }}
14+
uses: actions/setup-python@v2
15+
with:
16+
python-version: ${{ matrix.python-version }}
17+
- uses: actions/cache@v2
18+
name: Configure pip caching
19+
with:
20+
path: ~/.cache/pip
21+
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
22+
restore-keys: |
23+
${{ runner.os }}-pip-
24+
- name: Install dependencies
25+
run: |
26+
pip install -r requirements-tests.txt
27+
pip install isort flake8 black
28+
pip install mypy==0.971
29+
pip install types-setuptools
30+
- name: Run tests and coverage
31+
run: |
32+
mypy ./systole/ --ignore-missing-imports
33+
flake8 ./systole/
34+
black ./systole/
35+
isort ./systole/

.github/workflows/test.yml

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
name: Test
22

3-
on: [push]
3+
on: [push, pull_request]
44

55
jobs:
66
test:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
python-version: [3.7, 3.8, 3.9]
10+
python-version: [3.8]
1111
steps:
1212
- uses: actions/checkout@v2
1313
- name: Set up Python ${{ matrix.python-version }}
@@ -23,10 +23,12 @@ jobs:
2323
${{ runner.os }}-pip-
2424
- name: Install dependencies
2525
run: |
26-
pip install -e '.[test]'
27-
pip install -r requirements-test.txt
28-
pip install ipykernel
26+
pip install -r requirements-tests.txt
27+
pip install ipykernel coverage pytest pytest-cov
2928
python -m ipykernel install --user --name python3
30-
- name: Run tests
29+
pip install .
30+
- name: Run tests and coverage
3131
run: |
32-
pytest
32+
pytest --cov=./ --cov-report=xml
33+
- name: Upload coverage to Codecov
34+
uses: codecov/codecov-action@v3

.gitignore

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
*.pyc
22
*-checkpoint.ipynb
3+
*-checkpoint.md
34
mypyreports/
45
build/
56
dist/
67
systole.egg-info/
78
htmlcov/
89
.coverage
910
.vscode/
10-
source/auto_examples
11-
source/generated
11+
docs/source/auto_examples
12+
docs/source/generated
13+
docs/source/api
14+
coverage.xml

.isort.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[settings]
2-
known_third_party = ecgdetectors,matplotlib,numpy,pandas,plotly,psychopy,pytest,requests,scipy,seaborn,serial,sphinx_bootstrap_theme,tqdm
2+
known_third_party = matplotlib,numpy,pandas,pytest,requests,scipy,seaborn,serial,sphinx_bootstrap_theme,tqdm
33
multi_line_output = 3
44
include_trailing_comma = True
55
force_grid_wrap = 0

.pre-commit-config.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
repos:
22
- repo: https://github.com/pre-commit/mirrors-isort
3-
rev: v5.9.3
3+
rev: v5.10.1
44
hooks:
55
- id: isort
66
files: ^systole/
77
- repo: https://github.com/ambv/black
8-
rev: 21.12b0
8+
rev: 22.6.0
99
hooks:
1010
- id: black
1111
language_version: python3
1212
files: ^systole/
13-
- repo: https://github.com/pre-commit/pre-commit-hooks
14-
rev: v2.3.0
13+
- repo: https://github.com/pycqa/flake8
14+
rev: 5.0.4
1515
hooks:
1616
- id: flake8
1717
files: ^systole/
1818
- repo: https://github.com/pre-commit/mirrors-mypy
19-
rev: 'v0.920' # Use the sha / tag you want to point at
19+
rev: 'v0.971'
2020
hooks:
2121
- id: mypy
2222
files: ^systole/

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Please verify that your issue is not being currently addressed by other issues o
2626

2727
While issue reporting is valuable, we strongly encourage users who are inclined to do so to submit patches for new or existing issues via pull requests. This is particularly the case for simple fixes, such as typos or tweaks to documentation, which do not require a heavy investment of time and attention.
2828

29-
Contributors are also encouraged to contribute new code to enhance Systole's functionality, also via pull requests. Please consult the [Systole documentation](https://systole-docs.github.io/) to ensure that any new contribution does not strongly overlap with existing functionality.
29+
Contributors are also encouraged to contribute new code to enhance Systole's functionality, also via pull requests. Please consult the [Systole documentation](https://embodied-computation-group.github.io/systole/#) to ensure that any new contribution does not strongly overlap with existing functionality.
3030

3131
The preferred workflow for contributing to Systole is to fork the [GitHub repository](https://github.com/embodied-computation-group/systole), clone it to your local machine, and develop on a feature branch.
3232

MANIFEST.in

+3
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22
include README.rst
33
include LICENSE
44
include requirements.txt
5+
include systole/reports/subject_level.html
6+
include systole/reports/group_level.html
7+
include systole/reports/images/logo.svg

README.rst

+50-16
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
================
3030

31-
.. image:: https://github.com/embodied-computation-group/systole/blob/dev/source/images/logo.png
31+
.. image:: https://github.com/embodied-computation-group/systole/blob/dev/docs/source/images/logo.png
3232
:align: center
3333

3434
================
@@ -38,10 +38,18 @@ This includes tools for data epoching, artefact detection, artefact correction,
3838
variability analyses, circular statistical approaches to analysing cardiac cycles, and synchronising stimulus
3939
presentation with different cardiac phases via Psychopy.
4040

41-
The documentation can be found under the following `link <https://systole-docs.github.io/>`_.
41+
The documentation can be found under the following `link <https://embodied-computation-group.github.io/systole/#>`_.
4242

4343
If you have questions, you can ask them in the `Gitter chat <https://gitter.im/ecg-systole/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge>`_.
4444

45+
How to cite?
46+
++++++++++++
47+
48+
If you are using **Systole** in a publication we ask you to cite the following paper::
49+
50+
Legrand et al., (2022). Systole: A python package for cardiac signal synchrony and analysis. Journal of Open Source Software, 7(69), 3832, https://doi.org/10.21105/joss.03832
51+
52+
4553
Installation
4654
++++++++++++
4755

@@ -88,6 +96,8 @@ For an introduction to Systole and cardiac signal analysis, you can refer to the
8896
- |Colab badge 4|
8997
* - Instantaneous and evoked heart rate
9098
- |Colab badge 5|
99+
* - Working with BIDS folders
100+
- |Colab badge 6|
91101

92102
.. |Colab badge 1| image:: https://colab.research.google.com/assets/colab-badge.svg
93103
:target: https://colab.research.google.com/github/embodied-computation-group/systole/blob/dev/source/notebooks/1-PhysiologicalSignals.ipynb
@@ -104,6 +114,9 @@ For an introduction to Systole and cardiac signal analysis, you can refer to the
104114
.. |Colab badge 5| image:: https://colab.research.google.com/assets/colab-badge.svg
105115
:target: https://colab.research.google.com/github/embodied-computation-group/systole/blob/dev/source/notebooks/5-InstantaneousHeartRate.ipynb
106116

117+
.. |Colab badge 6| image:: https://colab.research.google.com/assets/colab-badge.svg
118+
:target: https://colab.research.google.com/github/embodied-computation-group/systole/blob/dev/source/notebooks/6-WorkingWithBIDSFolders.ipynb
119+
107120

108121
Getting started
109122
+++++++++++++++
@@ -127,7 +140,7 @@ The package integrates a set of functions for interactive or non interactive dat
127140
plot_raw(signal[60000 : 120000], modality="ecg", backend="bokeh",
128141
show_heart_rate=True, show_artefacts=True, figsize=300)
129142
130-
.. image:: https://github.com/embodied-computation-group/systole/blob/dev/source/images/raw.png
143+
.. image:: https://github.com/embodied-computation-group/systole/blob/dev/docs/source/images/raw.png
131144
:align: center
132145

133146

@@ -145,7 +158,7 @@ Artefacts can be detected and corrected in the RR interval time series or the pe
145158
146159
plot_subspaces(peaks, input_type="peaks", backend="bokeh")
147160
148-
.. image:: https://github.com/embodied-computation-group/systole/blob/dev/source/images/subspaces.png
161+
.. image:: https://github.com/embodied-computation-group/systole/blob/dev/docs/source/images/subspaces.png
149162
:align: center
150163

151164

@@ -163,7 +176,7 @@ Systole implements time-domain, frequency-domain and non-linear HRV indices, as
163176
plot_poincare(peaks, input_type="peaks", backend="bokeh", figsize=(200, 200)),
164177
)
165178
166-
.. image:: https://github.com/embodied-computation-group/systole/blob/dev/source/images/hrv.png
179+
.. image:: https://github.com/embodied-computation-group/systole/blob/dev/docs/source/images/hrv.png
167180
:align: center
168181

169182

@@ -174,6 +187,34 @@ The package natively supports recording of physiological signals from the follow
174187
- `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).
175188
- Remote Data Access (RDA) via BrainVision Recorder together with `Brain product ExG amplifier <https://www.brainproducts.com/>`_ (Ethernet).
176189

190+
Interactive visualization of BIDS structured datasets
191+
=====================================================
192+
193+
.. code-block:: python
194+
195+
from systole.viewer import Viewer
196+
197+
view = Viewer(
198+
input_folder="/BIDS/folder/path/",
199+
pattern="task-mytask",
200+
modality="beh",
201+
signal_type="ECG"
202+
)
203+
204+
.. image:: https://github.com/embodied-computation-group/systole/blob/dev/docs/source/images/editor.gif
205+
:align: center
206+
207+
Inserting and removing peaks
208+
============================
209+
210+
.. image:: https://github.com/embodied-computation-group/systole/blob/dev/docs/source/images/peaks.gif
211+
:align: center
212+
213+
Annotating bad segments
214+
=======================
215+
216+
.. image:: https://github.com/embodied-computation-group/systole/blob/dev/docs/source/images/segments.gif
217+
:align: center
177218

178219
Development
179220
+++++++++++
@@ -182,13 +223,6 @@ This module was created and is maintained by Nicolas Legrand and Micah Allen (EC
182223

183224
This program is provided with NO WARRANTY OF ANY KIND.
184225

185-
Contributors
186-
++++++++++++
187-
188-
- Jan C. Brammer ([email protected])
189-
- Gidon Levakov ([email protected])
190-
- Peter Doggart ([email protected])
191-
192226
Acknowledgements
193227
++++++++++++++++
194228

@@ -200,7 +234,7 @@ Systole was largely inspired by pre-existing toolboxes dedicated to heartrate va
200234

201235
* hrv: https://github.com/rhenanbartels/hrv
202236

203-
* pyHVR: https://pyhrv.readthedocs.io/en/latest/index.html
237+
* pyHRV: https://pyhrv.readthedocs.io/en/latest/index.html
204238

205239
* ECG-detector: https://github.com/berndporr/py-ecg-detectors
206240

@@ -212,11 +246,11 @@ Systole was largely inspired by pre-existing toolboxes dedicated to heartrate va
212246

213247
|AU| |lundbeck| |lab|
214248

215-
.. |AU| image:: https://github.com/embodied-computation-group/systole/raw/dev/source/images/au_clinisk_logo.png
249+
.. |AU| image:: https://github.com/embodied-computation-group/systole/blob/dev/docs/source/images/au_clinisk_logo.png
216250
:width: 100%
217251

218-
.. |lundbeck| image:: https://github.com/embodied-computation-group/systole/raw/dev/source/images/lundbeckfonden_logo.png
252+
.. |lundbeck| image:: https://github.com/embodied-computation-group/systole/blob/dev/docs/source/images/lundbeckfonden_logo.png
219253
:width: 10%
220254

221-
.. |lab| image:: https://github.com/embodied-computation-group/systole/raw/dev/source/images/LabLogo.png
255+
.. |lab| image:: https://github.com/embodied-computation-group/systole/blob/dev/docs/source/images/LabLogo.png
222256
:width: 20%

codecov.yml

+2-21
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,2 @@
1-
codecov:
2-
token: 11a4b360-4894-4ef4-9f7c-c6d2858453c0
3-
require_ci_to_pass: yes
4-
5-
coverage:
6-
precision: 2
7-
round: down
8-
range: "70...100"
9-
10-
status:
11-
project: yes
12-
patch: yes
13-
changes: no
14-
15-
parsers:
16-
gcov:
17-
branch_detection:
18-
conditional: yes
19-
loop: yes
20-
method: no
21-
macro: no
1+
ignore:
2+
- "./systole/tests/*"
File renamed without changes.

0 commit comments

Comments
 (0)