From 58286dbd1a5b5c08bba23a0862129adabf01309a Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 7 Oct 2022 13:10:05 +0200 Subject: [PATCH] Fix average computation in burst stats --- src/emu_ovni.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/emu_ovni.c b/src/emu_ovni.c index 1a4076c..5d53c44 100644 --- a/src/emu_ovni.c +++ b/src/emu_ovni.c @@ -557,14 +557,13 @@ pre_burst(struct ovni_emu *emu) double avg = 0.0; double maxdelta = 0; - for (int i = 1; i < th->nbursts; i++) { - double delta = th->burst_time[i] - th->burst_time[i - 1]; - if (delta > maxdelta) - maxdelta = delta; - avg += delta; + for (int i = 0; i < n; i++) { + if (deltas[i] > maxdelta) + maxdelta = deltas[i]; + avg += deltas[i]; } - avg /= (double) th->nbursts; + avg /= (double) n; double median = deltas[n / 2]; err("%s burst stats: median %.0f ns, avg %.1f ns, max %.0f ns\n",