if (FALSE) {
# Read in ECG data
ecg <- read_wfdb("ecg", test_path(), "ecgpuwave")
# Create windows based on sinus rhythm
windows <- window_signal(
ecg,
method = "rhythm",
rhythm_type = "sinus",
onset_criteria = list(type = "(", number = 0),
offset_criteria = list(type = ")", number = 2),
reference_criteria = list(type = "N")
)
# Standardize windows to exactly 500 samples
std_windows <- standardize_windows(
windows,
method = "time_normalize",
target_samples = 500
)
# Alternatively, standardize to 500 milliseconds (depends on sampling frequency)
std_windows_ms <- standardize_windows(
windows,
method = "time_normalize",
target_ms = 500
)
# Standardize windows with QRS alignment
aligned_windows <- standardize_windows(
windows,
method = "time_normalize",
target_samples = 500,
align_feature = "N" # Align on QRS complexes
)
}
Run the code above in your browser using DataLab