sccn / eeglab

EEGLAB is an open source signal processing environment for electrophysiological signals running on Matlab and developed at the SCCN/UCSD
https://eeglab.ucsd.edu/
Other
604 stars 244 forks source link

pop_clean_rawdata: Index exceeds matrix dimensions. #508

Closed stevenylai closed 2 years ago

stevenylai commented 2 years ago

Description

I got this error when I am perform auto-rejection on bad data.

My processing script is roughly as follows:

EEG = pop_mffimport(fullfile(Dir, '/path/to/subject.mff', {'code'});
EEG = pop_chanedit(EEG, 'load', {'/path/to/egi.sfp', 'filetype', 'autodetect'});
EEG = pop_eegfiltnew(EEG, 'locutoff', 0.1, 'hicutoff', 30);
EEG = pop_clean_rawdata(EEG, 'FlatlineCriterion', 'off', ...
        'ChannelCriterion', 'off', 'LineNoiseCriterion', 'off', ...
        'Highpass', 'off', 'BurstCriterion', 20, 'WindowCriterion', 0.25, ...
        'BurstRejection', 'off', 'Distance', 'Euclidian', ...
        'WindowCriterionTolerances', [-7 7] );

Error was raised in pop_clean_rawdata

There are data sets from other subjects which are OK running the same script and by inspecting the channel data, I don't see anything special. The version I used is pulled from eeglab github recently (af77ddc49 updating cleanrawdata error message)


Steps to Reproduce

  1. Load the attached dataset
  2. Run the above pop_clean_rawdata function


Expected behavior:

Data set is cleaned successfully


Actual behavior:

An error was thrown


Versions

OS version Windows 10
Matlab version R2017b
EEGLAB version v2022.0
stevenylai commented 2 years ago

Trimmed data set here: crash.zip

arnodelorme commented 2 years ago

Your data is very very noisy (not judging :-) and there is not enough reference data. Call the function from the command line and try changing the ''BurstCriterionRefTolerances'' parameters (to -10 to 10 for example). This works for me on your data.

EEG = pop_clean_rawdata(EEG, 'FlatlineCriterion', 'off', 'ChannelCriterion', 'off', 'LineNoiseCriterion', 'off', 'Highpass', 'off', 'BurstCriterion', 20, 'WindowCriterion', 0.25,  'BurstRejection', 'off', 'Distance', 'Euclidian',  'WindowCriterionTolerances', [-50 50], 'BurstCriterionRefTolerances', [-10 10] );

I have added a more informative error message if this is the case.