Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Network Health
sbws
Commits
3cbc39b5
Commit
3cbc39b5
authored
Mar 30, 2018
by
Matt Traudt
Browse files
Use the log library to log about too much error
parent
2bbfe85c
Changes
1
Hide whitespace changes
Inline
Side-by-side
sbws/commands/generate.py
View file @
3cbc39b5
...
...
@@ -5,7 +5,6 @@ from sbws.lib.resultdump import ResultSuccess
from
argparse
import
ArgumentDefaultsHelpFormatter
from
statistics
import
median
import
os
import
sys
import
json
import
time
...
...
@@ -58,10 +57,11 @@ def result_data_to_v3bw_line(data, fingerprint):
def
warn_if_not_accurate_enough
(
lines
,
constant
):
margin
=
0.001
accuracy_ratio
=
(
sum
([
l
.
bw
for
l
in
lines
])
/
len
(
lines
))
/
constant
log
.
info
(
'The generated lines are within {:.5}% of what they should '
'be'
.
format
((
1
-
accuracy_ratio
)
*
100
))
if
accuracy_ratio
<
1
-
margin
or
accuracy_ratio
>
1
+
margin
:
print
(
'WARNING: There was {}% error and only +/- {}% is '
'allowed'
.
format
(
round
((
1
-
accuracy_ratio
)
*
100
,
2
),
round
(
margin
*
100
,
2
)),
file
=
sys
.
stderr
)
log
.
warn
(
'There was {:.3}% error and only +/- {:.3}% is '
'allowed'
.
format
((
1
-
accuracy_ratio
)
*
100
,
margin
*
100
,
2
))
def
scale_lines
(
args
,
v3bw_lines
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment