Python package to read OpenSignals (r)evolution files.
Project description
opensignalsreader
Python package to read OpenSignals (r)evolution files and automatic sensor data conversion for BITalino (r)evolution sensor data.
Important: This repository does not contain any code written by PLUX and/or the BITalino team. Use the issue board of the opensignalsreader repository in case you experience any issues using opensignalsreader or if you need any support, instead of contacting PLUX.
Installation
This package can be installed using the pip
tool:
pip install opensignalsreader
Examples & How to Use this Package
This package comes with the OpenSignalsReader class which facilitates the import of sensor signals acquired using the OpenSignals (r)evolution software. Additionally, it does also read and save the most important acquisition metadata.
The examples below demonstrate how to use this class to load OpenSignals files, access signals, access metadata, and how to plot the imported sensor data.
Reading OpenSignals Files
Import OpenSignalsReader class and read OpenSignals file ('SampleECG.txt').
# Import OpenSignalsReader
from opensignalsreader import OpenSignalsReader
# Read OpenSignals file
acq = OpenSignalsReader('SampleECG.txt')
Note, when using the OpenSignalsReader
class in scripts (or other formats), use absolute file paths to ensure that the file will be found and used.
Accessing Sensor Data
Objects of the OpenSignalsReader
class store raw digital sensor values and additionally their conversion into the sensor's original physical units (e.g. ECG -> mV). Use the OpenSignalsReader.raw()
and the OpenSignalsReader.signal()
methods to access the signals.
Accessing individual sensor data (this method returns data in a NumPy array):
# Access single sensor signal using the sensor's channel number
acq.raw(2)
acq.signal(2)
# Access single sensor signal using the sensor's label
acq.raw('ECG')
acq.signal('ECG')
Accessing multiple sensor data (this method returns data in a dictionary with the sensor labels as keys):
# Access multiple sensor signals using the channel numbers (here: channel 1 & 2)
acq.raw([1,2])
acq.signal([1,2])
# Access multiple sensor signals using the sensor labels (here: channel 1 & 2)
acq.raw(['ECG', 'EEG'])
acq.signal(['ECG', 'EEG'])
Plotting Sensor Data
The OpenSignalsReader class comes with plotting features as shown below.
Read OpenSignals file and plot all signals.
# Read OpenSignals file and plot all signals
acq = OpenSignalsReader('SampleECG.txt', show=True)
# Read OpenSignals file and plot all raw signals.
acq = OpenSignalsReader('SampleECG.txt', show=True, raw=True)
Plotting a single channel ECG signal results in the plot below.
Alternatively, select the individual signals you want to plot using the OpenSignalsReader.plot()
and the signal sensor label or channel number.
# Plot ECG signal using the channel number
acq.plot('ECG')
# Plot ECG signal using the sensor label
acq.plot(2)
# Plotting multiple signals using the channel number
acq.plot(['ECG', 'EMG'])
# Plotting multiple signals using the sensor label
acq.plot([1, 2])
To plot the raw signals set the raw
parameter to True
.
# Plot raw ECG data
acq.plot('ECG', raw=True)
BITalino (r)evolution Transfer Functions
This package includes the bitalino_tf module which contains all available transfer functions of the current BITalino (r)evolution sensors. It is used by the OpenSignalsReader class to convert raw signal samples imported from OpenSignals files into their original units.
This package can also be useful if you want to convert sensor signals within your own software when not importing signals from the OpenSignals files.
BITalino sample series can be converted into their original units using the sensor's transfer function. See below how to use the functions of this module on the example of the ECG sensor.
import numpy as np
import opensignalsreader.bitalino_tf as bit
signal = np.loadtxt('SampleECG.txt', 'r')[:, -1]
# Convert signal to mV (10-bit resolution as default resolution)
ecg_signal = bit.ecg(signal)
# Convert signal acquired with 6-bit sampling resolution
ecg_signal = bit.ecg(signal, 6)
List of currently supported sensors (& datasheets):
- Electrocardiography (ECG)
- Electroencephalography (EEG)
- Electromyography (EMG)
- Electrodermal Activity (EDA)
- Accelerometer (ACC)
- Temperature (TEMP)
- High Definition Temperature (NTC)
- Light (LUX)
- SpO2 Reader (OSL)
- Glucose Meter Reader (GMR)
- Blood Pressure Reader (BPR)
- Electrogastropraphy (EGG)
- Electrooculography (EOG)
Useful Links
Detailed documentation about BITalino (r)evolution sensors can be found here:
http://bitalino.com/en/learn/documentation
BITalino (r)evolution sample files can be found here:
https://github.com/BITalinoWorld/revolution-sample-data
Download the OpenSignals (r)evolution software from the BITalino website:
http://bitalino.com/en/software
Important Notes
- Please do not sent support e-mails for the use of this package to PLUX. This package is not part of any of PLUX's solutions, but an independent open-source package to facilitate the data import stored in OpenSignals files. Use the issue board of this repository in case you find any issues with this package or if you need any support.
- OpenSignals (r)evolution files in .H5 or .EDF format are not supported (yet)
- No multi-device acquisition functions supported (yet, currently limited to a single device only)
- Number of plotted signals is currently limited to 6 signals only
Dependencies
Context of this Work
This package is part of the master thesis "Development of an Open-Source Python Toolbox for Heart Rate Variability (HRV)" at the University of Applied Sciences Hamburg, Germany and PLUX wireless biosignals, S.A.
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
File details
Details for the file opensignalsreader-0.2.2.tar.gz
.
File metadata
- Download URL: opensignalsreader-0.2.2.tar.gz
- Upload date:
- Size: 13.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37fe2fd789fc0d2d908bb873839690b70239ee3e1e422077fa59a7614420f603 |
|
MD5 | 2bc6ea635f4a2e44fb0431d40279bd03 |
|
BLAKE2b-256 | ee83b8910447eec6ba611fa7cc99a17a5f43e4fec0da8f1a7a0df6beebf3597c |
File details
Details for the file opensignalsreader-0.2.2-py3-none-any.whl
.
File metadata
- Download URL: opensignalsreader-0.2.2-py3-none-any.whl
- Upload date:
- Size: 55.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 105d973947488d298508b18bf954996703cdcf399002d359743538a7d2444721 |
|
MD5 | c6bb72c381fc4eb9749ca5234683b7b2 |
|
BLAKE2b-256 | 2b02351a98db5d9f259ec83108b2acc8aceeed6a85999cd74cb444e52f74ad4f |