Skip to main content

A biological signal processing and feature extraction library.

Project description

BIOBSS

Python versions downloads PyPI version
License: MIT Build status Code style: black

A package for processing signals recorded using wearable sensors, such as Electrocardiogram (ECG), Photoplethysmogram (PPG), Electrodermal activity (EDA) and 3-axis acceleration (ACC).

BIOBSS's main focus is to generate end-to-end pipelines by adding required processes from BIOBSS or other Python packages. Some preprocessing methods were not implemented from scratch but imported from the existing packages.

Main features:

  • Applying basic preprocessing steps (*)
  • Assessing quality of PPG and ECG signals
  • Extracting features for ECG, PPG, EDA and ACC signals
  • Performing Heart Rate Variability (HRV) analysis using PPG or ECG signals
  • Extracting respiratory signals from PPG or ECG signals and estimating respiratory rate (*)
  • Calculating activity indices from ACC signals
  • Generating and saving pipelines

(*): Not all methods were implemented from scratch but imported from existing packages.

The table shows the capabilites of BIOBSS and the other Python packages for physiological signal processing.

Functionality BIOBSS BioSPPy HeartPy HRV hrv-analysis pyHRV pyPhysio PySiology Neurokit2 FLIRT
File reader
Sliding window
Preprocessing
Pipeline ✓(*)
Processing ECG
PPG
IBI / RRI
EDA
ACC
Feature Extraction ECG
PPG
EDA
ACC

(*): Pipeline module differs between the two packages. BIOBSS pipeline aims to provide a more flexible and customizable pipeline for the user.

Modified from Föll, Simon, et al. “FLIRT: A feature generation toolkit for wearable data.” Computer Methods and Programs in Biomedicine 212 (2021): 106461.

You can also read the blog post about BIOBSS.

Preprocessing

BIOBSS has modules with basic signal preprocessing functionalities. These include:

  • Resampling
  • Segmentation
  • Normalization
  • Filtering (basic filtering functions with commonly used filter parameters for each signal type)
  • Peak detection

Visualization

BIOBSS has basic plotting modules specific to each signal type. Using the modules, the signals and peaks can be plotted using Matplotlib or Plotly packages.

Signal Quality Assessment

Signal quality assessment steps listed below can be used with PPG and ECG signals.

  • Clipping detection
  • Flatline detection
  • Physiological checks
  • Morphological checks
  • Template matching

Feature Extraction

Signal Domain / Type Features
ECG Time Morphological features related to fiducial point locations and amplitudes
PPG Time Morphological features related to fiducial point locations and amplitudes, zero-crossing rate, signal to noise ratio
Frequency Amplitude and frequency of FFT peaks, signal power
Statistical Mean, median, standard deviation, percentiles, mean absolute deviation, skewness, kurtosis, entropy
VPG Time Morphological features related to fiducial point locations and amplitudes
APG Time Morphological features related to fiducial point locations and amplitudes
ACC Frequency Mean, median, standard deviation, min, max, range, mean absolute deviation, median absolute deviation, interquartile range, skewness, kurtosis, energy, entropy of fft signal; fft-peak related features and signal power
Statistical Mean, median, standard deviation, min, max, range, mean absolute deviation, median absolute deviation, interquartile range, skewness, kurtosis, energy, momentum of ACC signals; peak related features
Correlation Correlation of ACC signals of different axes
EDA Time Rms, acr length, integral, average power
Frequency FFT peak related features, energy, entropy of fft signal
Statistical Mean, standard deviation, min, max, range, kurtosis, skewness, momentum
Hjorth Activity, complexity, mobility

Heart Rate Variability Analysis

Heart rate variability analysis can be performed with BIOBSS and the parameters given below can be calculated for PPG or ECG signals.

Domain Parameters
Time-domain mean_nni, sdnn, rmssd, sdsd, nni_50, pnni_50, nni_20, pnni_20, cvnni, cvsd, median_nni, range_nni mean_hr, min_hr, max_hr, std_hr, mad_nni, mcv_nni, iqr_nni
Frequency-domain vlf, lf, hf, lf_hf_ratio, total_power, lfnu, hfnu, lnLF, lnHF, vlf_peak, lf_peak, hf_peak
Nonlinear SD1, SD2, SD2_SD1, CSI, CVI, CSI_mofidied, ApEn, SampEn

Activity Indices

BIOBSS has functionality to calculate activity indices from 3-axis acceleration signals. These indices are:

  • Proportional Integration Method (PIM)
  • Zero Crossing Method (ZCM)
  • Time Above Threshold (TAT)
  • Mean Amplitude Deviation (MAD)
  • Euclidian Norm Minus One (ENMO)
  • High-pass Filtered Euclidian (HFEN)
  • Activity Index (AI)

Reference: https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0261718

The preprocessing steps which should be applied on the raw acceleration differs for each of the activity indices listed above. In other words, each activity index can be calculated only from specific datasets. These datasets can be generated using BIOBSS both independently or as a part of activity index calculation pipeline.

The generated datasets are:

  • UFXYZ: unfiltered acc signals
  • UFM: magnitude of unfiltered acc signals
  • UFM_modified: modified magnitude of unfiltered signals (absolute(UFM-length(UFM)))
  • UFNM: normalized magnitude of unfiltered acc signals
  • FXYZ: filtered acc signals
  • FXYZ_modified: modified filtered acc signals (absolute(FXYZ))
  • FMpre: magnitude of filtered acc signals
  • SpecialXYZ: filtered acc signals (special filter parameters)
  • SpecialM: magnitude of filtered acc signals (special filter parameters)
  • FMpost: filtered magnitude of acc signals
  • FMpost_modified: modified of filtered magnitude of acc signals (absolute(FMpost))

Respiratory Analysis

BIOBSS has modules to perform basic respiratory analyses. The functionalities are:

  • Preprocessing PPG or ECG signals for respiratory analysis using predefined filter parameters
  • Extracting respiratory signals from modulations (amplitude modulation, frequency modulation, baseline wander) in PPG or ECG signals
  • Estimating respiratory rate from the extracted respiratory signals
  • Calculation respiratory quality indices (RQI)
  • Fusing respiratory rate estimates

Pipeline Generation

The main focus of BIOBSS is to generate and save pipelines for signal processing and feature extraction problems. Thus, it is aimed to :

  • Simplify the preprocessing procedures by generating signal and event channels
  • Make it easy to use processes
  • Decrease the amount of work for repetitive processes and for those who work on multiple datasets
  • Make it possible to save and share pipelines to compare results of different works



To learn more, visit the Documentation page.

Installation

Through pip,

pip install biobss

or build from source,

git clone https://github.com/obss/biobss.git
cd BIOBSS
python setup.py install

Dependencies

  • neurokit2
  • antropy
  • cvxopt
  • heartpy
  • scipy
  • py_ecg_detectors

Tutorial notebooks

  • PPG Signal Processing Open In Colab
  • ECG Signal Processing Open In Colab
  • ACC Signal Processing Open In Colab
  • HRV Analysis Open In Colab
  • Respiratory Analysis Open In Colab

License

Licensed under the MIT License.

Contributing

If you have ideas for improving existing features or adding new features to BIOBSS, please contact us.

Contributors

Çağatay Taşcı

İpek Karakuş

Devrim Çavuşoğlu

Fatih Çağatay Akyön

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

biobss-0.1.1.tar.gz (83.6 kB view details)

Uploaded Source

Built Distribution

biobss-0.1.1-py3-none-any.whl (117.2 kB view details)

Uploaded Python 3

File details

Details for the file biobss-0.1.1.tar.gz.

File metadata

  • Download URL: biobss-0.1.1.tar.gz
  • Upload date:
  • Size: 83.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for biobss-0.1.1.tar.gz
Algorithm Hash digest
SHA256 56f1378a449aa48bc862ba1dccb35af3ef9880ef6c9232f6ab7c6b6421944c9f
MD5 8fb957e249adc58b75235d3ac3df835f
BLAKE2b-256 76bd568903506cc2e68a3a941af56167a3614f3beb702c4e183efdcbb336c811

See more details on using hashes here.

File details

Details for the file biobss-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: biobss-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 117.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for biobss-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f8d385b9ed7743a91d7bede7c7d370e3c622a84d2e42e5be8340d90f1f4d9e4c
MD5 8c4d69c59f88889de2d0377deffb04d5
BLAKE2b-256 aca6aa846bd6c1ed2be257f414b9cba6b1db86b9e4ecfe951f59df799e9296d1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page