Skip to content

Bad-by-dropout channels ignored during re-referencing? #28

Open
@a-hurst

Description

@a-hurst

Was reading through the PREP re-referencing code while working on PyPREP, and noticed something that looks to be a bug in updateBadChannels.m:

function ref = updateBadChannels(ref, noisy)
% Update the bad channel lists from ref based on bad channels in noisy
ref.badChannelsFromNaNs = union(ref.badChannelsFromNaNs, ...
noisy.badChannelsFromNaNs);
ref.badChannelsFromNoData = union(ref.badChannelsFromNoData, ...
noisy.badChannelsFromNoData);
ref.badChannelsFromHFNoise = union(ref.badChannelsFromHFNoise, ...
noisy.badChannelsFromHFNoise);
ref.badChannelsFromCorrelation = union(ref.badChannelsFromCorrelation, ...
noisy.badChannelsFromCorrelation);
ref.badChannelsFromDeviation = union(ref.badChannelsFromDeviation, ...
noisy.badChannelsFromDeviation);
ref.badChannelsFromRansac = union(ref.badChannelsFromRansac, ...
noisy.badChannelsFromRansac);
ref.badChannelsFromDropOuts = union(ref.badChannelsFromDropOuts, ...
noisy.badChannelsFromDropOuts);
ref.all = union(...
union(ref.badChannelsFromNaNs, ref.badChannelsFromNoData), ...
union( ...
union(ref.badChannelsFromHFNoise, ref.badChannelsFromCorrelation), ...
union( ...
union(ref.badChannelsFromDeviation,ref.badChannelsFromRansac), ...
ref.badChannelsFromRansac)));

Specifically, dropout channels aren't included in the ref.all union at the end, meaning that they're never excluded/interpolated during re-referencing. Additionally, ref.badChannelsFromRansac is included in the union twice, which makes it look like bad-by-dropout channels were meant to be included but got copy/pasted incorrectly.

Thanks in advance for taking a look!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions