-
Notifications
You must be signed in to change notification settings - Fork 0
Quick sanity check
Although there is a lot we can accomplish with automatic data cleaning procedures, including PEB+, ICA, and other algorithms, we recommend to always sanity check the data visually. Most automatic cleaning algorithms compute statistics on the entire data set and assume that artifacts are uncommon and far from a "normal" tendency (whatever that may be). So if we have a data set that is mostly artifacts, there is not much hope in automatic cleaning, and most likely that subject should be left out of the analysis on the basis that there is not much brain activity there.
Here I propose a straightforward first resort for identifying if gross artifacts are present in the data visually. It assumes that the user knows what artifacts and brain signals look like so that after a quick visual inspection an informed decision can be made on whether to exclude or not a given subject from further analysis. The procedure outlined below should not be followed as dogma but is just the one that I use to quickly assess the quality of my data before moving on to a more in-depth analysis.
For less experienced users, a good place to start learning about the common artifacts affecting the electroencephalogram is: Electroencephalography (EEG): An Introductory Text and Atlas of Normal and Abnormal Findings in Adults, Children, and Infants.
Everything correctly added to MATLAB's path.
dataFolder = 'path/to/data/files'; % This is the folder where your data files are
ext = '.xdf'; % Indicate the extention of the files you are going to review
% For example use '.xdf' for reviewing raw .xdf data or '.set' for
% files that are already in the .set format (could be minimally
% processed or even epoched data)
files = pickfiles(dataFolder,ext); % Select the file. If file is empty check that the `dataFolder` and
% `ext` are set correctly
h = waitbar(0);
for k=1:size(files,1)
disp(k); % Display the file number so that you can take note of which one was bad
if strcmp(ext,'.xdf') % Modify the conditions to accomodate other file formats. You may
EEG = pop_loadxdf(deblank(files(k,:))); % not need this IF at all if you only review one type of file
elseif strcmp(ext,'.set')
EEG = pop_loadset(deblank(files(k,:)));
end
EEG = pop_eegfiltnew(EEG, 0.5,45,3300,0,[],0); % Apply a band pass filter between 0.5 Hz and 45 Hz so that we
% eliminate the DC offset and possible 50/60 Hz AC line noise. If high
% amplitude artifacts, electrop pops, etc. are present they are not going
% to be removed by this filter.
fig = pop_eegbrowser(EEG); % Use the scroll bar of the browser to review the recording, close it when
% you are done with your assessment, and annotate if the file should be
% removed.
waitfor(fig.figureHandle); % Once you close the browser we move on to the next file
waitbar(k/size(files,1),h);
end
close(h);