.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/Plots/plot_subspace.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_Plots_plot_subspace.py: Plot subspaces to vivualize short/long and ectopic beats ======================================================== The artefact detection is based on the method described in [1]_. .. [1] Lipponen, J. A., & Tarvainen, M. P. (2019). A robust algorithm for heart rate variability time series artefact correction using novel beat classification. Journal of Medical Engineering & Technology, 43(3), 173–181. https://doi.org/10.1080/03091902.2019.1640306 .. GENERATED FROM PYTHON SOURCE LINES 14-18 .. code-block:: default # Author: Nicolas Legrand # Licence: GPL v3 .. GENERATED FROM PYTHON SOURCE LINES 19-21 Visualizing artefacts from RR time series ----------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 21-30 .. code-block:: default 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); .. image-sg:: /auto_examples/Plots/images/sphx_glr_plot_subspace_001.png :alt: Subspace 1 (ectopic beats detection), Subspace 2 (long and short beats detection) :srcset: /auto_examples/Plots/images/sphx_glr_plot_subspace_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none (, ) .. GENERATED FROM PYTHON SOURCE LINES 31-33 Visualizing artefacts from the `artefact` dictionary ---------------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 33-41 .. code-block:: default 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) .. image-sg:: /auto_examples/Plots/images/sphx_glr_plot_subspace_002.png :alt: Subspace 1 (ectopic beats detection), Subspace 2 (long and short beats detection) :srcset: /auto_examples/Plots/images/sphx_glr_plot_subspace_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none (, ) .. GENERATED FROM PYTHON SOURCE LINES 42-44 Using Bokeh as plotting backend ------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 44-53 .. code-block:: default 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 ) ) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.135 seconds) .. _sphx_glr_download_auto_examples_Plots_plot_subspace.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_subspace.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_subspace.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_