1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-22 01:23:08 +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 (<>) {
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 += $_;