sccn / amica

Code for AMICA: Adaptive Mixture ICA with shared components
BSD 2-Clause "Simplified" License
23 stars 13 forks source link

AMICA on EEGLAB 15 #7

Open neurolinguist opened 5 years ago

neurolinguist commented 5 years ago

Dear Dr. Jason Palmer,

I would like to run AMICA on EEGLAB 15 by a batch script. I edited the code by Makoto, but I get the following error message.

Error using ' Transpose on ND array is not defined. Use PERMUTE instead.

I am sorry, but could you tell me the wrong points in the command below?

cd('/Users/Warehouse/Document2/inference2018/epoched2019-2_correct') allfiles = dir('*.set'); for n=1:length(allfiles) loadName=allfiles(n).name; dataName=loadName(1:end-4);

EEG = pop_loadset(loadName); EEG.setname = dataName;

if isfield(EEG.etc, 'clean_channel_mask')
    dataRank = min([rank(double(EEG.data')) sum(EEG.etc.clean_channel_mask)]);
else
    dataRank = min(rank(double(EEG.data')));
end
runamica15(EEG.data, 'num_chans', EEG.nbchan,...
    'outdir', ['/Users/Warehouse/Document2/inference2018/epoched2019-2_correct/amicaout/' dataName],...
    'pcakeep', dataRank, 'num_models', 1,...
    'do_reject', 1, 'numrej', 15, 'rejsig', 3, 'rejint', 1);
EEG.etc.amica  = loadmodout15(['/Users/Warehouse/Document2/inference2018/epoched2019-2_correct/amicaout/' dataName]);
EEG.etc.amica.S = EEG.etc.amica.S(1:EEG.etc.amica.num_pcs, :); 
EEG.icaweights = EEG.etc.amica.W;
EEG.icasphere  = EEG.etc.amica.S;
EEG = eeg_checkset(EEG, 'ica');

Thank you in advance.

Sincerely, -Shingo Tokimoto

japalmer29 commented 5 years ago

Hi Shingo, Looks like the error is in the rank command with EEG.data' ... You probably have epoched data, so you need EEG.data(:,:)' ... To reshape to 2d ... Bit the rank command shouldn't be necessary as it has some arbitrary not necessarily optimal threshold ... Amica will reduce the dimension of minimum eigenvaluesa are below a minimum precision threshold. Best, Jason

On Sun, Oct 28, 2018, 1:21 AM neurolinguist notifications@github.com wrote:

Dear Dr. Jason Palmer,

I would like to run AMICA on EEGLAB 15 by a batch script. I edited the code by Makoto, but I get the following error message.

Error using ' Transpose on ND array is not defined. Use PERMUTE instead. I am sorry, but could you tell me the wrong points in the command below?

cd('/Users/Warehouse/Document2/inference2018/epoched2019-2_correct') allfiles = dir('*.set'); for n=1:length(allfiles) loadName=allfiles(n).name; dataName=loadName(1:end-4);

EEG = pop_loadset(loadName); EEG.setname = dataName;

if isfield(EEG.etc, 'clean_channel_mask') dataRank = min([rank(double(EEG.data')) sum(EEG.etc.clean_channel_mask)]); else dataRank = min(rank(double(EEG.data'))); end runamica15(EEG.data, 'num_chans', EEG.nbchan,... 'outdir', ['/Users/Warehouse/Document2/inference2018/epoched2019-2_correct/amicaout/' dataName],... 'pcakeep', dataRank, 'num_models', 1,... 'do_reject', 1, 'numrej', 15, 'rejsig', 3, 'rejint', 1); EEG.etc.amica = loadmodout15(['/Users/Warehouse/Document2/inference2018/epoched2019-2_correct/amicaout/' dataName]); EEG.etc.amica.S = EEG.etc.amica.S(1:EEG.etc.amica.num_pcs, :); EEG.icaweights = EEG.etc.amica.W; EEG.icasphere = EEG.etc.amica.S; EEG = eeg_checkset(EEG, 'ica');


Thank you in advance.

Sincerely, -Shingo Tokimoto

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/japalmer29/amica/issues/7, or mute the thread https://github.com/notifications/unsubscribe-auth/AKISSrUf2K2bTlh5YzZ0qXzU4OSi4bybks5upIfugaJpZM4X9g74 .

neurolinguist commented 5 years ago

Dear Dr. Jason Palmer,

Thank you for the quick reply. I have edited the script, and it is running. I have run EEGLAB on Matlab 2014a on Mac OS, but the script does not run on this version of Matlab. The edited script runs on Matlab 2018a. Can I understand AMICA 1.5.1 or EEGLAB 15 is dependent on the version of Matlab? Thank you very much again.

Sincerely, -Shingo Tokimoto

japalmer29 commented 5 years ago

It shouldn't depend on the Matlab version. The new release of Amica for eeglab just contains an mpi library install for Windows machines. Best, Jason

On Sun, Oct 28, 2018, 7:22 PM neurolinguist notifications@github.com wrote:

Dear Dr. Jason Palmer,

Thank you for the quick reply. I have edited the script, and it is running. I have run EEGLAB on Matlab 2014a on Mac OS, but the script does not run on this version of Matlab. The edited script runs on Matlab 2018a. Can I understand AMICA 1.5.1 or EEGLAB 15 is dependent on the version of Matlab? Thank you very much again.

Sincerely, -Shingo Tokimoto

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/japalmer29/amica/issues/7#issuecomment-433692557, or mute the thread https://github.com/notifications/unsubscribe-auth/AKISSrdIEyDzXsY2IYkm3CpfdMuRHCKMks5upYV2gaJpZM4X9g74 .