{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Plot raw physiological signal\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "# Author: Nicolas Legrand \n# Licence: Apache-2.0\n\n\nfrom bokeh.io import output_notebook\nfrom bokeh.plotting import show\nfrom systole.plots import plot_raw\n\nfrom systole import import_dataset1, import_ppg" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Plot raw ECG signal\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "# Import PPG recording as pandas data frame\nphysio_df = import_dataset1(modalities=['ECG', 'Respiration'])\n\n# Only use the first 60 seconds for demonstration\necg = physio_df[physio_df.time.between(60, 90)].ecg\nplot_raw(ecg, modality='ecg', sfreq=1000, detector='sleepecg')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Plot raw PPG signal\nImport Respiration recording as pandas data frame\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "rsp = import_dataset1(modalities=['Respiration'])\n\n# Only use the first 90 seconds for demonstration\nrsp = physio_df[physio_df.time.between(500, 600)].respiration\nplot_raw(rsp, sfreq=1000, modality=\"respiration\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Plot raw respiratory signal\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "# Import PPG recording as pandas data frame\nppg = import_ppg()\n\n# Only use the first 60 seconds for demonstration\nplot_raw(ppg[ppg.time<60], sfreq=75)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Using Bokeh as plotting backend\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "output_notebook()\n\nshow(\n plot_raw(ppg, backend=\"bokeh\", show_heart_rate=True, show_artefacts=True)\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 }