EEGLAB ببساطة
الحوسبة على HPC
المحطة 9 · الدرس 6 · EEGLAB 2026.1
من الواجهة
- FileManage EEGLAB extensions
- ToolsNSG ToolsNSG account info
- ToolsNSG ToolsManage NSG jobs
السكربت
eeglab nogui
projectRoot = pwd;
outRoot = fullfile(projectRoot, 'derivatives', 'eeglab');
logRoot = fullfile(projectRoot, 'logs');
subjects = {'sub-002', 'sub-003', 'sub-004'};
taskId = str2double(getenv('SLURM_ARRAY_TASK_ID'));
if isnan(taskId), taskId = 1; end
subj = subjects{taskId};
fprintf('Job %d: %s\n', taskId, subj);
cfg.lineFreq = 50; % same settings as the batch lesson
cfg.eogLabels = {'EEG061', 'EEG062'};
cfg.dropLabels = {'EEG063', 'EEG064'};
try
outDir = fullfile(outRoot, subj, 'eeg');
EEG = pop_loadset('filename', sprintf('%s_task-FaceRecognition_eeg.set', subj), ...
'filepath', outDir);
EEG = pop_select(EEG, 'rmchannel', cfg.dropLabels);
fullLocs = EEG.chanlocs;
EEG = pop_eegfiltnew(EEG, 'locutoff', 0.1);
EEG = pop_eegfiltnew(EEG, 'locutoff', cfg.lineFreq - 2, 'hicutoff', cfg.lineFreq + 2, 'revfilt', 1);
EEG_test = pop_clean_rawdata(EEG, 'FlatlineCriterion', 5, 'ChannelCriterion', 0.8, ...
'LineNoiseCriterion', 4, 'Highpass', 'off', 'BurstCriterion', 'off', ...
'WindowCriterion', 'off', 'BurstRejection', 'off', 'Distance', 'Euclidian', ...
'channels_ignore', cfg.eogLabels);
badChans = setdiff({EEG.chanlocs.labels}, {EEG_test.chanlocs.labels}, 'stable');
if ~isempty(badChans)
EEG = pop_select(EEG, 'rmchannel', badChans);
end
if ~isempty(badChans)
EEG = pop_interp(EEG, fullLocs, 'spherical');
end
clear EEG_test
eogIdx = find(ismember({EEG.chanlocs.labels}, cfg.eogLabels));
EEG = pop_reref(EEG, [], 'exclude', eogIdx);
EEG_ica = pop_eegfiltnew(EEG, 'locutoff', 1);
tic;
EEG_ica = pop_runica(EEG_ica, 'icatype', 'runica', 'extended', 1);
fprintf('ICA finished in %.1f min\n', toc / 60);
icaInfo = struct('icaweights', EEG_ica.icaweights, 'icasphere', EEG_ica.icasphere, ...
'icachansind', EEG_ica.icachansind, 'badChans', {badChans});
save(fullfile(outDir, sprintf('%s_task-FaceRecognition_desc-ica.mat', subj)), ...
'-struct', 'icaInfo');
catch err
if ~exist(logRoot, 'dir'), mkdir(logRoot); end
fid = fopen(fullfile(logRoot, sprintf('%s_error.txt', subj)), 'w');
fprintf(fid, '%s\n', getReport(err, 'extended', 'hyperlinks', 'off'));
fclose(fid);
rethrow(err);
endأي قيمة أختار؟
| الإعداد | القيمة في الدرس |
|---|---|
| مشاركون لكل مهمة | واحد |
| طريقة التشغيل | matlab -batch |
| الذاكرة | 16G في المثال |
| الوقت المسموح | 4 ساعات في المثال |
| ما يُحفظ | أوزان ICA فقط |
لقسم Methods
Independent component analysis (extended Infomax; Lee et al., 1999) was computed with runica (EEGLAB 2026.1) for each participant on a copy of the preprocessed data high-pass filtered at 1 Hz, and the resulting weights were applied to the 0.1 Hz high-pass filtered data; jobs ran one per participant on [computing cluster] with MATLAB [version].