buckets
tit.opt.ex.buckets ¶
Helpers for reusable exhaustive-search electrode buckets.
Ported from collaborator Larissa Albantakis's branch
alba/ex-search-multipolar and generalized: the loader/saver/normalizer
accept an arbitrary ordered bucket-key list instead of a hard-coded 4-key
scheme, so both 2-pair (:data:BUCKET_KEYS) and 4-pair
(:data:tit.opt.mex.logic.MEX_BUCKET_KEYS) bucket files share the same
JSON/CSV/TSV round-trip.
normalize_buckets ¶
Normalize a bucket mapping to canonical bucket keys.
keys defaults to the four 2-pair ex-search bucket keys
(:data:BUCKET_KEYS); pass the eight m-ex-search keys
(:data:tit.opt.mex.logic.MEX_BUCKET_KEYS) to normalize a 4-pair
(8-electrode) bucket mapping through the same function.
Source code in tit/opt/ex/buckets.py
load_bucket_file ¶
Load bucket definitions from JSON, CSV, or TSV.
JSON may use canonical keys (e1_plus) or GUI-style keys
(E1+). Full ex-search/m-ex-search config JSON files with nested
electrodes are also accepted. CSV/TSV files should have one row
per bucket, with the bucket name in the first column and electrodes
in the remaining columns or as a comma/semicolon separated second
column. keys selects the bucket scheme -- the four 2-pair keys by
default, or an arbitrary key list (e.g. the eight m-ex-search keys)
for other electrode-position counts.
Source code in tit/opt/ex/buckets.py
save_bucket_file ¶
save_bucket_file(path: str | Path, buckets: dict[str, list[str]], keys: Sequence[str] = BUCKET_KEYS) -> None
Save bucket definitions as JSON.
Source code in tit/opt/ex/buckets.py
canonical_template_coord_path ¶
Return a canonical 2D EEG-template coordinate file for known net names.
Source code in tit/opt/ex/buckets.py
build_electrode_mirror_map ¶
build_electrode_mirror_map(eeg_csv_path: str | Path, *, midline_tolerance: float = 1e-06) -> dict[str, str]
Map each electrode to its closest left/right mirror in an EEG CSV.
The mirror is defined by reflecting the x-coordinate across the midline while preserving the anterior/posterior coordinate. Midline electrodes are mapped to themselves; downstream channel-pair validation still prevents self-pairs from being evaluated.
Source code in tit/opt/ex/buckets.py
build_quadrant_buckets ¶
Split an EEG-position CSV into four RAS quadrants.
Mapping: E1+ = left anterior, E1- = right anterior,
E2+ = left posterior, E2- = right posterior.