Skip to content

Commit

Permalink
code at end of MSPTDfast v2 design (2024-08-02)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterhcharlton committed Aug 2, 2024
1 parent b6b089c commit d330da3
Show file tree
Hide file tree
Showing 6 changed files with 881 additions and 4 deletions.
2 changes: 1 addition & 1 deletion source/align_ppg_ecg_beats.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

%% calculate the aligned indices of ECG beats
ecg_beats_a_inds = ecg_beats_inds+lag_ecg_samps;
ecg_beats_a_inds(ecg_beats_a_inds<0) = []; % some are shifted to before time 0 due to the lag.
ecg_beats_a_inds(ecg_beats_a_inds<=0) = []; % some are shifted to before time 0 due to the lag.

%% calculate time-shifted ecg exclusion log
if exist('ecg_exc_log', 'var')
Expand Down
19 changes: 16 additions & 3 deletions source/assess_multiple_datasets.m
Original file line number Diff line number Diff line change
Expand Up @@ -621,9 +621,15 @@ function report_best_and_worst_beat_detectors(res, curr_cat, curr_datasets, beat
up.assessment_datasets = {'mimic_perform_truncated_train_all', 'mimic_perform_truncated_test_all'};
up.comparison_datasets = {'mimic_perform_truncated_non_af', 'mimic_perform_truncated_af'};
end
% (datasets used to design MSPTDfast v2)
do_msptdfastv2_design = 1;
if do_msptdfastv2_design
up.assessment_datasets = {'capnobase', 'bidmc', 'mimic_train_all', 'ppg_dalia_all_activities'};
up.comparison_datasets = {};
end

% my current datasets
do_current = 1;
do_current = 0;
if do_current
up.assessment_datasets = {'ppg_dalia_lunch_break'};
% up.assessment_datasets = {'aurora_sittingarmdown', 'aurora_sittingarmlap', 'aurora_sittingarmup', 'aurora_ambulatory', 'aurora_standingarmup', 'aurora_standingarmdown','aurora_walking', 'aurora_running', 'aurora_supine'};
Expand Down Expand Up @@ -1102,10 +1108,15 @@ function create_comparison_figures(datasets, raw_res, res, options, uParams, cur
%options.beat_detectors = {'AMPD', 'MSPTD', 'qppgfast', 'PWD', 'ERMA', 'SPAR', 'ABD', 'HeartPy'};
options.beat_detectors = {'MSPTD', 'qppgfast'};
options.beat_detectors = {'SPAR', 'SPAR2', 'MSPTD', 'MSPTDPC', 'PPGPulsesPC', 'qppgfast', 'qppgfastpc', 'qppgfastpcimp', 'qppgfastpcimp2', 'qppgfastpcimp3', 'wepd', 'PDAthree'}; %, 'PDAfour'}; % 'ABDtwo',
options.beat_detectors = {'qppgfast', 'MSPTD', 'MSPTDPC1', 'MSPTDPC2', 'MSPTDPC3', 'MSPTDPC4', 'MSPTDPC5', 'MSPTDPC6', 'MSPTDPC7', 'MSPTDPC8', 'MSPTDPC9', 'MSPTDPC10', 'MSPTDPC11', 'MSPTDPC12', 'MSPTDPC13', 'MSPTDPC14', 'MSPTDfastv1'};
do_msptdfastv2_design = 1;
if do_msptdfastv2_design
options.beat_detectors = {'MSPTDPC1', 'MSPTDPC2', 'MSPTDPC3', 'MSPTDPC4', 'MSPTDPC5', 'MSPTDPC6', 'MSPTDPC7', 'MSPTDPC8', 'MSPTDPC9', 'MSPTDPC10', 'MSPTDPC11', 'MSPTDPC12', 'MSPTDPC14', 'MSPTDPC15', 'MSPTDPC16'};
end

% specify beat detectors to redo
options.redo_selected_beat_detectors = {'qppgfast', 'MSPTD', 'MSPTDPC1', 'MSPTDPC2', 'MSPTDPC3', 'MSPTDPC4', 'MSPTDPC5', 'MSPTDPC6', 'MSPTDPC7', 'MSPTDPC8', 'MSPTDPC9', 'MSPTDPC10', 'MSPTDPC11', 'MSPTDPC12', 'MSPTDPC13', 'MSPTDPC14', 'MSPTDfastv1'};
if do_msptdfastv2_design
options.redo_selected_beat_detectors = {'MSPTDPC1', 'MSPTDPC2', 'MSPTDPC3', 'MSPTDPC4', 'MSPTDPC5', 'MSPTDPC6', 'MSPTDPC7', 'MSPTDPC8', 'MSPTDPC9', 'MSPTDPC10', 'MSPTDPC11', 'MSPTDPC12', 'MSPTDPC14', 'MSPTDPC15', 'MSPTDPC16'};
end
options.redo_selected_beat_detectors = options.redo_selected_beat_detectors(:);

% Specify the downsampling strategy
Expand Down Expand Up @@ -1139,6 +1150,8 @@ function create_comparison_figures(datasets, raw_res, res, options, uParams, cur
dataset_file = '/Users/petercharlton/Documents/Data/ppg_dalia/conv_data/ppg_dalia_table_soccer_data.mat';
case 'ppg_dalia_cycling'
dataset_file = '/Users/petercharlton/Documents/Data/ppg_dalia/conv_data/ppg_dalia_cycling_data.mat';
case 'ppg_dalia_all_activities'
dataset_file = '/Users/petercharlton/Documents/Data/ppg_dalia/conv_data/ppg_dalia_all_activities_data.mat';
case 'capnobase'
dataset_file = '/Users/petercharlton/Documents/Data/capnobase_2021/conv_data/capnobase_data.mat';
case 'wesad_amusement'
Expand Down
10 changes: 10 additions & 0 deletions source/dev/msptdpc15_beat_detector.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function [peaks, onsets] = msptdpc15_beat_detector(sig,fs)

% version: ds to 30 hz

options.do_ds = true;
options.ds_freq = 40;

[peaks, onsets] = msptdpcref_beat_detector(sig,fs, options);

end
10 changes: 10 additions & 0 deletions source/dev/msptdpc16_beat_detector.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function [peaks, onsets] = msptdpc16_beat_detector(sig,fs)

% version: ds to 30 hz

options.do_ds = true;
options.ds_freq = 50;

[peaks, onsets] = msptdpcref_beat_detector(sig,fs, options);

end
Loading

0 comments on commit d330da3

Please sign in to comment.