opt
tit.opt ¶
TI-Toolbox optimization package.
Public API¶
run_flex_search(config) -> FlexResult-- differential-evolution optimizationrun_ex_search(config) -> ExResult-- exhaustive / grid search
FlexConfig
dataclass
¶
FlexConfig(subject_id: str, project_dir: str, goal: OptGoal, postproc: FieldPostproc, current_mA: float, electrode: ElectrodeConfig, roi: SphericalROI | AtlasROI | SubcorticalROI, anisotropy_type: str = 'scalar', aniso_maxratio: float = 10.0, aniso_maxcond: float = 2.0, non_roi_method: NonROIMethod | None = None, non_roi: SphericalROI | AtlasROI | SubcorticalROI | None = None, thresholds: str | None = None, eeg_net: str | None = None, enable_mapping: bool = False, disable_mapping_simulation: bool = False, output_folder: str | None = None, run_final_electrode_simulation: bool = False, n_multistart: int = 1, max_iterations: int | None = None, population_size: int | None = None, tolerance: float | None = None, mutation: str | None = None, recombination: float | None = None, cpus: int | None = None, detailed_results: bool = False, visualize_valid_skin_region: bool = False, skin_visualization_net: str | None = None)
Full configuration for flex-search optimization.
SphericalROI
dataclass
¶
Spherical region of interest defined by center + radius.
AtlasROI
dataclass
¶
Cortical surface ROI from a FreeSurfer annotation atlas.
SubcorticalROI
dataclass
¶
Subcortical volume ROI from a volumetric atlas.
ElectrodeConfig
dataclass
¶
ElectrodeConfig(shape: str = 'ellipse', dimensions: list[float] = (lambda: [8.0, 8.0])(), gel_thickness: float = 4.0)
Electrode geometry for flex-search.
Only gel_thickness is needed here — the optimization leadfield uses point electrodes; gel_thickness is recorded in the manifest for downstream simulation.
FlexResult
dataclass
¶
FlexResult(success: bool, output_folder: str, function_values: list[float], best_value: float, best_run_index: int)
Result from a flex-search optimization run.
ExConfig
dataclass
¶
ExConfig(subject_id: str, project_dir: str, leadfield_hdf: str, roi_name: str, electrodes: BucketElectrodes | PoolElectrodes, total_current: float = 2.0, current_step: float = 0.5, channel_limit: float | None = None, roi_radius: float = 3.0, run_name: str | None = None)
Full configuration for exhaustive search optimization.
BucketElectrodes
dataclass
¶
Separate electrode lists for each bipolar channel position.
ExResult
dataclass
¶
ExResult(success: bool, output_dir: str, n_combinations: int, results_csv: str | None = None, config_json: str | None = None)
Result from an exhaustive search run.
run_ex_search ¶
Run exhaustive search from a typed config object.
Source code in tit/opt/ex/ex.py
run_flex_search ¶
run_flex_search(config: FlexConfig) -> FlexResult
Run flex-search optimization from a typed FlexConfig.
Source code in tit/opt/flex/flex.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |