femic.pipeline.tsa

TSA-level constants and helpers.

Functions

apply_stratum_alias_map(*, f_table, ...)

Apply selected+alias stratum mapping and return matched-column name.

assign_au_ids_from_scsi(*, f_table, scsi_au)

Assign absolute AU ids from scsi_au lookup map.

assign_si_levels_from_stratum_quantiles(*, ...)

Assign SI-level labels within each matched stratum from configured quantile bands.

assign_stratum_matches_from_au_table(*, ...)

Assign stratum_matched values by TSA using AU-table strata as targets.

assign_thlb_area_and_flag(*, f_table, ...[, ...])

Assign THLB area and THLB binary flag using legacy TSA-specific rules.

assign_thlb_raw_from_raster(*, f_table, ...)

Assign per-row raw THLB values by masking a THLB raster.

build_au_assignment_null_summary(*, f_table)

Build null-diagnostics summary used when AU assignment yields no rows.

build_missing_au_assignment_summary(*, f_table)

Summarize residual unmapped AU rows after the imputation pass.

build_strata_summary(*, f_table, ...[, ...])

Build per-stratum summary table used by legacy TSA orchestration.

build_stratum_lexmatch_alias_map(*, f_table, ...)

Build best-match aliases from non-selected lexmatch strata to selected strata.

emit_missing_au_mapping_warning(*, summary)

Emit legacy warning lines for missing AU mapping diagnostics.

lookup_scsi_au_base(*, scsi_au, tsa_code, ...)

Lookup base AU id for a TSA/stratum/SI combination.

mean_thlb_for_geometry(*, geometry, ...[, ...])

Compute mean THLB raster value for one geometry with legacy error fallback.

normalize_tsa_code(tsa_code)

Return canonical TSA code token used across legacy stage tables.

resolve_si_level_quantiles_for_stratum(*, ...)

Resolve per-stratum SI quantile bands.

select_tsa_slice(*, f_table, tsa_value)

Return a TSA-filtered slice that is robust to index dtype drift.

summarize_missing_au_mappings(*, f_table[, ...])

Return top-N missing AU mapping combinations for diagnostics.

target_nstrata_for(tsa_code)

Return configured target number of strata for a TSA code.

validate_complete_au_assignment(*, f_table)

Raise when any post-imputation AFLB rows still lack AU assignment.

validate_nonempty_au_assignment(*, f_table)

Raise with null diagnostics when AU assignment produces no mapped rows.