{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Plot instantaneous heart rate\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "# Author: Nicolas Legrand \n# Licence: Apache-2.0\n\nfrom bokeh.io import output_notebook\nfrom bokeh.plotting import show\nfrom systole.plots import plot_rr\n\nfrom systole import import_rr" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Plot instantaneous heart rate from a RR interval time series (in milliseconds).\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "# Import R-R intervals time series\nrr = import_rr().rr.values\n\nplot_rr(rr=rr, input_type=\"rr_ms\");" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Only show the interpolated instantaneous heart rate, add a bad segment and change the default unit to beats per minute (BPM).\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "plot_rr(rr=rr, input_type=\"rr_ms\", unit=\"bpm\", points=False);" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Use Bokeh as a plotting backend, only show the scatterplt and highlight artefacts in the RR intervals\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "output_notebook()\n\nshow(\n plot_rr(\n rr=rr, input_type=\"rr_ms\", backend=\"bokeh\", \n line=False, show_artefacts=True\n )\n)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.16" } }, "nbformat": 4, "nbformat_minor": 0 }