[Eeglablist] AMICA Error on Mac

Kelly Michaelis kcmichaelis at gmail.com
Mon Sep 10 14:48:56 PDT 2018


Hi everyone,

I have been running into this error with AMICA on mac Sierra 10.12.6 using
EEGLAB version 14_1_2b. Most of time it works just fine, but then on some
files it fails and I can't figure out why. The files on which it fails
don't seem to be different in any observable way. I installed AMICA through
the GUI, and I have tried uninstalling and reinstalling to no avail.

I'm hoping one of you can help.

My script was adapted from Makato's script
<https://sccn.ucsd.edu/wiki/Makoto's_useful_EEGLAB_code>and is as follows
(no spaces in path):


for iFile = iFiles

          disp(['starting subject' currentSub 'file' num2str(iFile)])

          curoutfname = ['S' currentSub '0' num2str(iFile)
'postASRpostICA.set'];

          cutfulloutputfname = fullfile(postICAdir,curoutfname); % so we
can check if an output file exists already (so we can potentially bail on
this iteration of a loop so we don't redo work)

          if exist(cutfulloutputfname,'file')
              disp(['File ' cutfulloutputfname ' already exists,
bailing...'])
              continue % break?
          end

            %reload to clear
            eeglab

            EEG = pop_loadset('filename',['S' currentSub '0'
num2str(iFile)  'postASRpreICA.set'],'filepath',preICAdir);

            %  Run AMICA using calculated data rank with 'pcakeep' option
            if isfield(EEG.etc, 'clean_channel_mask')
                dataRank = min([rank(double(EEG.data'))
sum(EEG.etc.clean_channel_mask)]);
            else
                dataRank = rank(double(EEG.data'));
            end
            amicaoutdir = fullfile(postICAdir,['S' currentSub '0'
num2str(iFile)  'amicaout']);
            runamica15(EEG.data, 'num_chans', EEG.nbchan,...
                'outdir', amicaoutdir, ... % [ postICAdir '/S' currentSub
'0' num2str(iFile)  'amicaout'],...
                'pcakeep', dataRank, 'num_models', 1,...
                'do_reject', 1, 'numrej', 15, 'rejsig', 3, 'rejint', 1);
            EEG.etc.amica  = loadmodout15(amicaoutdir); %
fullfile(postICAdir,['S' currentSub '0' num2str(iFile)  'amicaout']));
            EEG.etc.amica.S = EEG.etc.amica.S(1:EEG.etc.amica.num_pcs, :);
% Weirdly, I saw size(S,1) be larger than rank. This process does not hurt
anyway.
            EEG.icaweights = EEG.etc.amica.W;
            EEG.icasphere  = EEG.etc.amica.S;
            EEG = eeg_checkset(EEG, 'ica');


            EEG = pop_saveset( EEG, 'filename',curoutfname,'filepath',
postICAdir);
           %EEG = pop_saveset( EEG, 'filename',['S' currentSub '0'
num2str(iFile)  'postASRpostICA.set'],'filepath', postICAdir);

            disp(['done with' currentSub 'file' num2str(iFile)])
     end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20180910/b575a1e9/attachment.html>


More information about the eeglablist mailing list