sccn / ICLabel

Automatic EEG IC classification plugin for EEGLAB
https://iclabel.ucsd.edu/tutorial
53 stars 19 forks source link

A proposal of a solution to eeg_rpsd index error #32

Closed eesimtmp closed 1 year ago

eesimtmp commented 1 year ago

Dear all, I have eeg files in edf format with different sampling frequencies. For the EEG.srate = 200 ones, the Automagic runs without a hitch. However, for the EEG.srate = 1000 ones, although runICA goes smoothly, but the ICLabel give the following error: (eeg_rpsd.m, line 35, index in position 2 is invalid)

Screen Shot 2023-02-24 at 1 51 32 PM

I found that in the eeg_rpsd.m file, when EEG.srate is 1kHz, the n_points variable becomes 1E3, which is treated as a float rather than an integer, causing the subsequent indexing to fail. A solution is proposed: add line 17 as shown in the next picture (n_points = round(n_points)

Screen Shot 2023-02-24 at 2 26 11 PM

After that, IClabel runs as intended, but I am curious if this solution breaks anything.

Sincerely yours, Edward Cheng.

arnodelorme commented 1 year ago

I think floor is a better choice. I have added it to the code at 49a38e4