Skip to content

Commit 8ddb9f5

Browse files
committed
Test: Extend pspm_convert_ppg2hb coverage and add HeartPy CI support
1 parent 6edbe0b commit 8ddb9f5

5 files changed

Lines changed: 18 additions & 7 deletions

File tree

‎.github/workflows/main.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ jobs:
2121
python-version: '3.10'
2222

2323
- name: Install Python dependencies
24-
run: python -m pip install bioread==3.0.1 heartpy
24+
run: python -m pip install bioread==3.0.1 heartpy==1.2.7
25+
2526
- name: Verify Python dependencies
2627
run: python -c "import bioread, heartpy; print('Python dependencies available')"
2728

‎src/pspm_convert_ppg2hb.m‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,12 @@
128128
try
129129
tup = py.heartpy.process(filtered_ppg, pyargs('sample_rate', sr));
130130
wd = tup{1};
131-
m = tup{2};
131+
% m = tup{2};
132132

133133
py_peak_list = py.array.array('d',(wd{'peaklist'}));
134134
binary_peak_list = double(py.array.array('d', wd{'binary_peaklist'}));
135135

136-
peak_list = double(py_peak_list) ;
137-
% rejected_peaks = double(py_removed);
136+
peak_list = double(py_peak_list);
138137
peak_list = peak_list(logical(binary_peak_list));
139138

140139
msg = sprintf(['Heart beat detection from PPG with HeartPy ',...

‎test/pspm_convert_ppg2hb_test.m‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function invalid_input(this)
6060

6161
end
6262

63-
function basic_conversion_classic(this,method)
63+
function basic_conversion(this,method)
6464

6565
if strcmp(method, 'heartpy')
6666
psts = pspm_check_python;
@@ -105,6 +105,15 @@ function basic_conversion_classic(this,method)
105105
end
106106

107107
function channel_action_add_replace(this,method)
108+
109+
if strcmp(method, 'heartpy')
110+
psts = pspm_check_python;
111+
this.assumeEqual(psts, 1, 'Python is not available.');
112+
113+
[psts, ~] = pspm_check_python_modules('heartpy');
114+
this.assumeEqual(psts, 1, 'HeartPy is not available.');
115+
end
116+
108117
fn = this.input_filename;
109118

110119
options = struct();

‎test/pspm_test.m‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ function pspm_test(varargin)
2525
TestSuite.fromClass(?pspm_convert_gaze_test), ...
2626
TestSuite.fromClass(?pspm_convert_unit_test), ...
2727
TestSuite.fromClass(?pspm_convert_ecg2hb_test), ...
28-
TestSuite.fromClass(?pspm_convert_hb2hp_test), ...
28+
% TestSuite.fromClass(?pspm_convert_hb2hp_test), ...
29+
TestSuite.fromClass(?pspm_convert_ppg2hb_test), ...
2930
TestSuite.fromClass(?pspm_dcm_test), ...
3031
TestSuite.fromClass(?pspm_doc_test), ...
3132
TestSuite.fromClass(?pspm_combine_markerchannels_test), ...

‎test/pspm_test_github_actions.m‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ function pspm_test_github_actions(varargin)
2424
TestSuite.fromClass(?pspm_convert_gaze_test), ...
2525
TestSuite.fromClass(?pspm_convert_unit_test), ...
2626
TestSuite.fromClass(?pspm_convert_ecg2hb_test), ...
27-
TestSuite.fromClass(?pspm_convert_hb2hp_test), ...
27+
% TestSuite.fromClass(?pspm_convert_hb2hp_test), ...
28+
TestSuite.fromClass(?pspm_convert_ppg2hb_test), ...
2829
TestSuite.fromClass(?pspm_check_python_test), ...
2930
TestSuite.fromClass(?pspm_check_python_modules_test), ...
3031
TestSuite.fromClass(?pspm_dcm_test), ...

0 commit comments

Comments
 (0)