Plot subspaces to vivualize short/long and ectopic beats#

The artefact detection is based on the method described in [1].

# Author: Nicolas Legrand <nicolas.legrand@cfin.au.dk>
# Licence: GPL v3

Visualizing artefacts from RR time series#

from systole import import_rr
from systole.plots import plot_subspaces
import matplotlib.pyplot as plt

# Import PPG recording as numpy array
rr = import_rr().rr.to_numpy()

_, axs = plt.subplots(ncols=2, figsize=(12, 6))
plot_subspaces(rr, ax=axs);
Subspace 1   (ectopic beats detection), Subspace 2   (long and short beats detection)
(<Axes: title={'center': 'Subspace 1 \n (ectopic beats detection)'}, xlabel='Subspace $S_{11}$', ylabel='Subspace $S_{12}$'>, <Axes: title={'center': 'Subspace 2 \n (long and short beats detection)'}, xlabel='Subspace $S_{21}$', ylabel='Subspace $S_{22}$'>)

Visualizing artefacts from the artefact dictionary#

from systole.detection import rr_artefacts

# Use the rr_artefacts function to short/long and extra/missed intervals
artefacts = rr_artefacts(rr)

_, axs = plt.subplots(ncols=2, figsize=(12, 6))
plot_subspaces(artefacts=artefacts, ax=axs)
Subspace 1   (ectopic beats detection), Subspace 2   (long and short beats detection)
(<Axes: title={'center': 'Subspace 1 \n (ectopic beats detection)'}, xlabel='Subspace $S_{11}$', ylabel='Subspace $S_{12}$'>, <Axes: title={'center': 'Subspace 2 \n (long and short beats detection)'}, xlabel='Subspace $S_{21}$', ylabel='Subspace $S_{22}$'>)

Using Bokeh as plotting backend#

from bokeh.io import output_notebook
from bokeh.plotting import show
from systole.detection import rr_artefacts
output_notebook()

show(
    plot_subspaces(
    artefacts=artefacts, backend="bokeh", figsize=400
    )
)

Total running time of the script: (0 minutes 0.649 seconds)

Gallery generated by Sphinx-Gallery