Description
I'm trying to run a simple preprocessing pipeline for 3 different runs, two resting state and one main task. However, the pipeline fails at a step where the covariance is calculated, which I set to "empty-room" (which are successfully assigned in the first step of the pipeline)
It seems like the function wants to access a file that has not (yet?) been written/computed.
┌────────┬ sensor/_06_make_cov ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│16:48:32│ ❌ sub-05 A critical error occurred. The error message was: missing in_files["raw"] = /data/fastreplay/Fast-Replay-MEG-bids/derivatives/sub-05/meg/sub-05_task-noise_proc-clean_raw.fif
Aborting pipeline run. The traceback is:
File "/zi/home/simon.kern/anaconda3/lib/python3.11/site-packages/mne_bids_pipeline/_run.py", line 55, in __mne_bids_pipeline_failsafe_wrapper__
out = memory.cache(func)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/zi/home/simon.kern/anaconda3/lib/python3.11/site-packages/mne_bids_pipeline/_run.py", line 179, in wrapper
hashes.append(hash_(k, v))
^^^^^^^^^^^
File "/zi/home/simon.kern/anaconda3/lib/python3.11/site-packages/mne_bids_pipeline/_run.py", line 456, in _path_to_str_hash
assert v.exists(), f'missing {kind}_files["{k}"] = {v}'
Sorry for spamming so many issues, I'm really trying to get the pipeline working and mostly I can move forward by trial-and-error, but for this error I'm lost where to even begin searching.
So far the pipeline has successfully created the files for the main
task ('sub-02_task-main_proc-clean_raw'), but the rest
sessions are missing yet and not computed. Not sure if the pipeline will do that after the main is completely calculated?
pipeline_config.py
###############################################################################
### Preprocessing pipeline settings for mne-bids-pipeline |
###############################################################################
from collections.abc import Callable, Sequence
from typing import Annotated, Any, Literal
from annotated_types import Ge, Interval, Len, MinLen
from mne import Covariance
from mne_bids import BIDSPath
from mne_bids_pipeline.typing import (
# ArbitraryContrast,
# DigMontageType,
# FloatArrayLike,
PathLike,
)
# %%05
# # General settings
# Configuration file for mne-bids-pipeline
from typing import Sequence, Literal, Optional
from mne import Covariance
from mne_bids import BIDSPath
# %%
# General Settings
bids_root: PathLike | None = '/data/fastreplay/Fast-Replay-MEG-bids/'
deriv_root: PathLike = f"{bids_root}/derivatives/" # Save all processed data under /derivatives/
subjects_dir: Optional[PathLike] = f"{deriv_root}/freesurfer/subjects/" # Path to FreeSurfer subject reconstructions
interactive: bool = False # Disable interactive elements
# sessions: Literal["all"] = "all" # Process all sessions
# task: str = "" # Process all tasks by leaving empty
task_is_rest: bool = True # Treat data as resting-state, disable epoching
# runs: Literal["all"] = "all" # Process all runs
exclude_runs: Optional[dict[str, list[str]]] = None # No excluded runs
subjects: Sequence[str] | Literal["all"] = "all" # Analyze all subjects
exclude_subjects: Sequence[str] = ['23'] # No excluded subjects
process_empty_room: bool = True # Preprocess empty-room data
process_rest: bool = True # Preprocess resting-state data
ch_types: Sequence[Literal["meg"]] = ["meg"] # Include MEG and EEG channels
data_type: Literal["meg", "eeg"] = "meg" # Data type is MEG
eog_channels: Sequence[str] = ["BIO002", "BIO003"] # Specify EOG channels
ecg_channel: str = "BIO001" # Specify ECG channel
spatial_filter: Literal["ica"] = "ica" # Use ICA for artifact removal
ica_n_components: int = 50 # Number of ICA components
ica_algorithm: str = 'picard'
rest_epochs_duration = 2
rest_epochs_overlap = 0
epochs_tmin = 0
# on_error = 'continue'
exclude_subjects: Sequence[str] = ['01', '23']
baseline = None
# %%
# Preprocessing
raw_resample_sfreq: float = 100.0 # Resample data to 100 Hz
l_freq: float = 0.1 # Apply high-pass filter at 0.1 Hz
h_freq: Optional[float] = None # Disable low-pass filter
notch_freq: Sequence[float] = [50.0] # Apply notch filter at 50 Hz
notch_trans_bandwidth: float = 1.0 # Set notch filter transition bandwidth to 1 Hz
# %%
# Artifact Removal via ICA
# The pipeline will automatically identify and remove ICA components related to EOG and ECG.
# %%
# Source-level Analysis
run_source_estimation: bool = True # Enable source-level analysis
inverse_method: Literal["dSPM"] = "dSPM" # Use dSPM as the inverse solution method
loose: float = 0.2 # Weigh parallel dipole components by 0.2
depth: float = 0.8 # Set depth weighting exponent to 0.8
noise_cov = "emptyroom" # Use resting-state recording for noise covariance
# # %%
# # FreeSurfer recon-all Settings
recon_all: bool = True # Enable FreeSurfer's recon-all
freesurfer_verbose: bool = True # print the complete recon-all pipeline
# %%
# Parallelization
n_jobs: int = 4 # Use all available CPU cores
parallel_backend: Literal["loky"] = "loky" # Use 'loky' backend for parallel processing
# %%
# Logging
log_level: Literal["info"] = "info" # Set pipeline logging verbosity to 'info'
mne_log_level: Literal["error"] = "error" # Set MNE-Python logging verbosity to 'error'
# %%
# Error Handling
on_error: Literal["abort"] = "abort" # Abort processing on errors
config_validation: Literal["raise"] = "raise" # Raise exceptions on config validation issues
Activity