1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-22 06:19:43 +02:00

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
This commit is contained in:
Werner Almesberger 2010-12-01 10:59:27 -03:00
parent e52b92f00f
commit 8ea171512b

View File

@ -22,6 +22,7 @@ if (@ARGV) {
while (<>) { while (<>) {
chop; chop;
next if $_ eq "-inf";
push(@v, $_); push(@v, $_);
$s += $_; $s += $_;
} }
@ -30,8 +31,9 @@ $avg = $s/@v;
$n = 0; $n = 0;
for (@v) { for (@v) {
$n++; $n++;
next if $_ eq "-inf";
if ($_ < $avg-$tol || $_ > $avg+$tol) { 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; next;
} }
$sum += $_; $sum += $_;