EMG Toolbox is a Python toolkit for processing and analysing surface electromyography (sEMG) data. It includes a variety of feature extraction methods, signal filtering, and plotting functions, helping users efficiently preprocess and analyse EMG signals.
Project description
EMG Toolbox
EMG Toolbox is a Python toolkit for processing and analysing surface electromyography (sEMG) data. It includes a variety of feature extraction methods, signal filtering, and plotting functions, helping users efficiently preprocess and analyse EMG signals.
Features
- Various EMG feature extraction methods: Root Mean Square (RMS), Mean Absolute Value (MAV), Zero Crossing (ZC), Waveform Length (WL), Slope Sign Change (SSC), etc.
- Signal filtering: Supports Butterworth filter and powerline interference filter.
- Visualisation tools: Includes plotting functions for time-domain signals, frequency spectra, and power spectral density.
- Supports sliding window processing and multithreaded computation to improve feature extraction efficiency.
Installation
Install EMG Toolbox using pip:
pip install emg-toolbox
Quick Start
Below is an example of how to use EMG Toolbox for basic EMG signal processing and feature extraction:
1. Import Modules
import numpy as np
from emg_toolbox.features import sliding_window, fRMS, fMAV, fZC
from emg_toolbox.plots import plot_time_domain_signal
2. Generate Example Data
# Create random sEMG signal example
data = np.random.randn(1000)
fs = 1000 # Sampling frequency 1000 Hz
3. Sliding Window Feature Extraction
# Calculate RMS feature using sliding window
window_size = 200
step_size = 100
rms_values = sliding_window(data, window_size, step_size, fRMS)
print(f"RMS (Sliding Window): {rms_values}")
4. Plot Time-Domain Signal
# Plot time-domain signal
plot_time_domain_signal(data, fs)
Module Overview
1. features.py - Feature Extraction
features.py provides a series of functions for extracting features from EMG signals, such as:
fRMS(data): Calculates the root mean square.fMAV(data): Calculates the mean absolute value.fZC(data, dead_zone): Calculates zero crossings.- Other features include median frequency, mean power frequency, spectral entropy, etc.
The sliding_window function can be used to segment the signal and calculate features.
2. plots.py - Plotting Tools
plots.py offers several plotting tools for visualising EMG signals:
plot_time_domain_signal(raw, fs): Plots the time-domain signal.plot_frequency_spectrum(raw, fs): Plots the frequency spectrum.plot_power_spectral_density(raw, fs): Plots the power spectral density.
3. filters.py - Filters
filters.py includes a powerline interference filter (PlifEegSubtractFilter) to reduce powerline interference in EMG signals.
Contribution
If you would like to contribute to EMG Toolbox, please fork this repository and submit a pull request. Bug reports and feature suggestions are welcome!
License
GPL License
Contact
If you have any questions or suggestions, please contact me:
- Email: products@wearlab.tech
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file emg_toolbox-1.1.0.tar.gz.
File metadata
- Download URL: emg_toolbox-1.1.0.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99479eebdfb300b0829770bca9a7a1648df6b862ffee0f5c494ddc0c922d32c5
|
|
| MD5 |
0c065816dba6f3015406662211cbeaa0
|
|
| BLAKE2b-256 |
92f5d00206c5d7cf0f76b4b7f0e8494d9bc1d30da9afe69440603b3d7ab6c2cf
|
File details
Details for the file emg_toolbox-1.1.0-py3-none-any.whl.
File metadata
- Download URL: emg_toolbox-1.1.0-py3-none-any.whl
- Upload date:
- Size: 13.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2fc35936063ef4421e9409ca79846bef3daf6e4c2704f806b91f1c12d891ed9
|
|
| MD5 |
c718117681617ef3f0d951bc7af68fd9
|
|
| BLAKE2b-256 |
e29a7afbfb51ff02a00c135c17a2a7caf6523936aec2472465a19ec5f18b4663
|