tit
tit ¶
TI-Toolbox: Temporal Interference Brain Stimulation Platform.
A neuroscience research platform for simulating, optimizing, and analyzing temporal interference (TI) stimulation of the brain. Built on top of SimNIBS for finite-element modeling and FreeSurfer for cortical reconstruction.
Modules¶
sim
TI/mTI simulation engine (electrode montages, field computation).
opt
Optimization of electrode placements (flex-search, exhaustive).
analyzer
Field analysis, ROI statistics, and visualization.
stats
Permutation testing and group-level comparisons.
pre
Preprocessing pipelines (DICOM conversion, FreeSurfer, CHARM).
gui
PyQt5 desktop interface (runs inside Docker with X11).
cli
Command-line tools built on a shared BaseCLI base class.
reporting
HTML report generation with composable reportlets.
Public API¶
get_path_manager
Return the global :class:~tit.paths.PathManager singleton.
setup_logging
Configure the package-wide logging level.
add_file_handler
Attach a file handler to a named logger.
add_stream_handler
Attach a console handler to a named logger.
paths
BIDS-compliant path resolution module.
constants
Project-wide constants and configuration values.
Examples¶
from tit import get_path_manager pm = get_path_manager("/data/project") from tit.sim import SimulationConfig, run_simulation
Notes¶
Importing this package auto-initializes logging (with stream output at
INFO level) and exposes get_path_manager for BIDS path resolution.
No additional setup is required for typical usage.
setup_logging ¶
setup_logging(level: str = 'INFO') -> None
Configure the tit logger hierarchy.
Sets the log level but adds no handlers — file handlers are attached
later via :func:add_file_handler and GUI handlers via Qt signal bridges.
Parameters¶
level : str, optional
Logging level name (e.g., "DEBUG", "INFO"). Default is
"INFO".
See Also¶
add_file_handler : Attach a file handler to a named logger. add_stream_handler : Attach a console handler to a named logger.
Source code in tit/logger.py
add_file_handler ¶
add_file_handler(log_file: str | Path, level: str = 'DEBUG', logger_name: str = 'tit') -> FileHandler
Attach a file handler to a named logger.
Creates the parent directory if it does not exist. Returns the handler so callers can remove it when the run completes.
Parameters¶
log_file : str or pathlib.Path
Path to the log file (opened in append mode).
level : str, optional
Minimum log level for this handler. Default is "DEBUG" so the
file captures everything.
logger_name : str, optional
Logger to attach to. Default is "tit" (the package root).
Returns¶
logging.FileHandler The newly created handler.
See Also¶
setup_logging : Set the package-wide log level. add_stream_handler : Attach a console (stdout) handler. get_file_only_logger : Create an isolated file-only logger.
Source code in tit/logger.py
add_stream_handler ¶
add_stream_handler(logger_name: str = 'tit', level: str = 'INFO') -> StreamHandler
Attach a stdout handler to a named logger.
Used by scripts for terminal output and by __main__ entry points
so that BaseProcessThread can capture subprocess stdout for the GUI.
Parameters¶
logger_name : str, optional
Logger to attach to. Default is "tit".
level : str, optional
Minimum log level. Default is "INFO".
Returns¶
logging.StreamHandler The newly created handler.
See Also¶
setup_logging : Set the package-wide log level. add_file_handler : Attach a file handler.
Source code in tit/logger.py
get_path_manager ¶
get_path_manager(project_dir: str | None = None) -> PathManager
Return the global :class:PathManager singleton.
Creates a new instance on the first call. If project_dir is provided,
the singleton's :attr:~PathManager.project_dir is (re)set.
Parameters¶
project_dir : str or None, optional Project root directory. When None, the existing value (or environment auto-detection) is used.
Returns¶
PathManager The shared singleton instance.
See Also¶
reset_path_manager : Destroy the singleton for testing or re-init.