BVP Sensor - Unit Conversion
Difficulty Level:
Tags pre-process☁bvp☁conversion

The OpenSignals outputted file formats contain raw data, corresponding to bits which depends on the resolution of each sensor, thus each sample is represented by a digital unit.
In scientific terms it is recommended the use of specific units, such as, electric tension (V) or electric current (A) . Each sensor that PLUX commercialises has an associated datasheet where a transfer function is generally mentioned to perform unit conversion.

In spite of the unit conversion procedure has some common steps applicable to all sensors, the current Jupyter Notebook is dedicated to the unit conversion procedure of signals acquired with BVP sensor using Python.

1 - Importation of the required packages

In [1]:
# biosignalsnotebooks Python package with useful functions that support and complement the available Notebooks
import biosignalsnotebooks as bsnb

# Functions used for creating a numpy array, where a mathematical operation can be applied to each entry in an easy and automatic way. 
# Linspace, will be used for generation of a time-axis.
from numpy import array, linspace

2 - Download of the sensor datasheet (from ) to check for sensor specifications. In this case we are working with BVP, being our file located at

In [2]:
# Embedding of .pdf file
from IPython.display import IFrame
IFrame('../../images/pre-process/unit_conversion_bvp/BVP_Sensor_Datasheet.pdf', width="100%", height=350)

3 - Transfer Function of the BVP Sensor

The transfer function is the function that maps the digital units to relative intensity ($r.i.$). In this case, the transfer function is:

\begin{equation} {BVP}_{r.i.} = \frac{ADC}{2^n} \end{equation}
$BVP_{r.i.}$ - BVP value in $r.i.$ units $ADC$ - Digital value sampled from the channel (initialism of "Analog to Digital Converter") $n$ - Number of bits of the channel (dependent on the chosen resolution specified on OpenSignals previously to the acquisition stage [8, 12 or 16 bits])

4 - Loading of data stored in biosignalsnotebooks own signal library

In [3]:
# Data loading
data, header = bsnb.load_signal("",

In the following cell, some relevant information is stored inside variables. This relevant information includes the channel number and signal acquisition parameters, such as resolution and sampling rate.

For a detailed explanation of how to access this info, the "Signal Loading - Working with File Header" Notebook should be consulted.

In [4]:
ch = "CH1" # Channel
sr = 1000 # Sampling rate
resolution = 16 # Resolution (number of available bits)

Access to acquired signal samples and storage inside a new variable.

In [5]:
# The array function converts the list of values to a numpy.array in order to facilitate mathematical operations.
signal = array(data[ch])

5 - Final unit conversion by applying the transfer function sample by sample

Application of the formula using Python. The result will be the same signal in physical units.

In [6]:
signal_ri = (signal / 2**resolution)

6 - Time axis generation

In [7]:
time = bsnb.generate_time(signal_ri, sr)

Comparison between RAW and $r.i.$ signal.

In [8]:
bsnb.plot([time, time], [signal, signal_ri], y_axis_label=["Raw Data", "Relative Intensity Units (r.i.)"], grid_lines=1, grid_columns=2, grid_plot=True)