Skip to content

Commit

Permalink
fixed missing preproc in badsegment, badchannel and baddata
Browse files Browse the repository at this point in the history
Added missing preproc before level is calculated in ft_badsegment, ft_badchannel and ft_baddata. Also changed name of the index variable in the loop calculating std and mean for zvalue to better match its use.
  • Loading branch information
chrisNatMEG committed Nov 6, 2024
1 parent 425d590 commit cc30ed7
Showing 3 changed files with 12 additions and 9 deletions.
7 changes: 4 additions & 3 deletions ft_badchannel.m
Original file line number Diff line number Diff line change
@@ -151,8 +151,8 @@
runsum = zeros(nchan, 1);
runss = zeros(nchan, 1);
runnum = 0;
for chan=1:ntrl
dat = preproc(data.trial{chan}, data.label, data.time{chan}, cfg.preproc);
for trl=1:ntrl
dat = preproc(data.trial{trl}, data.label, data.time{trl}, cfg.preproc);
runsum = runsum + nansum(dat, 2);
runss = runss + nansum(dat.^2, 2);
runnum = runnum + sum(isfinite(dat), 2);
@@ -174,7 +174,8 @@

for trl=1:ntrl
% compute the artifact value for each channel in this trial
level = artifact_level(data.trial{trl}, cfg.metric, mval, sd, connectivity);
dat = preproc(data.trial{trl}, data.label, data.time{trl}, cfg.preproc);
level = artifact_level(dat, cfg.metric, mval, sd, connectivity);

if isvector(level)
% find channels with a value that exceeds the threshold
7 changes: 4 additions & 3 deletions ft_baddata.m
Original file line number Diff line number Diff line change
@@ -127,8 +127,8 @@
runsum = zeros(nchan, 1);
runss = zeros(nchan, 1);
runnum = 0;
for chan=1:ntrl
dat = preproc(data.trial{chan}, data.label, data.time{chan}, cfg.preproc);
for trl=1:ntrl
dat = preproc(data.trial{trl}, data.label, data.time{trl}, cfg.preproc);
runsum = runsum + nansum(dat, 2);
runss = runss + nansum(dat.^2, 2);
runnum = runnum + sum(isfinite(dat), 2);
@@ -151,7 +151,8 @@
% compute the artifact value for each trial and each channel
level = nan(nchan, ntrl);
for trl=1:ntrl
level(:,trl) = artifact_level(data.trial{trl}, cfg.metric, mval, sd, connectivity);
dat = preproc(data.trial{trl}, data.label, data.time{trl}, cfg.preproc);
level(:,trl) = artifact_level(dat, cfg.metric, mval, sd, connectivity);
end

% find channels and trials with a value that exceeds the threshold
7 changes: 4 additions & 3 deletions ft_badsegment.m
Original file line number Diff line number Diff line change
@@ -150,8 +150,8 @@
runsum = zeros(nchan, 1);
runss = zeros(nchan, 1);
runnum = 0;
for chan=1:ntrl
dat = preproc(data.trial{chan}, data.label, data.time{chan}, cfg.preproc);
for trl=1:ntrl
dat = preproc(data.trial{trl}, data.label, data.time{trl}, cfg.preproc);
runsum = runsum + nansum(dat, 2);
runss = runss + nansum(dat.^2, 2);
runnum = runnum + sum(isfinite(dat), 2);
@@ -173,7 +173,8 @@

for trl=1:ntrl
% compute the artifact value for each channel in this trial
level = artifact_level(data.trial{trl}, cfg.metric, mval, sd, connectivity);
dat = preproc(data.trial{trl}, data.label, data.time{trl}, cfg.preproc);
level = artifact_level(dat, cfg.metric, mval, sd, connectivity);

if isvector(level)
% find channels with a value that exceeds the threshold

0 comments on commit cc30ed7

Please sign in to comment.