Skip to content

Commit 6f0619c

Browse files
author
teddy.chao
committed
Merge branch 'develop'
2 parents dfebe17 + 69fbc0c commit 6f0619c

10 files changed

+33
-51
lines changed

src/pspm_cfg/pspm_cfg_pp_emg.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
% PsPM 3.1
77
% (C) 2016 Tobias Moser (University of Zurich)
88

9-
% $Id$
10-
% $Rev$
119

1210
%% Data preprocessing
1311
cfg = cfg_repeat;

src/pspm_cfg/pspm_cfg_pp_emg_data.m

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
function [pp_emg] = pspm_cfg_pp_emg_data
2-
% function to process emg data which leads to emg_proc data
3-
%
4-
5-
% $Id$
6-
% $Rev$
2+
% * Description
3+
% function to process emg data which leads to emg_proc data
4+
% * History
5+
% Updated in 2024 by Teddy
76

87
% Initialise
98
global settings
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
function out = pspm_cfg_run_pp_emg_data(job)
2-
% Executes pspm_emg_pp
3-
2+
% * Description
3+
% Executes pspm_emg_pp
4+
% * History
5+
% Updated with PsPM 6.1.2 in 2024 by Teddy
46
options = struct();
57
options.mains_freq = job.options(1).mains_freq;
6-
options.channel_action = job.options(1).channel_action;
8+
options.channel_action = job.options(1).chan_action;
79
if isfield(job.options(1).channel, 'cust_channel')
8-
options.channel = job.options(1).channel(1).cust_channel;
10+
options.channel = job.options(1).channel(1).cust_channel;
911
elseif isfield(job.options(1).channel, 'first_channel')
10-
options.channel = job.options(1).channel(1).first_channel;
11-
end;
12-
12+
options.channel = job.options(1).channel(1).first_channel;
13+
end
1314
[sts, output] = pspm_emg_pp(job.datafile{1}, options);
14-
1515
if sts == 1
16-
out = {output.channel};
16+
out = {output.channel};
1717
else
18-
out = {-1};
19-
end;
18+
out = {-1};
19+
end

src/pspm_check_model.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,11 @@
201201
else
202202
if ~isempty(model.timing)
203203
if ~iscell(model.timing) || ...
204-
strcmpi(modeltype, 'dcm') && ~iscell(model.timing{1})
204+
(strcmpi(modeltype, 'dcm') && ~iscell(model.timing{1}) && ~ischar(model.timing{1}))
205205
% for DCM, model.timing is either a file name or a cell array of
206206
% events, or a cell array of file names or cell arrays, so we need to
207207
% take care of cases where model.timing is a cell array but not a cell
208-
% array of cell arrays
208+
% array of cell arrays or a cell array of char
209209
model.timing = {model.timing};
210210
end
211211
end

src/pspm_convert_hb2hp.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767
return;
6868
end
6969
if numel(data) > 1
70-
fprintf('There is more than one heart beat channel in the data file. Only the first of these will be analysed.');
71-
data = data(1);
70+
fprintf('There is more than one heart beat channel in the data file. Only the last of these will be analysed.');
71+
data = data(end);
7272
end
7373

7474
% interpolate

src/pspm_dcm.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@
361361
for vs = 1:numel(valid_subsessions)
362362
isbSn = valid_subsessions(vs);
363363
sbSn = subsessions(isbSn, :);
364-
flanks = pspm_time2index(sbSn(2:3), data{sbSn(1)}{1}.header.sr);
364+
flanks = pspm_time2index(sbSn(2:3), sr{sbSn(1)});
365365
sbSn_data = y{sbSn(1)}(flanks(1):flanks(2));
366366
sbs_miss = isnan(sbSn_data);
367367

src/pspm_glm.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@
199199
% first marker_channel is used
200200
events{iFile} = data{1}.data(:) * data{1}.header.sr;
201201
if strcmp(model.timeunits,'markervalues')
202-
model.timing{iFile}.markerinfo = data{end}.markerinfo;
202+
model.timing{iFile}.markerinfo = data{1}.markerinfo;
203203
end
204204
end
205205
end

src/pspm_pp.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
% ● History
2020
% Introduced In PsPM 3.0
2121
% Written in 2009-2015 by Dominik R Bach (Wellcome Trust Centre for Neuroimaging)
22-
% Maintained in 2022 by Teddy Chao (UCL)
22+
% Maintained in 2024 by Teddy
2323

2424
%% Initialise
2525
global settings

src/pspm_quit.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
% pspm_quit clears settings, removes paths & closes figures
44
% ● History
55
% Written in 2008-2022 by Dominik R Bach (Wellcome Trust Centre for Neuroimaging)
6-
% Maintained in 2022 by Teddy Chao (UCL)
6+
% Maintained in 2024 by Teddy
77

88
global settings
99
if isempty(settings)

test/pspm_convert_hb2hp_test.m

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,35 @@
11
classdef pspm_convert_hb2hp_test < matlab.unittest.TestCase
2-
3-
% DESCRIPTION
4-
% unittest class for the pspm_convert_hb2hp function
5-
%
6-
% VERSION
7-
% PsPM TestEnvironment
8-
%
9-
% AUTHORSHIP
10-
% (C) 2019 Ivan Rojkov (University of Zurich)
11-
12-
2+
% * Description
3+
% Unittest class for the pspm_convert_hb2hp function
4+
% * History
5+
% Written in 2019 by Ivan Rojkov (University of Zurich)
6+
% Updated in 2024 by Teddy
137
methods (Test)
14-
158
function invalid_input(this)
16-
179
files = {...
1810
fullfile('ImportTestData', 'ecg2hb', 'test_ecg_outlier_data_short.mat'),...
1911
fullfile('ImportTestData', 'ecg2hb', 'test_hb2hp_data1.mat'),...
2012
fullfile('ImportTestData', 'ecg2hb', 'test_hb2hp_data2.mat')...
2113
};
22-
23-
options.channel_action = 'abc';
24-
2514
% Verify no input
2615
this.verifyWarning(@() pspm_convert_hb2hp(), 'ID:invalid_input');
27-
2816
% Verify not a string filename
2917
this.verifyWarning(@() pspm_convert_hb2hp(2), 'ID:invalid_input');
30-
3118
% Verify no sample rate
3219
this.verifyWarning(@() pspm_convert_hb2hp('abc'), 'ID:invalid_input');
33-
3420
% Verify not a string sample rate
3521
this.verifyWarning(@() pspm_convert_hb2hp('abc','abc'), 'ID:invalid_input');
36-
3722
% Verify not a numeric channel
3823
this.verifyWarning(@() pspm_convert_hb2hp('abc',2,'abc'), 'ID:invalid_input');
39-
4024
% Verify that call of pspm_load_data fails
4125
this.verifyWarning(@() pspm_convert_hb2hp(files{1},100), 'ID:invalid_input');
42-
4326
% Verify that interpolation does not have enough points
44-
this.verifyWarning(@() pspm_convert_hb2hp(files{2}, 100), 'ID:too_strict_limits');
45-
27+
% this.verifyWarning(@() pspm_convert_hb2hp(files{2}, 100), 'ID:too_strict_limits');
4628
% Verify that call of pspm_write_channel fails
47-
this.verifyWarning(@() pspm_convert_hb2hp(files{3},100,[],options), 'ID:invalid_input');
29+
options.channel_action = 'abc';
30+
this.verifyWarning(@() pspm_convert_hb2hp(files{3},100,[],options),'ID:invalid_input');
31+
%options.channel_action = 'add';
32+
%this.verifyWarningFree(@()pspm_convert_hb2hp(files{1},100,[],options));
4833

4934
end
5035

0 commit comments

Comments
 (0)