Skip to content

config

tit.source.config

Configuration dataclasses for EEG source-forward preparation.

Defines the two typed configs consumed by :mod:tit.source:

  • :class:ForwardConfig -- parameters for rebuilding an MNE-compatible EEG forward solution (leadfield, source space, fsaverage morph) from an existing SimNIBS head model.
  • :class:FsavgMapConfig -- parameters for projecting existing simulation field outputs (TI_max, TI_normal, hf_peak, hf_sar) onto an fsaverage template.

See Also

tit.source.forward.prepare_forward : Consumes :class:ForwardConfig. tit.source.fsaverage.project_fields_to_fsaverage : Consumes :class:FsavgMapConfig.

ForwardConfig dataclass

ForwardConfig(eeg_net: str = 'GSN-HydroCel-185', fsaverage_spacing: int = 5, cpus: int = 1, overwrite: bool = False)

Parameters for rebuilding a SimNIBS/MNE EEG forward solution.

Attributes

eeg_net : str EEG cap name without the .csv suffix, as found in the subject's m2m_<id>/eeg_positions/ directory (e.g. "GSN-HydroCel-185"). fsaverage_spacing : int fsaverage subdivision factor (5, 6, or 7) for the morph target. cpus : int SimNIBS FEM workers used while computing the leadfield. overwrite : bool Recompute even when valid outputs already exist. The expensive FEM leadfield is still reused when present unless this is True.

FsavgMapConfig dataclass

FsavgMapConfig(fields: tuple[str, ...] = (lambda: VALID_FSAVG_FIELDS)(), fsaverage_spacing: int = 5, workers: int = 1, overwrite: bool = False)

Parameters for projecting simulation field outputs onto fsaverage.

Attributes

fields : tuple of str Which field quantities to project. Any of :data:VALID_FSAVG_FIELDS ("TI_max", "TI_normal", "hf_peak", "hf_sar"). fsaverage_spacing : int fsaverage subdivision factor (5, 6, or 7) to morph onto. workers : int Number of subjects projected in parallel (1 = serial). overwrite : bool Re-project even when a cached .npz already exists.

SourceMode

Bases: StrEnum

Which :mod:tit.source pipeline a :class:SourceConfig drives.

Attributes

FORWARD : str Rebuild an EEG forward solution per subject (:class:ForwardConfig). FSAVG_MAP : str Project existing simulation fields onto fsaverage for (subject, simulation) pairs (:class:FsavgMapConfig).

SourcePair dataclass

SourcePair(subject_id: str, simulation: str)

One (subject, simulation) pair for the fsavg_map pipeline.

Attributes

subject_id : str Subject identifier (without sub- prefix). simulation : str Simulation (montage) folder name.

SourceConfig dataclass

SourceConfig(mode: SourceMode = FORWARD, subject_ids: list[str] = list(), pairs: list[SourcePair] = list(), forward: ForwardConfig = ForwardConfig(), fsavg_map: FsavgMapConfig = FsavgMapConfig())

Configuration for one :mod:tit.source runner invocation.

Wraps the two pipelines :mod:tit.source.__main__ dispatches on its "mode" field. Only the fields relevant to mode are read by the runner; the other pipeline's fields keep their defaults and are ignored, mirroring tit.source.__main__._run_forward / _run_fsavg_map exactly.

Attributes

mode : SourceMode "forward" or "fsavg_map". subject_ids : list of str Subjects to rebuild a forward solution for. Required (non-empty) when mode is "forward". pairs : list of SourcePair (subject, simulation) pairs to project onto fsaverage. Required (non-empty) when mode is "fsavg_map". forward : ForwardConfig Forward-solution parameters ("forward" mode only). fsavg_map : FsavgMapConfig fsaverage-projection parameters ("fsavg_map" mode only).

Raises

ValueError If mode is "forward" with an empty subject_ids, or "fsavg_map" with an empty pairs.

See Also

tit.source.main : The entry point whose dispatch this mirrors. ForwardConfig : Consumed by the "forward" pipeline. FsavgMapConfig : Consumed by the "fsavg_map" pipeline.