- MNE version: 1.11.0
- operating system: WSL: Ubuntu-22.04
Hi everyone!
I’m a young researcher very new to MEG analysis and MNE… looking for some help ![]()
I’m currently adapting an MEG pre-processing pipeline written in Neuropycon to MNE-BIDS-Pipeline.
I’m working with already BIDSified CTF resting state data, but I had to BIDSify emptyroom recordings for the pipeline to correctly retrieve them: following BIDS guidelines and what I found on this forum, I stored the .ds data in sub-emptyroom with sessions in the format ses-YYYYMMDD, also updating the AssociatedEmptyRoom field in the sidecar .json.
Up until now I proceeded searching for the best matching configuration options that could allow me to replicate (I admit, almost blindly) my reference pipeline via the config file.
Now I’m stuck on this error (in the preprocessing/_08a_apply_ica step) that is somehow out of my comprehension:
│10:07:22│ ❌ sub-063 ses-01 run-noise A critical error occurred. The error message was: Compensation grade of ICA (3) and Raw (0) do not match
Aborting pipeline run. The traceback is:
File “/home/leozm/CRNL_projects/envs/MNEBIDS_mimosa_env/lib/python3.10/site-packages/mne_bids_pipeline/steps/preprocessing/_08a_apply_ica.py”, line 213, in apply_ica_raw
ica.apply(raw)
File “”, line 12, in apply
File “/home/leozm/CRNL_projects/envs/MNEBIDS_mimosa_env/lib/python3.10/site-packages/mne/preprocessing/ica.py”, line 2255, in apply
_check_compensation_grade(
File “/home/leozm/CRNL_projects/envs/MNEBIDS_mimosa_env/lib/python3.10/site-packages/mne/utils/check.py”, line 381, in _check_compensation_grade
raise RuntimeError(
As far as I understood, during ICA the experimental data is compared to emptyroom and given that they have different compensation grades the error occurs.
I’m using emptyroom in order to calculate the noise covariance matrix for the inverse problem, but talking with some colleagues seems that for CTF that is useless (?).
Anyway I ask you help for understanding what’s going on and orient myself better
.
This is my config.py for the moment:
sessions = ["01"]
task = 'rest'
task_is_rest = True
runs = ["01"]
subjects = ["063"]
process_empty_room = True
# QUESTION: I initially set ch_types = ["meg"], but then during preprocessing/_06a1_fit_ica the "grad" key in ica_reject caused this error:
# No GRAD channel found. Cannot reject based on GRAD.
# Why this??
ch_types = ["mag", "grad"]
data_type = "meg"
random_state = 42
l_freq = 0.1
h_freq = 150
raw_resample_sfreq = 300
epochs_tmin = 0.0
rest_epochs_duration = 2.0
rest_epochs_overlap = 0.0
spatial_filter = "ica"
ica_reject = {
"mag": 5e-12,
"grad": 5000e-13
}
ica_algorithm = "fastica"
ica_l_freq = 1.0
ica_max_iterations = 1000
ica_n_components = 0.95
run_source_estimation = True
inverse_method = "MNE"
noise_cov = "emptyroom"
noise_cov_method = "empirical"
Thanks a lot for any advice!!!