Package: opensignalsreader
opensignalsreaderPython package to readOpenSignals (r)evolutionfiles and automatic sensor data conversion forBITalino (r)evolutionsensor data.Important:This repository does not contain any code written by PLUX and/or the BITalino team. Use theissue board of the opensignalsreader repositoryin case you experience any issues using opensignalsreader or if you need any support, instead of contacting PLUX.InstallationThis package can be installed using thepiptool:pipinstallopensignalsreaderExamples & How to Use this PackageThis package comes with the OpenSignalsReader class which facilitates the import of sensor signals acquired using theOpenSignals (r)evolutionsoftware. 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 FilesImport OpenSignalsReader class and read OpenSignals file ('SampleECG.txt').# Import OpenSignalsReaderfromopensignalsreaderimportOpenSignalsReader# Read OpenSignals fileacq=OpenSignalsReader('SampleECG.txt')Note, when using theOpenSignalsReaderclass in scripts (or other formats), use absolute file paths to ensure that the file will be found and used.Accessing Sensor DataObjects of theOpenSignalsReaderclass store raw digital sensor values and additionally their conversion into the sensor's original physical units (e.g. ECG -> mV). Use theOpenSignalsReader.raw()and theOpenSignalsReader.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 numberacq.raw(2)acq.signal(2)# Access single sensor signal using the sensor's labelacq.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 DataThe OpenSignalsReader class comes with plotting features as shown below.Read OpenSignals file and plot all signals.# Read OpenSignals file and plot all signalsacq=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 theOpenSignalsReader.plot()and the signal sensor label or channel number.# Plot ECG signal using the channel numberacq.plot('ECG')# Plot ECG signal using the sensor labelacq.plot(2)# Plotting multiple signals using the channel numberacq.plot(['ECG','EMG'])# Plotting multiple signals using the sensor labelacq.plot([1,2])To plot the raw signals set therawparameter toTrue.# Plot raw ECG dataacq.plot('ECG',raw=True)BITalino (r)evolution Transfer FunctionsThis package includes thebitalino_tfmodule which contains all available transfer functions of the current BITalino (r)evolution sensors. It is used by theOpenSignalsReaderclass 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.importnumpyasnpimportopensignalsreader.bitalino_tfasbitsignal=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 resolutionecg_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 LinksDetailed documentation about BITalino (r)evolution sensors can be found here:http://bitalino.com/en/learn/documentationBITalino (r)evolution sample files can be found here:https://github.com/BITalinoWorld/revolution-sample-dataDownload the OpenSignals (r)evolution software from the BITalino website:http://bitalino.com/en/softwareImportant NotesPleasedo 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 theissue board of this repositoryin 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 onlyDependenciesmatplotlibnumpyContext of this WorkThis 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.