ck 4

quietlight
May 11, 2026, 4:25 AM
HCOBJB6WGQ5VUJFRFTZKUE3IDGEONLENOMQ3LXZZ2YMPJ2BJRJVQC

Dependencies

  • [2] GE3VNRXL ck 2
  • [3] LQLC7S3A trying gemini: Inconsistent Standards in @utils/ refactoring
  • [4] KZKLAINJ run out of space on nest, cleaned out
  • [5] 2HAQZPV3 more refactoring with glm
  • [6] 2P27XV3D fixed cyclo over 30
  • [7] DS22DKV3 added shell script integration tests.
  • [*] JZRF7OBJ refactor to get db omports out of utils, but still have failing tests, may need updating

Change contents

  • replacement in utils/spectrogram.go at line 113
    [3.65960][3.65960:66154]()
    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
    [3.65960]
    [3.66154]
    // 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) {
  • replacement in utils/spectrogram.go at line 123
    [3.66312][3.66312:66351]()
    minNonZero = 1e-20 // fallback floor
    [3.66312]
    [3.66351]
    minNonZero = 1e-20
  • replacement in utils/spectrogram.go at line 126
    [3.66355][3.66355:66408]()
    minDB := math.MaxFloat64
    maxDB := -math.MaxFloat64
    [3.66355]
    [3.66408]
    minDB = math.MaxFloat64
    maxDB = -math.MaxFloat64
  • edit in utils/spectrogram.go at line 141
    [3.66599]
    [3.66599]
    return minDB, maxDB
    }
  • replacement in utils/spectrogram.go at line 144
    [3.66600][3.66600:66677]()
    // Pass 2: normalize dB to uint8 and write into result (with vertical flip)
    [3.66600]
    [3.66677]
    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)
  • edit in utils/spectrogram.go at line 158
    [3.66766][3.66766:66830]()
    // Allocate result with flat backing slice (single allocation)
  • edit in utils/spectrogram.go at line 161
    [3.66928][3.66928:66994]()
    // Flip: row i in result gets data from row (rows-1-i) in power
  • replacement in utils/mapping.go at line 128
    [3.485][3.485:623](),[3.623][3.92843:93015](),[3.92843][3.92843:93015](),[3.93015][3.22046:22196](),[3.22196][3.93015:93395](),[3.93015][3.93015:93395]()
    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 -> dataCalltype
    for _, sm := range mapping {
    // Skip sentinel values — they are never looked up in the DB
    if sm.Species == MappingNegative || sm.Species == MappingIgnore {
    continue
    }
    mappedSpeciesSet[sm.Species] = true
    // Track calltype mappings
    if 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)
    [3.485]
    [3.93395]
    // 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) {
  • replacement in utils/mapping.go at line 134
    [3.93496][3.93496:93547]()
    continue // Already reported as missing species
    [3.93496]
    [3.93547]
    continue
  • edit in utils/mapping.go at line 139
    [3.93608][3.93608:93660]()
    // If no explicit mapping, assume dataCT == dbCT
  • edit in utils/mapping.go at line 152
    [3.93941]
    [3.93941]
    }
    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)
  • edit in utils/mapping.go at line 158
    [3.93942]
    [3.624]
    for _, sm := range mapping {
    if sm.Species == MappingNegative || sm.Species == MappingIgnore {
    continue
    }
    mappedSpeciesSet[sm.Species] = true
    if 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)
  • edit in CHANGELOG.md at line 81
    [2.8673]
    [2.8673]
    ### Complexity reductions (Stream 6)
    **tui.Model.View** (14→7): Extracted `renderHeader`, `renderProgressBar`,
    `renderSegmentInfo`, and `renderLabels` helper methods from the monolithic
    View function.
    **utils/normalizeFlat** (14→6): Extracted `convertToDB` helper that finds
    minNonZero, converts power values to dB in-place, and returns min/max dB.
  • edit in CHANGELOG.md at line 91
    [2.8674]
    [9.7568]
    **utils/collectMappedLabels** (13→8): Extracted `collectUnmappedCalltypes`
    helper that adds calltypes from .data files with no explicit mapping entry.