
BVP Sensor  Unit Conversion 
Tags  preprocess☁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
# 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 timeaxis.
from numpy import array, linspace
2  Download of the sensor datasheet (from https://biosignalsplux.com/index.php/learn/documentation ) to check for sensor specifications. In this case we are working with BVP, being our file located at http://www.biosignalsplux.com/datasheets/BVP_Sensor_Datasheet.pdf
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:$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
# Data loading
data, header = bsnb.load_signal("https://drive.google.com/file/d/1lXw_CrETgTkA7vLmOT3KCOtqx8p1JbTf/view?usp=sharing",
get_header=True)
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.
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.
# 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.signal_ri = (signal / 2**resolution)
6  Time axis generation
time = bsnb.generate_time(signal_ri, sr)
Comparison between RAW and $r.i.$ signal.