Learn R Programming

heartbeatr (version 1.0.0)

pulse_find_peaks_one_channel: Determine the heart beat frequency in one PULSE channel

Description

Take data from one PULSE channel and identify the heartbeat wave peaks using an algorithm that searches for maxima across multiple scales.

Usage

pulse_find_peaks_one_channel(split_window_one_channel)

Value

A one-row tibble with 8 columns:

  • time, time at the center of split_window_one_channel$time

  • t_pks, time stamps of each wave peak identified

  • hz, heartbeat rate estimate (in Hz)

  • n, number of wave peaks identified

  • sd, standard deviation of the intervals between wave peaks

  • ci, confidence interval (hz ± ci)

Arguments

split_window_one_channel

a tibble with PULSE data for only one channel with columns $time and $val

Standard Deviation

The sd computed refers to the spread of the intervals between each peak identified. It is a measure of the quality of the raw data and the ability of the algorithm to identify a real heart beat. The lower the sd, the more regular are the intervals between peaks, and the more likely that the algorithm did find a real signal. Conversely, higher sds indicate that the peaks are found at irregular intervals, and is an indication of poor quality data. In detail, sd is computed by: 1) taking the timestamps for each peak identified [t_pks], 2) computing the intervals between each pair of consecutive peaks [as.numeric(diff(t_pks))], and 3) computing sd [sd(intervals)].

BPM

To convert to Beats Per Minute, simply multiply hz and ci by 60.

Details

function builds upon code from https://github.com/ig248/pyampd

See Also

  • pulse_find_peaks_all_channels() runs pulse_find_peaks_one_channel() on all PULSE channels

  • pulse_read(), pulse_split(), pulse_optimize(), pulse_heart(), pulse_doublecheck() and pulse_choose_keep() are the functions needed for the complete PULSE processing workflow

  • PULSE() is a wrapper function that executes all the steps needed to process PULSE data at once

Examples

Run this code
## Begin prepare data ----
pulse_data_sub <- pulse_data
pulse_data_sub$data <- pulse_data_sub$data[,1:5]
pulse_data_split <- pulse_split(pulse_data_sub)
pulse_data_split <- pulse_optimize(pulse_data_split, multi = pulse_data$multi)
split_window <- pulse_data_split$data[[1]]
split_window_one_channel <- split_window[,1:2]
colnames(split_window_one_channel) <- c("time", "val")
# End prepare data ----

## Determine heartbeat rates in one channel in one time window
pulse_find_peaks_one_channel(split_window_one_channel)

Run the code above in your browser using DataLab