Skip to content

mTI

tit.sim.mTI

N-pair Multi-channel Temporal Interference (mTI) simulation.

Implements :class:mTISimulation, the concrete BaseSimulation subclass for multi-channel TI stimulation with an arbitrary even number of electrode pairs (4, 6, 8, ...):

  • Each pair produces one HF E-field via SimNIBS TDCS.
  • Adjacent pairs are combined into intermediate 2-pair TI vector fields, saved for inspection only.
  • The final mTI envelope is the verified K-pair modulation-depth envelope (:func:tit.calc.get_mTI_vectors) over all N carrier fields jointly -- not a recursive binary-tree TI-of-TI combination of the intermediate fields above (that approximation is deprecated; see :func:tit.calc.get_nTI_vectors).
  • Which pairs share a carrier -- and therefore beat against each other -- is explicit via montage.channels (:class:tit.sim.config.Montage), passed through unchanged to :func:get_mTI_vectors/:func:get_TI_avg. channels=None is the default independent-dyad architecture below; it is not the only option (see :func:tit.calc._resolve_channels).

Example with 4 pairs (A/B/C/D), default independent-dyad grouping (channels=None, equivalent to [([0], [1]), ([2], [3])])::

TI_AB = TI(E_A, E_B)                       # intermediate, inspection only
TI_CD = TI(E_C, E_D)                       # intermediate, inspection only
mTI   = get_mTI_vectors([E_A, E_B, E_C, E_D])

See Also

BaseSimulation : Abstract base class providing the run template. TISimulation : Standard 2-pair TI variant. SimulationConfig : Configuration consumed by the simulation. run_simulation : Top-level orchestration that dispatches to this class.

mTISimulation

mTISimulation(config: SimulationConfig, montage: Montage, logger)

Bases: BaseSimulation

Run a single N-pair mTI simulation (N >= 4, even).

Pipeline
  1. Set up BIDS output directory structure.
  2. Visualize electrode placement.
  3. Build SimNIBS SESSION (N TDCS lists), run FEM.
  4. Compute intermediate 2-pair TI vector fields (adjacent pairings, saved for inspection only).
  5. Compute final mTI_max from the verified K-pair modulation-depth envelope over all N carrier fields, grouped into carriers per montage.channels (None = one carrier per pair), plus its orientation-averaged companion TI_avg and the hf_peak/ hf_sar carrier-exposure safety maps (always over all N fields, regardless of channels).
  6. Extract GM/WM meshes, convert to NIfTI, organize outputs.
See Also

BaseSimulation : Parent class with shared setup and template run. TISimulation : Standard 2-pair variant.

Source code in tit/sim/base.py
def __init__(self, config: SimulationConfig, montage: Montage, logger):
    self.config = config
    self.montage = montage
    self.logger = logger
    self.pm = get_path_manager()
    self.m2m_dir = self.pm.m2m(config.subject_id)