Mapping Constants#
Channel mappings, aliases, and sort orders.
Channel and metadata mapping constants.
The channel model is a flat list of channels: each canonical channel abbreviation
("LMot", "LHip", …) is the atomic unit, declared once in CHANNEL_MAP
together with the raw channel-name spellings that resolve to it. Everything else about
channels — the canonical order (CHANNEL_ABBREVS), the DataFrame sort order
(DF_SORT_ORDER), the standardization target, and the LOF evaluation set — is
derived from that single source via neurodent.constants.set_channel_map().
There is no separate region/hemisphere model; left/right is part of the channel identity.
- neurodent.constants.mappings.DEFAULT_GENOTYPE_MAP = {}#
Module default for
GENOTYPE_MAP(empty = passthrough).apply_samples_configresets the live map to this when a dataset omits aGENOTYPE_MAPblock, so applying one dataset’s config never leaks its map into the next.
- neurodent.constants.mappings.GENOTYPE_MAP = {}#
Exact
{canonical_label: [accepted spellings]}map normalizing the per-animalgenotypevalue to a canonical short label (parallelsCHANNEL_MAPandSEX_MAP; matched exactly, never fuzzily). Empty default = passthrough (the rawgenotypevalue is kept as-is, for datasets that don’t need normalization). When populated it is authoritative: a value it does not cover raises at load (just as an unknown raw channel name does), so config typos surface immediately. Populated per-dataset viaGENOTYPE_MAPin the samples config (reset toDEFAULT_GENOTYPE_MAPwhen absent).
- neurodent.constants.mappings.DEFAULT_SEX_MAP = {'Female': ['Female', 'female', 'F', 'f'], 'Male': ['Male', 'male', 'M', 'm']}#
Module default for
SEX_MAP(the standard M/F spellings).apply_samples_configresets the live map to a copy of this when a dataset omits aSEX_MAPblock.
- neurodent.constants.mappings.SEX_MAP = {'Female': ['Female', 'female', 'F', 'f'], 'Male': ['Male', 'male', 'M', 'm']}#
Exact
{canonical_label: [accepted spellings]}map normalizing the per-animalsexvalue (parallelsGENOTYPE_MAP; matched exactly). Authoritative when populated — an uncovered value raises at load. Populated per-dataset viaSEX_MAPin the samples config (reset toDEFAULT_SEX_MAPwhen absent).
- neurodent.constants.mappings.CHANNEL_MAP = {'LAud': ['LAud'], 'LBar': ['LBar'], 'LHip': ['LHip'], 'LMot': ['LMot'], 'LVis': ['LVis'], 'RAud': ['RAud'], 'RBar': ['RBar'], 'RHip': ['RHip'], 'RMot': ['RMot'], 'RVis': ['RVis']}#
exact
{abbrev: [raw names]}map, in canonical order. A channel is the atomic unit (left/right is part of the identity, not a separate axis); the code never interprets the label — it is matched exactly against raw data channel names. This is a_MAP(exact key→values, likeGENOTYPE_MAPandSEX_MAP), not a fuzzy, substring-matched_ALIASEStable. Populated per-dataset viachannelsin the samples config.CHANNEL_ABBREVS,CHANNEL_ABBREV_BY_RAW, and the channel entry ofDF_SORT_ORDERare derived from this; never edit those directly.- Type:
Single source of truth for channels
- neurodent.constants.mappings.CHANNEL_ABBREVS = ['LMot', 'RMot', 'LBar', 'RBar', 'LHip', 'RHip', 'LAud', 'RAud', 'LVis', 'RVis']#
Ordered canonical channel abbreviations. Derived from
CHANNEL_MAPkeys.
- neurodent.constants.mappings.CHANNEL_ABBREV_BY_RAW = {'LAud': 'LAud', 'LBar': 'LBar', 'LHip': 'LHip', 'LMot': 'LMot', 'LVis': 'LVis', 'RAud': 'RAud', 'RBar': 'RBar', 'RHip': 'RHip', 'RMot': 'RMot', 'RVis': 'RVis'}#
Exact reverse lookup
{raw channel name: canonical abbrev}. Derived fromCHANNEL_MAP; the sole resolution table forresolve_channel(exact match only — no inference).
- neurodent.constants.mappings.DF_SORT_ORDER = {'band': ['delta', 'theta', 'alpha', 'beta', 'gamma'], 'channel': ['average', 'all', 'LMot', 'RMot', 'LBar', 'RBar', 'LHip', 'RHip', 'LAud', 'RAud', 'LVis', 'RVis'], 'genotype': ['WT', 'KO'], 'isday': [True, False], 'sex': ['Male', 'Female']}#
Defines categorical sort orders for DataFrame columns. The
channelentry is derived fromCHANNEL_ABBREVS.
- neurodent.constants.mappings.DATEPARSER_PATTERNS_TO_REMOVE = ['[A-Z]+\\d+', '\\([0-9]+\\)', '(?:\\b\\d\\s){1,}(\\d\\b)?', '\\s\\d$']#
Regex patterns to strip from filenames before date parsing.
- neurodent.constants.mappings.DEFAULT_DAY = datetime.datetime(2000, 1, 1, 0, 0)#
Fallback date when parsing fails.
- neurodent.constants.mappings.FEATURE_LABELS = {'alphadelta': 'Alpha/Delta Ratio', 'ampvar': 'Amplitude Variance', 'cohere': 'Coherence', 'imcoh': 'Imaginary Coherence', 'logampvar': 'Log(Amplitude Variance)', 'lognspike': 'Log(Spike Count)', 'logpsdband': 'Log Band Power', 'logpsdfrac': 'Log Power Fraction', 'logpsdtotal': 'Log(Total PSD)', 'logrms': 'Log(RMS)', 'nspike': 'Spike Count', 'pcorr': 'Pearson Correlation', 'psd': 'PSD ($\\mu V^2/Hz$)', 'psdband': 'Band Power', 'psdfrac': 'Power Fraction', 'psdslope': 'PSD Slope', 'psdtotal': 'Total PSD', 'rms': 'RMS', 'zcohere': 'Z-Coherence', 'zimcoh': 'Z-Imaginary Coherence', 'zpcorr': 'Z-Pearson Correlation'}#
Canonical display labels for features.