ReSurfEMG

ReSurfEMG: A Python library for preprocessing and analysis of respiratory EMG. - Published in JOSS (2023)

https://github.com/resurfemg-org/ReSurfEMG

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README
  • Academic publication links
    Links to: joss.theoj.org, zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.3%) to scientific vocabulary

Keywords

electromyogram electromyography healthcare-analysis

Scientific Fields

Artificial Intelligence and Machine Learning Computer Science - 69% confidence
Neuroscience Life Sciences - 63% confidence
Last synced: 4 months ago · JSON representation ·

Repository

An open source library for analysis of respiratory EMG

Basic Info
  • Host: GitHub
  • Owner: resurfemg-org
  • License: apache-2.0
  • Language: Jupyter Notebook
  • Default Branch: main
  • Homepage:
  • Size: 208 MB
Statistics
  • Stars: 19
  • Watchers: 2
  • Forks: 11
  • Open Issues: 6
  • Releases: 21
Topics
electromyogram electromyography healthcare-analysis
Created over 3 years ago · Last pushed 4 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Citation Security

README.md

DOI PyPI Sanity Sanity License CII Best Practices fair-software.eu status OpenSSF Scorecard codecov

ReSurfEMG is an open source collaborative python library for analysis of respiratory electromyography (EMG). On the same site as the repository for this library we keep related resources.

ReSurfEMG includes a main code library where the user can access the code to change various filter and analysis settings directly and/or in our researcher interface notebooks. In addition, ReSurfEMG has a dashboard interface which contains default settings for preprocessing and analysis which can be changed through a graphical (no code) interface. We have some functionality available through a command line interface as well.

The library was initially built for surface EMG, however many functions will also work for invasively measured respiratory EMG. This library supports the ongoing research at University of Twente on respiratory EMG.

Program files

The core functions of ReSurfEMG are in the folder resurfemg:

  • cli: Scripts for the command line interface
  • data_connector: Converter functions for discovering, loading, simulating and handling data.
  • helper_functions: General functions to support the functions in this repository
  • preprocessing: Process the raw respiratory EMG signal
    • filtering: low-, high- and bandpass filters, notch filter, computer power loss
    • ecg-removal: gating and wavelet denoising
    • envelope: root-mean-square (RMS), average rectified (ARV)
  • postprocessing: Aspects of pre-processed the respiratory EMG data:
    • moving baselines
    • event detection: find pneumatic and EMG breaths, on- and offset detection
    • features: amplitude, area under the curve, slope, area under the baseline, respiratory rate
    • quality assessment: signal-to-noise ratio, end-expiratory occlussion manoeuvre quality, interpeak distance, area under the baseline, consecutive manoeuvres, bell-curve error, relative peak timing, relative area under the baseline, relative ETP

Folders and Notebooks

Our guide to notebooks is under construction. To look around keep in mind the following distinction on folders:

dev: - These notebooks are used in feature development and debugging by core members of the ReSurfEMG team. They can provide a basic example how to use some of the functionality.

open_work: - This folder contains experimental work by core members of the ReSurfEMG team that is not deployed yet.

researcher_interface: - These are a growing series of interactive notebooks that allow researchers to investigate questions about their own EMG data

Data sets

The notebooks are configured to run on various datasets. Contact Dr. Eline Mos-Oppersma( 📫 e.mos-oppersma@utwente.nl) to discuss any questions on data configuration for your datasets.

If you want to use a standardized dataset for any purpose we recommend the data in the ReSurfEMG/test_data, which is also used in testing the ReSurfEMG functions. Data there can be used with any respiratory EMG algorithms in any program. Thus that data can function as a benchmarking set to compare algorithms across different programs.

Alternatively, the data in the ReSurfEMG/synthetic_data repository:

DOI

Configuring (to work with your data)

In order to preprocess and/or to train models the code needs to be able to locate the raw data you want it to find.

There are several ways to specify the location of the following directories:

  • root_data: Special directory. The rest of the directory layout can be derived from its location.
  • preprocessed_data: The directory that will be used by preprocessing code to output to.
  • test_data: The directory for running sanity tests.

You can store this information persistently in several locations.

  1. In the same directory where you run the script (or the notebook). e.g. ./config.json.
  2. In home directory, e.g. ~/.resurfemg/config.json.
  3. In global directory, e.g. /etc/resurfemg/config.json.

However, we highly recommend using the home directory. This file can have this or similar contents: { "root_data": "/mnt/data", "patient_data": "/mnt/patient_data", "simulated_data": "/mnt/simulated_data", "preprocessed_data": "/mnt/data/preprocessed", "output_data": "/mnt/data/output", } The file is read as follows: if the files specifies root_data directory, then the missing entries are assumed to be relative to the root. You do not need to specify all entries.

Test data

Test data is provided in the repository in the test_data folder.

Supported Platforms

ReSurfEMG is a pure Python package. Below is the list of platforms that should work. Other platforms may work, but have had less extensive testing. Please note that where python.org Python stated as supported, it means that versions 3.9 - 3.12 are supported.

AMD64 (x86)

| | Linux | Win | OSX | |:---------------------------:|:---------:|:---------:|:---------:| | p | Supported | Supported | Supported | | a | Discontinued | Discontinued | Discontinued |

Installation for all supported platforms

Installation with Anaconda/conda and/or mamba are the preffered methods. They are covered in the "Getting Started" section. If you wish to install with pip:

  1. Create and activate a virtual environment (see developer setup section for more details)
  2. Install ResurfEMG package by running pip install resurfemg.

Getting Started

With the recommended Python venv setup

How to get the notebooks running? Assuming the raw data set and metadata is available.

0a. Create a virtual environment using Python

#### On Linux/OSX: sh python3 -m venv .venv

This might require the python3-venv.

#### On Windows: sh python -m venv .venv

0b. Activate the virtual environment and install ReSurfEMG

#### On Linux/OSX: sh source .venv/bin/activate pip install resurfemg[dev]

#### On Windows: sh .venv\Scripts\activate.bat pip install resurfemg[dev]

1. Open a notebook

Start a local Jupyter Notebook server by running the jupyter notebook command in your terminal. This opens a browser window where you can browse, open and run the notebooks. (We use Jupyter notebooks) The ReSurfEMG notebooks are located in the notebooks folder. Navigate there and open a notebook of interest. The basicemganalysis notebook can be used to understand how to use the package.

Advanced contributor's setup / "Developer's setup"

We distinguish between people who want to use this library in their own code and/or analysis, and people who also want to develop this library who we call developers, be it as members of our team or independent contributors. People who simply want to use our library need to install the packaged version from one of the package indexes to which we publish released versions (eg. PyPI). This section of the readme is for advanced developers who want to modify the library code (and possibly contribute their changes back or eventually publish thier own modified fork). NB: You can accomplish modifications of the code, submit pull-requests (PRs) and soforth without a 'developer's setup' but we feel this setup will make advanced contributions easier.

We have transitioned to a fully Python 3.9+ environment. (For older instructions with venv please see versions below 0.2.0, and adapt them if using Windows and/or a different Python version than Python.org Python. e.g. you may need to use .venv\Scripts\activate.bat in place of .venv/bin/activate) The instructions below are for our newer versions above 1.0.0. This will create a distributable package from the source code, then install it in the currently active environment. This will also install development tools we use s.a. pytest and codestyle and will also install tools we use for working with the library, such as jupyter.

On Linux/OSX:

sh python3 -m venv .venv source .venv/bin/activate pip install -e .[dev]

On Windows:

sh python -m venv .venv .venv\Scripts\activate.bat pip install -e .[dev]

These installs differ in two ways from the regular install: 1) The .[dev] (as compared to resurfemg[dev]) installs the library as it currently is including all your local changes, instead of pulling it from the PyPI repository. 2) The -e flag ensures an editable install, such that any changes to the library are automatically applied to your environment.

Now you should have everything necessary to start working on the source code.

Generating documentation

Online documentation can be found at https://resurfemg-org.github.io/ReSurfEMG/ or on https://readthedocs.org/ by searching for ReSurfEMG. Up-to-date documentation can be generated in command-line as follows in terminal:

On Linux/OSX:

sh python3 -m venv .venv source .venv/bin/activate pip install -e .[docs] python setup.py apidoc python setup.py build_sphinx

On Windows:

sh python -m venv .venv .venv\Scripts\activate.bat pip install -e .[docs] python setup.py apidoc python setup.py build_sphinx

Automation

The project comes with several modifications to the typical default setup.py.

The project has a sub-project of a related dashboard. Dashboard is a GUI that exposes some of the project's functionality. In the past, we kept a a legacy dashboard in the same repository with ReSurfEMG code but we have deleted it. The current version of the dashboard into it's own repository: https://github.com/resurfemg-org/ReSurfEMG-dashboard

New commands

  • isort resurfemg --check --diff checks that the imports are properly formatted and sorted.
  • python setup.py apidoc generates RST outlines necessary to generate documentation.

Testing

The project includes testing data. This test data is synthetic and generated by the ReSurfEMG data_connector.synthetic_data methods.

On Linux/OSX:

sh python3 -m venv .venv source .venv/bin/activate pip install -e .[tests] pytest

On Windows:

sh python -m venv .venv .venv\Scripts\activate.bat pip install -e .[tests] pytest

Test coverage can be obtained via:

sh coverage run -m pytest coverage report

Command-Line Interface

You will be able to preprocess data using command-line interface. You can also, in some cases, create files in the correct format for our Dashboard in a per folder batch process.

You can make synthetic data. To explore this start with

`python -m resurfemg simulate_emg --help`

`python -m resurfemg simulate_ventilator --help`

✨Copyright 2022 Netherlands eScience Center and U. Twente Licensed under the Apache License, version 2.0. See LICENSE for details.✨

Owner

  • Name: ReSurfEMG
  • Login: resurfemg-org
  • Kind: organization

Transforming surface electromyography into clinical insights

Citation (CITATION.cff)

cff-version: 1.0.1
title: ReSurfEMG
message: "Please cite as below, if you use this software "
type: software
authors:
  -
    affiliation: "University of Twente"
    family-names: Warnaar
    given-names: Robertus (Rob) Simon Petrus
    orcid: "https://orcid.org/0000-0001-9443-4069"
  -
    affiliation: "Netherlands eScience Center"
    family-names: Moore
    given-names: Candace Makeda
    orcid: "https://orcid.org/0000-0003-1672-7565"
  -
    affiliation: "Netherlands eScience Center"
    family-names: Baccinelli
    given-names: Walter
    orcid: "https://orcid.org/0000-0001-8888-4792"
  -
    affiliation: "Bright Computing/NVIDIA"
    family-names: Sivokon
    given-names: Oleg 
  -
    affiliation: "University of Twente"
    family-names: Soleimani
    given-names: Farnaz
    orcid: "https://orcid.org/0009-0003-3300-506X"
  -
    affiliation: "University of Twente"
    family-names: Oppersma
    given-names: Eline
    orcid: "https://orcid.org/0000-0002-0150-306X"

repository-code: 'https://github.com/resurfemg-org/ReSurfEMG'
repository-artifact: 'https://pypi.org/project/resurfemg/'

keywords:
  - electromyography
  - EMG
  - respiratory
  - Python
  - surface EMG
  - sEAdi
license: Apache-2.0
version: "1.0.1"
date-released: 10/12/2024

GitHub Events

Total
  • Create event: 17
  • Issues event: 8
  • Release event: 1
  • Watch event: 5
  • Delete event: 4
  • Issue comment event: 3
  • Push event: 51
  • Pull request review comment event: 3
  • Pull request review event: 11
  • Pull request event: 26
  • Fork event: 6
Last Year
  • Create event: 17
  • Issues event: 8
  • Release event: 1
  • Watch event: 5
  • Delete event: 4
  • Issue comment event: 3
  • Push event: 51
  • Pull request review comment event: 3
  • Pull request review event: 11
  • Pull request event: 26
  • Fork event: 6

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 1,089
  • Total Committers: 13
  • Avg Commits per committer: 83.769
  • Development Distribution Score (DDS): 0.502
Past Year
  • Commits: 205
  • Committers: 4
  • Avg Commits per committer: 51.25
  • Development Distribution Score (DDS): 0.093
Top Committers
Name Email Commits
Candace Makeda Moore, MD 3****e 542
rspwarnaarUT r****r@u****l 365
ElineOppersma e****a@u****l 77
wvxvw o****n@g****m 42
Walter Baccinelli w****i@e****l 27
Rob Warnaar w****b@g****m 19
FarSoleimani 5****i 8
ReSurfEMG 1****G 2
Oleg Sivokon o****n@b****m 2
Mos-Oppersma e****a@u****l 2
ElshofJ j****f@u****l 1
AJQuinn A****n 1
t_barth t****h@s****e 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 7
  • Total pull requests: 63
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 11 days
  • Total issue authors: 5
  • Total pull request authors: 8
  • Average comments per issue: 0.14
  • Average comments per pull request: 0.19
  • Merged pull requests: 55
  • Bot issues: 0
  • Bot pull requests: 2
Past Year
  • Issues: 6
  • Pull requests: 23
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 19 days
  • Issue authors: 4
  • Pull request authors: 5
  • Average comments per issue: 0.17
  • Average comments per pull request: 0.22
  • Merged pull requests: 16
  • Bot issues: 0
  • Bot pull requests: 2
Top Authors
Issue Authors
  • SGeraats (2)
  • rspwarnaarUT (2)
  • ReSurfEMG (1)
  • ElineOppersma (1)
  • drcandacemakedamoore (1)
Pull Request Authors
  • rspwarnaarUT (42)
  • ElineOppersma (13)
  • drcandacemakedamoore (3)
  • ReSurfEMG (3)
  • TE-2 (2)
  • dependabot[bot] (2)
  • FarSoleimani (1)
  • ghost (1)
Top Labels
Issue Labels
Pull Request Labels
dependencies (2) github_actions (2)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 89 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 26
  • Total maintainers: 2
pypi.org: resurfemg

A package for analysis of respiratory EMG data

  • Versions: 26
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 89 Last month
Rankings
Dependent packages count: 7.3%
Downloads: 14.6%
Forks count: 15.4%
Average: 15.6%
Stargazers count: 18.5%
Dependent repos count: 22.1%
Maintainers (2)
Last synced: 4 months ago

Dependencies

.github/workflows/on-commit.yml actions
  • JamesIves/github-pages-deploy-action 4.1.1 composite
  • actions/checkout v3 composite
  • addnab/docker-run-action v3 composite
  • fair-software/howfairis-github-action 0.2.1 composite
  • s-weigand/setup-conda v1 composite
.github/workflows/on-tag.yml actions
  • actions/checkout v2 composite
  • actions/download-artifact v2 composite
  • actions/setup-python v1 composite
  • actions/upload-artifact v2 composite
  • marvinpinto/action-automatic-releases latest composite
  • s-weigand/setup-conda v1.1.1 composite
.helpers/Dockerfile docker
  • python 3.9 build
notes_tmsisdk/requirements_Linux.txt pypi
  • Pillow ==8.3.2
  • PySide2 ==5.15.2
  • Pygments ==2.10.0
  • backcall ==0.2.0
  • cloudpickle ==2.0.0
  • colorama ==0.4.4
  • cycler ==0.10.0
  • decorator ==5.1.0
  • entrypoints ==0.3
  • ipykernel ==5.5.6
  • ipython ==7.16.1
  • ipython-genutils ==0.2.0
  • jedi ==0.18.0
  • jupyter-client ==6.2.0
  • jupyter-core ==4.8.1
  • kiwisolver ==1.3.1
  • matplotlib ==3.3.4
  • mne ==0.23.4
  • nest-asyncio ==1.5.1
  • numpy ==1.19.5
  • pandas ==1.1.5
  • parso ==0.8.2
  • pexpect ==4.8.0
  • pickleshare ==0.7.5
  • prompt-toolkit ==3.0.20
  • ptyprocess ==0.7.0
  • pylsl ==1.15.0
  • pyparsing ==2.4.7
  • pyqtgraph ==0.11.1
  • python-dateutil ==2.8.2
  • pytz ==2021.3
  • pyxdf ==1.16.3
  • pyzmq ==22.3.0
  • scipy ==1.5.4
  • shiboken2 ==5.15.2
  • six ==1.16.0
  • spyder-kernels ==2.1.3
  • tornado ==6.1
  • traitlets ==4.3.3
  • wcwidth ==0.2.5
  • wurlitzer ==3.0.2
notes_tmsisdk/requirements_Windows.txt pypi
  • Pillow ==8.3.2
  • PySide2 ==5.15.2
  • Pygments ==2.10.0
  • backcall ==0.2.0
  • cloudpickle ==2.0.0
  • colorama ==0.4.4
  • cycler ==0.10.0
  • debugpy ==1.5.0
  • decorator ==5.1.0
  • entrypoints ==0.3
  • ipykernel ==6.4.1
  • ipython ==7.28.0
  • ipython-genutils ==0.2.0
  • jedi ==0.18.0
  • jupyter-client ==7.0.6
  • jupyter-core ==4.8.1
  • kiwisolver ==1.3.2
  • matplotlib ==3.4.3
  • matplotlib-inline ==0.1.3
  • mne ==0.23.4
  • nest-asyncio ==1.5.1
  • numpy ==1.21.2
  • pandas ==1.3.3
  • parso ==0.8.2
  • pickleshare ==0.7.5
  • prompt-toolkit ==3.0.20
  • pylsl ==1.15.0
  • pyparsing ==2.4.7
  • pyqtgraph ==0.12.3
  • python-dateutil ==2.8.2
  • pytz ==2021.3
  • pywin32 ==302
  • pyxdf ==1.16.3
  • pyzmq ==22.3.0
  • scipy ==1.7.1
  • shiboken2 ==5.15.2
  • six ==1.16.0
  • spyder-kernels ==1.9.4
  • tornado ==6.1
  • traitlets ==5.1.0
  • wcwidth ==0.2.5
setup.py pypi
  • h5py *
  • matplotlib *
  • mne ==0.23.4
  • pandas *
  • pyxdf *
  • scikit-learn ==1.1.1
  • scipy *
  • textdistance *
environment.yml conda
  • ipympl
  • ipywidgets 7.7.0.*
  • jupyter 1.0.0.*
  • matplotlib 3.3.3.*
  • mne 0.23.4.*
  • neurokit2 0.2.7.*
  • notebook 6.4.10.*
  • numexpr 2.7.3.*
  • numpy 1.22.3.*
  • pandas
  • pip 20.2.*
  • pycodestyle
  • python 3.9.*
  • pyxdf
  • scikit-learn 1.1.1.*
  • scipy 1.7.1.*
  • sphinx 4.5.0.*
  • textdistance 4.2.1.*
  • tk 8.6.12.*