debugging 1st level stats - LIMO-EEG-Toolbox/limo_tools GitHub Wiki
%# LIMO batch outputs
When you run an analysis for multiple subjects, LIMO MEEG uses limo_batch.
The batch means it uses psom to create a pipeline, processing subjects in parallel and capturing errors. If all subjects fail there is something clearly wrong either with the data or the design. There is nothing we can recommend except checking your epochs and events. It can also be the case that some subjects failed, and that's where debugging comes into full play.
- batch_report*.txt_ lists the subject and if the processing worked or failed.
- in the limo_batch_report folder, details of the pipeline are available for each subject.
Use psom report feature
PIPE_history.txt tells you which job fails
psom_pipeline_visu(path_to_psom_subject,'log',job_name)
will tell you what went wrong (with job_name
the name of the job that failed)
NOTE: 99% OF THE TIME, 1ST LEVEL ESTIMATION FAILURE IS DUE TO NOT HAVING ENOUGH TRIALS FOR THE TIME AND OR FREQUENCY SPACE SELECTED (SEE HOW TO OPTIMIZE THIS) - SIMPLY HAVING SMALLER WINDOWS OFTEN WORK, ALTERNATIVELY USE 'OLS' RATHER THAN 'WLS' TO ESTIMATE THE MODEL (NOT AS GOOD).
re-running the pipeline
One advantage of pipelines is that it re-runs the analysis only from where it failed. Assuming the error was obvious to spot, you can just re-run the failed subject(s) using limo_pipeline_*.mat
load limo_pipeline_*.mat
and the pipeline structure is listed
pipeline.import
contains the command, the file to read and events for the design
pipeline.design
contains the command and
pipeline.glm
pipeline.n_contrast
re-run the whole pipeline
1st, reset the pipeline options (for instance same as in limo_batch)
opt.mode = 'session'; % run in the current session -- see psom for other options // in batch we use parfor
opt.max_queued = Inf; % with a maximum of possible sessions
opt.time_between_checks = 2; % and 2sec between job submission
opt.flag_pause = false; % don't bother asking to start jobs
opt.flag_debug = true; % report a bit more of issues
opt.path_logs = 'path to my subjects log';
psom_gb_vars
2nd delete the faulty subject's LIMO folder/files (if it contains a LIMO.mat that will mess-up the import)
3rd call the pson_run_pipeline command for that subject
psom_run_pipeline(pipeline(subject),opt)
run part of the pipeline
you can breakpoint the limo code to figure out where it fails and why, calling each part of the pipeline as follow
limo_batch_import_data(pipeline(subject).import.files_in,pipeline(subject).import.opt.cat,pipeline(subject).import.opt.cont,pipeline(subject).import.opt.defaults
)
limo_batch_design_matrix(pipeline(subject).design.files_in)
cd(fileparts(pipeline(subject).glm.files_in)); limo_eeg(4)
limo_batch_contrast(pipeline(subject).n_contrast.files_in,pipeline(subject).n_contrast.opt.C)