-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMuse_flag_channels.m
22 lines (17 loc) · 1.13 KB
/
Muse_flag_channels.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Parameters %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
max_bad = .33; % max fraction of windows to be tolerated before flagging channel
win_size = 5; % window size (in s) CLASSIFIERS TRAINED FOR 5-s WINDOWS
usegpu = 0; % use GPU computing
vis = 1; % visualize flagged channels
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Load classifiers (one for frontal and one for posterior because they have
% pretty different signals)
mdlPath = 'add_path_to_classifiers'; %%%%%%%%% ADD PATH %%%%%%%%
load(fullfile(mdlPath, 'trainedModelFront\trainedModelFrontLogisticReg.mat')); % default = trainedModelFrontLogisticReg.mat
load(fullfile(mdlPath, 'trainedModelPost\trainedModelPostTree.mat')); % default = trainedModelPostTree.mat
%%%%%%%%% Load a MUSE file %%%%%%%%
% Filter (DO NOT EDIT FOR CLASSIFIERS - NOT TESTED WITH OTHER CUTOFF FREQS)
EEG = pop_eegfiltnew(EEG,'locutoff',1);
EEG = pop_eegfiltnew(EEG,'hicutoff',50);
% Scan channels to flag them as bad
[badChan, badChanLabels] = scan_channels(EEG, trainedModelFront, trainedModelPost, max_bad, win_size, usegpu, vis);