mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2024-11-25 15:45:56 +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:
parent
e52b92f00f
commit
8ea171512b
@ -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 += $_;
|
||||||
|
Loading…
Reference in New Issue
Block a user