2 cyclo fixes

quietlight
May 4, 2026, 11:18 PM
JR46EPFZI2AVLOZH2OFQIZZYBTEWJ3YTZAFVZQGYFLRMBU6ZEPYQC

Dependencies

Change contents

  • edit in tools/isnight.go at line 95
    [3.302225]
    [2.8273]
    // sunTimeUTC returns the UTC RFC3339 string for a suncalc event, or "" if absent/zero.
    func sunTimeUTC(sunTimes map[suncalc.DayTimeName]suncalc.DayTime, name suncalc.DayTimeName) string {
    if entry, ok := sunTimes[name]; ok && !entry.Value.IsZero() {
    return entry.Value.UTC().Format(time.RFC3339)
    }
    return ""
    }
  • edit in tools/isnight.go at line 105
    [2.8476]
    [3.302225]
    // Diurnal: midpoint is between dawn and sunset
  • edit in tools/isnight.go at line 110
    [3.302462][3.302462:302465](),[3.302466][3.302466:302719]()
    }
    if sr, ok := sunTimes[suncalc.Sunrise]; ok && !sr.Value.IsZero() {
    output.SunriseUTC = sr.Value.UTC().Format(time.RFC3339)
    }
    if ss, ok := sunTimes[suncalc.Sunset]; ok && !ss.Value.IsZero() {
    output.SunsetUTC = ss.Value.UTC().Format(time.RFC3339)
  • replacement in tools/isnight.go at line 111
    [3.302722][3.302722:302965]()
    if d, ok := sunTimes[suncalc.Dawn]; ok && !d.Value.IsZero() {
    output.DawnUTC = d.Value.UTC().Format(time.RFC3339)
    }
    if dk, ok := sunTimes[suncalc.Dusk]; ok && !dk.Value.IsZero() {
    output.DuskUTC = dk.Value.UTC().Format(time.RFC3339)
    }
    [3.302722]
    [3.302986]
    output.SunriseUTC = sunTimeUTC(sunTimes, suncalc.Sunrise)
    output.SunsetUTC = sunTimeUTC(sunTimes, suncalc.Sunset)
    output.DawnUTC = sunTimeUTC(sunTimes, suncalc.Dawn)
    output.DuskUTC = sunTimeUTC(sunTimes, suncalc.Dusk)
  • replacement in tools/calls_classify.go at line 87
    [3.23718][3.23718:23866](),[3.23866][3.608062:608072](),[3.608062][3.608062:608072](),[3.608072][3.23867:24091]()
    hasFilter := config.Filter != "" || config.Species != "" || config.Certainty >= 0
    var segs []*utils.Segment
    if !hasFilter {
    segs = df.Segments
    } else {
    for _, seg := range df.Segments {
    if seg.SegmentMatchesFilters(config.Filter, config.Species, config.CallType, config.Certainty) {
    segs = append(segs, seg)
    }
    }
    if len(segs) == 0 {
    return nil, false, 0
    }
    [3.23718]
    [3.24091]
    segs := filterSegmentsByLabel(df.Segments, config)
    if segs == nil {
    return nil, false, 0
  • replacement in tools/calls_classify.go at line 94
    [3.24147][3.24147:24363](),[3.24363][3.608126:608144](),[3.608126][3.608126:608144](),[3.608144][3.24364:24474]()
    wavPath := filepath.Clean(strings.TrimSuffix(df.FilePath, ".data"))
    result, err := IsNight(IsNightInput{
    FilePath: wavPath,
    Lat: config.Lat,
    Lng: config.Lng,
    Timezone: config.Timezone,
    })
    if err != nil {
    fmt.Fprintf(os.Stderr, "warning: skipping %s (isnight error: %v)\n", wavPath, err)
    return nil, false, 1
    [3.24147]
    [3.24474]
    keep, tf := filterByTimeOfDay(df.FilePath, config)
    if !keep {
    return nil, false, tf
  • edit in tools/calls_classify.go at line 98
    [3.24478][3.24478:24615](),[3.24615][3.608198:608202](),[3.608198][3.608198:608202]()
    if config.Night && !result.SolarNight {
    return nil, false, 1
    }
    if config.Day && !result.DiurnalActive {
    return nil, false, 1
    }
  • edit in tools/calls_classify.go at line 100
    [3.24649]
    [3.24649]
    }
    // filterSegmentsByLabel applies label/species/certainty filters, returning matching segments.
    // Returns nil if no segments match (caller should skip the file).
    func filterSegmentsByLabel(segments []*utils.Segment, config ClassifyConfig) []*utils.Segment {
    hasFilter := config.Filter != "" || config.Species != "" || config.Certainty >= 0
    if !hasFilter {
    return segments
    }
    var segs []*utils.Segment
    for _, seg := range segments {
    if seg.SegmentMatchesFilters(config.Filter, config.Species, config.CallType, config.Certainty) {
    segs = append(segs, seg)
    }
    }
    return segs // nil if empty, caller treats as "skip"
  • edit in tools/calls_classify.go at line 118
    [3.608206]
    [3.24652]
    // filterByTimeOfDay checks --night/--day time-of-day filter for a .data file.
    // Returns (keep, timeFilteredCount).
    func filterByTimeOfDay(dataFilePath string, config ClassifyConfig) (bool, int) {
    wavPath := filepath.Clean(strings.TrimSuffix(dataFilePath, ".data"))
    result, err := IsNight(IsNightInput{
    FilePath: wavPath,
    Lat: config.Lat,
    Lng: config.Lng,
    Timezone: config.Timezone,
    })
    if err != nil {
    fmt.Fprintf(os.Stderr, "warning: skipping %s (isnight error: %v)\n", wavPath, err)
    return false, 1
    }
    if config.Night && !result.SolarNight {
    return false, 1
    }
    if config.Day && !result.DiurnalActive {
    return false, 1
    }
    return true, 0
    }