emg-toolbox


Nameemg-toolbox JSON
Version 1.1.0 PyPI version JSON
download
home_pagehttps://github.com/your_username/your_repository
SummaryEMG 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.
upload_time2024-10-20 14:00:01
maintainerNone
docs_urlNone
authorLinus Zhang
requires_python>=3.6
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # EMG Toolbox

<img src="./assets/logo.webp" style="zoom:50%;" />

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.

[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.13957415.svg)](https://doi.org/10.5281/zenodo.13957415)
## 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:

```bash
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

```python
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

```python
# Create random sEMG signal example
data = np.random.randn(1000)
fs = 1000  # Sampling frequency 1000 Hz
```

### 3. Sliding Window Feature Extraction

```python
# 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

```python
# 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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/your_username/your_repository",
    "name": "emg-toolbox",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "Linus Zhang",
    "author_email": "products@wearlab.tech",
    "download_url": "https://files.pythonhosted.org/packages/92/f5/d00206c5d7cf0f76b4b7f0e8494d9bc1d30da9afe69440603b3d7ab6c2cf/emg_toolbox-1.1.0.tar.gz",
    "platform": null,
    "description": "# EMG Toolbox\r\n\r\n<img src=\"./assets/logo.webp\" style=\"zoom:50%;\" />\r\n\r\nEMG 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.\r\n\r\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.13957415.svg)](https://doi.org/10.5281/zenodo.13957415)\r\n## Features\r\n\r\n- Various EMG feature extraction methods: Root Mean Square (RMS), Mean Absolute Value (MAV), Zero Crossing (ZC), Waveform Length (WL), Slope Sign Change (SSC), etc.\r\n- Signal filtering: Supports Butterworth filter and powerline interference filter.\r\n- Visualisation tools: Includes plotting functions for time-domain signals, frequency spectra, and power spectral density.\r\n- Supports sliding window processing and multithreaded computation to improve feature extraction efficiency.\r\n\r\n## Installation\r\n\r\nInstall EMG Toolbox using pip:\r\n\r\n```bash\r\npip install emg-toolbox\r\n```\r\n\r\n## Quick Start\r\n\r\nBelow is an example of how to use EMG Toolbox for basic EMG signal processing and feature extraction:\r\n\r\n### 1. Import Modules\r\n\r\n```python\r\nimport numpy as np\r\nfrom emg_toolbox.features import sliding_window, fRMS, fMAV, fZC\r\nfrom emg_toolbox.plots import plot_time_domain_signal\r\n```\r\n\r\n### 2. Generate Example Data\r\n\r\n```python\r\n# Create random sEMG signal example\r\ndata = np.random.randn(1000)\r\nfs = 1000  # Sampling frequency 1000 Hz\r\n```\r\n\r\n### 3. Sliding Window Feature Extraction\r\n\r\n```python\r\n# Calculate RMS feature using sliding window\r\nwindow_size = 200\r\nstep_size = 100\r\nrms_values = sliding_window(data, window_size, step_size, fRMS)\r\nprint(f\"RMS (Sliding Window): {rms_values}\")\r\n```\r\n\r\n### 4. Plot Time-Domain Signal\r\n\r\n```python\r\n# Plot time-domain signal\r\nplot_time_domain_signal(data, fs)\r\n```\r\n\r\n## Module Overview\r\n\r\n### 1. `features.py` - Feature Extraction\r\n\r\n`features.py` provides a series of functions for extracting features from EMG signals, such as:\r\n\r\n- `fRMS(data)`: Calculates the root mean square.\r\n- `fMAV(data)`: Calculates the mean absolute value.\r\n- `fZC(data, dead_zone)`: Calculates zero crossings.\r\n- Other features include median frequency, mean power frequency, spectral entropy, etc.\r\n\r\nThe `sliding_window` function can be used to segment the signal and calculate features.\r\n\r\n### 2. `plots.py` - Plotting Tools\r\n\r\n`plots.py` offers several plotting tools for visualising EMG signals:\r\n\r\n- `plot_time_domain_signal(raw, fs)`: Plots the time-domain signal.\r\n- `plot_frequency_spectrum(raw, fs)`: Plots the frequency spectrum.\r\n- `plot_power_spectral_density(raw, fs)`: Plots the power spectral density.\r\n\r\n### 3. `filters.py` - Filters\r\n\r\n`filters.py` includes a powerline interference filter (`PlifEegSubtractFilter`) to reduce powerline interference in EMG signals.\r\n\r\n## Contribution\r\n\r\nIf you would like to contribute to EMG Toolbox, please fork this repository and submit a pull request. Bug reports and feature suggestions are welcome!\r\n\r\n## License\r\n\r\nGPL License\r\n\r\n## Contact\r\n\r\nIf you have any questions or suggestions, please contact me:\r\n\r\n- Email: products@wearlab.tech\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "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.",
    "version": "1.1.0",
    "project_urls": {
        "Homepage": "https://github.com/your_username/your_repository"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e29a7afbfb51ff02a00c135c17a2a7caf6523936aec2472465a19ec5f18b4663",
                "md5": "c718117681617ef3f0d951bc7af68fd9",
                "sha256": "e2fc35936063ef4421e9409ca79846bef3daf6e4c2704f806b91f1c12d891ed9"
            },
            "downloads": -1,
            "filename": "emg_toolbox-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c718117681617ef3f0d951bc7af68fd9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 13797,
            "upload_time": "2024-10-20T13:59:59",
            "upload_time_iso_8601": "2024-10-20T13:59:59.749905Z",
            "url": "https://files.pythonhosted.org/packages/e2/9a/7afbfb51ff02a00c135c17a2a7caf6523936aec2472465a19ec5f18b4663/emg_toolbox-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "92f5d00206c5d7cf0f76b4b7f0e8494d9bc1d30da9afe69440603b3d7ab6c2cf",
                "md5": "0c065816dba6f3015406662211cbeaa0",
                "sha256": "99479eebdfb300b0829770bca9a7a1648df6b862ffee0f5c494ddc0c922d32c5"
            },
            "downloads": -1,
            "filename": "emg_toolbox-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "0c065816dba6f3015406662211cbeaa0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 9321,
            "upload_time": "2024-10-20T14:00:01",
            "upload_time_iso_8601": "2024-10-20T14:00:01.601927Z",
            "url": "https://files.pythonhosted.org/packages/92/f5/d00206c5d7cf0f76b4b7f0e8494d9bc1d30da9afe69440603b3d7ab6c2cf/emg_toolbox-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-20 14:00:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "your_username",
    "github_project": "your_repository",
    "github_not_found": true,
    "lcname": "emg-toolbox"
}
        
Elapsed time: 0.47361s