HCOBJB6WGQ5VUJFRFTZKUE3IDGEONLENOMQ3LXZZ2YMPJ2BJRJVQC func normalizeFlat(power []float64, rows, cols int) [][]uint8 {if rows == 0 || cols == 0 {return nil}// Pass 1: find minNonZero, then convert power to dB in-place, tracking min/max dB
// convertToDB replaces power values with dB values in-place, returning min/max dB.// Zero/negative values are clamped to minNonZero before conversion.func convertToDB(power []float64) (minDB, maxDB float64) {
// Pass 2: normalize dB to uint8 and write into result (with vertical flip)
func normalizeFlat(power []float64, rows, cols int) [][]uint8 {if rows == 0 || cols == 0 {return nil}minDB, maxDB := convertToDB(power)// Normalize dB to uint8 and write into result (with vertical flip)
func collectMappedLabels(mapping MappingFile, dataCalltypes map[string]map[string]bool) (map[string]bool, map[string]map[string]string) {mappedSpeciesSet := make(map[string]bool)mappedCalltypes := make(map[string]map[string]string) // dbSpecies -> dbCalltype -> dataCalltypefor _, sm := range mapping {// Skip sentinel values — they are never looked up in the DBif sm.Species == MappingNegative || sm.Species == MappingIgnore {continue}mappedSpeciesSet[sm.Species] = true// Track calltype mappingsif len(sm.Calltypes) > 0 {if mappedCalltypes[sm.Species] == nil {mappedCalltypes[sm.Species] = make(map[string]string)}for dataCT, dbCT := range sm.Calltypes {mappedCalltypes[sm.Species][dbCT] = dataCT}}}// Also collect unmapped calltypes (where .data calltype = DB calltype)
// collectUnmappedCalltypes adds calltypes from .data files that have no explicit// mapping entry (dataCT == dbCT by convention) to the mappedCalltypes set.func collectUnmappedCalltypes(mapping MappingFile, dataCalltypes map[string]map[string]bool, mappedCalltypes map[string]map[string]string) {
for _, sm := range mapping {if sm.Species == MappingNegative || sm.Species == MappingIgnore {continue}mappedSpeciesSet[sm.Species] = trueif len(sm.Calltypes) > 0 {if mappedCalltypes[sm.Species] == nil {mappedCalltypes[sm.Species] = make(map[string]string)}for dataCT, dbCT := range sm.Calltypes {mappedCalltypes[sm.Species][dbCT] = dataCT}}}collectUnmappedCalltypes(mapping, dataCalltypes, mappedCalltypes)
### Complexity reductions (Stream 6)**tui.Model.View** (14→7): Extracted `renderHeader`, `renderProgressBar`,`renderSegmentInfo`, and `renderLabels` helper methods from the monolithicView function.**utils/normalizeFlat** (14→6): Extracted `convertToDB` helper that findsminNonZero, converts power values to dB in-place, and returns min/max dB.