From 8ea171512bf81c6eae91399cfaa2c28fa7bce67b Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Wed, 1 Dec 2010 10:59:27 -0300 Subject: [PATCH] usrp/range: more useful diagnostic output and harden against underflows - usrp/range: ignore "-inf" values - usrp/range: print the average value when reporting an outlier --- usrp/range | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usrp/range b/usrp/range index 46bd0bc..85b212a 100755 --- a/usrp/range +++ b/usrp/range @@ -22,6 +22,7 @@ if (@ARGV) { while (<>) { chop; + next if $_ eq "-inf"; push(@v, $_); $s += $_; } @@ -30,8 +31,9 @@ $avg = $s/@v; $n = 0; for (@v) { $n++; + next if $_ eq "-inf"; if ($_ < $avg-$tol || $_ > $avg+$tol) { - print STDERR "sample $n is outlier: $_\n" if $verbose; + print STDERR "sample $n is outlier ($avg): $_\n" if $verbose; next; } $sum += $_;