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_config resets the live map to this when a dataset omits a GENOTYPE_MAP block, 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-animal genotype value to a canonical short label (parallels CHANNEL_MAP and SEX_MAP; matched exactly, never fuzzily). Empty default = passthrough (the raw genotype value 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 via GENOTYPE_MAP in the samples config (reset to DEFAULT_GENOTYPE_MAP when 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_config resets the live map to a copy of this when a dataset omits a SEX_MAP block.

neurodent.constants.mappings.SEX_MAP = {'Female': ['Female', 'female', 'F', 'f'], 'Male': ['Male', 'male', 'M', 'm']}#

Exact {canonical_label: [accepted spellings]} map normalizing the per-animal sex value (parallels GENOTYPE_MAP; matched exactly). Authoritative when populated — an uncovered value raises at load. Populated per-dataset via SEX_MAP in the samples config (reset to DEFAULT_SEX_MAP when 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, like GENOTYPE_MAP and SEX_MAP), not a fuzzy, substring-matched _ALIASES table. Populated per-dataset via channels in the samples config. CHANNEL_ABBREVS, CHANNEL_ABBREV_BY_RAW, and the channel entry of DF_SORT_ORDER are 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_MAP keys.

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 from CHANNEL_MAP; the sole resolution table for resolve_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 channel entry is derived from CHANNEL_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.