Code

In this book the wearable data analysis will be performed using Python code. We will use a few existing Python toolboxes in the analysis, which are now described.

WFDB Toolbox

Waveform Database (WFDB) is a set of file standards designed for reading and storing physiologic signal data, and associated annotations. Data on PhysioNet are stored in WFDB format.

The WFDB Toolbox is a set of openly-licensed tools for reading, writing, and analysing WFDB data. It is available in C, Matlab, and Python.

In this book we will use the WFDB Python Package, a library of tools for reading, writing, and processing physiological signals and annotations.

The WFDB Python Package can be installed using:

$ pip install wfdb

It will be imported using: import wfdb

Sources: adapted from https://wfdb.io/ and the WFDB Python Package Readme.

Neurokit

Neurokit is a ‘Python Toolbox for Neurophysiological Signal Processing’. It includes functions for analysing ECG and PPG signals, such as algorithms for detecting beats in these signals.

Neurokit can be installed using:

$ pip install neurokit2

It will be imported using: import neurokit2 as nk

Source: adapted from https://neuropsychology.github.io/NeuroKit/ under CC BY 4.0.

Additional toolboxes

The following toolboxes are also used in this book:

  • sys: an essential python package, imported using import sys

  • scipy: the SciPy signal processing package, imported using import scipy.signal as sp

  • matplotlib: a plotting package, imported using from matplotlib import pyplot as plt

  • numpy: a package for scientific computing, imported using import numpy as np

  • pandas: a package for data analysis, imported using import pandas as pd

  • pprint: for printing Python data structures, imported using from pprint import pprint

  • copy: to copy Python variables, imported using import copy