Skip to main content

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.

Image

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):

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


Download files

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

Source Distribution

opensignalsreader-0.2.2.tar.gz (13.0 kB view hashes)

Uploaded Source

Built Distribution

opensignalsreader-0.2.2-py3-none-any.whl (55.9 kB view hashes)

Uploaded Python 3

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