Plot raw physiological signal#

# Author: Nicolas Legrand <nicolas.legrand@cfin.au.dk>
# Licence: Apache-2.0


from bokeh.io import output_notebook
from bokeh.plotting import show
from systole.plots import plot_raw

from systole import import_dataset1, import_ppg

Plot raw ECG signal#

# Import PPG recording as pandas data frame
physio_df = import_dataset1(modalities=['ECG', 'Respiration'])

# Only use the first 60 seconds for demonstration
ecg = physio_df[physio_df.time.between(60, 90)].ecg
plot_raw(ecg, modality='ecg', sfreq=1000, detector='sleepecg')
  0%|          | 0/2 [00:00<?, ?it/s]
Downloading ECG channel:   0%|          | 0/2 [00:00<?, ?it/s]
Downloading Respiration channel:   0%|          | 0/2 [00:00<?, ?it/s]
Downloading Respiration channel: 100%|██████████| 2/2 [00:00<00:00, 264.73it/s]

<Axes: title={'center': 'ECG recording'}, ylabel='ECG (mV)'>
../../_images/70ef39fd2e6c916e1ac5a12b7f2adcfe07c67f270455af7f4fe183fa9aadde51.png

Plot raw PPG signal#

Import Respiration recording as pandas data frame

rsp = import_dataset1(modalities=['Respiration'])

# Only use the first 90 seconds for demonstration
rsp = physio_df[physio_df.time.between(500, 600)].respiration
plot_raw(rsp, sfreq=1000, modality="respiration")
  0%|          | 0/1 [00:00<?, ?it/s]
Downloading Respiration channel:   0%|          | 0/1 [00:00<?, ?it/s]
Downloading Respiration channel: 100%|██████████| 1/1 [00:00<00:00, 353.35it/s]

<Axes: title={'center': 'Respiration'}, ylabel='Respiratory signal'>
../../_images/5f20b6bbd3ddbca3d8b2976e9407d021cd2c73c58b1d9b7c24164f9af9fe6109.png

Plot raw respiratory signal#

# Import PPG recording as pandas data frame
ppg = import_ppg()

# Only use the first 60 seconds for demonstration
plot_raw(ppg[ppg.time<60], sfreq=75)
<Axes: title={'center': 'PPG recording'}, ylabel='PPG level (a.u.)'>
../../_images/57049ec099f45ff51dadee3451a7659aa1503e1b6dab771849952d263db543d7.png

Using Bokeh as plotting backend#

output_notebook()

show(
    plot_raw(ppg, backend="bokeh", show_heart_rate=True, show_artefacts=True)
 )
Loading BokehJS ...