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
juga
sbws
Commits
685c9e73
Commit
685c9e73
authored
Aug 22, 2020
by
Georg Koppen
Browse files
Merge remote-tracking branch 'gitlab/merge-requests/26' into maint-1.1
parents
4106adef
2924e440
Changes
2
Hide whitespace changes
Inline
Side-by-side
sbws/lib/scaling.py
View file @
685c9e73
...
...
@@ -14,6 +14,10 @@ def bw_filt(bw_measurements):
It is the equivalent to Torflow's ``filt_sbw``.
``mu`` in this function is the equivalent to Torflow's ``sbw``.
"""
mu
=
mean
(
bw_measurements
)
bws_gte_mean
=
filter
(
lambda
bw
:
bw
>=
mu
,
bw_measurements
)
return
mean
(
bws_gte_mean
)
mu
=
1
if
bw_measurements
:
mu
=
mean
(
bw_measurements
)
bws_gte_mean
=
list
(
filter
(
lambda
bw
:
bw
>=
mu
,
bw_measurements
))
if
bws_gte_mean
:
return
mean
(
bws_gte_mean
)
return
1
sbws/lib/v3bwfile.py
View file @
685c9e73
...
...
@@ -869,13 +869,19 @@ class V3BWLine(object):
@
staticmethod
def
bw_median_from_results
(
results
):
return
max
(
round
(
median
([
dl
[
'amount'
]
/
dl
[
'duration'
]
for
r
in
results
for
dl
in
r
.
downloads
])),
1
)
bws
=
[
dl
[
'amount'
]
/
dl
[
'duration'
]
for
r
in
results
for
dl
in
r
.
downloads
]
if
bws
:
return
max
(
round
(
median
(
bws
)),
1
)
return
1
@
staticmethod
def
bw_mean_from_results
(
results
):
return
max
(
round
(
mean
([
dl
[
'amount'
]
/
dl
[
'duration'
]
for
r
in
results
for
dl
in
r
.
downloads
])),
1
)
bws
=
[
dl
[
'amount'
]
/
dl
[
'duration'
]
for
r
in
results
for
dl
in
r
.
downloads
]
if
bws
:
return
max
(
round
(
mean
(
bws
)),
1
)
return
1
@
staticmethod
def
last_time_from_results
(
results
):
...
...
Write
Preview
Markdown
is supported
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