GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

Commit 8b6b3631 authored by Georg Koppen's avatar Georg Koppen

Merge branch 'maint-1.1' into master

parents e6f5f98b 685c9e73
...@@ -14,6 +14,10 @@ def bw_filt(bw_measurements): ...@@ -14,6 +14,10 @@ def bw_filt(bw_measurements):
It is the equivalent to Torflow's ``filt_sbw``. It is the equivalent to Torflow's ``filt_sbw``.
``mu`` in this function is the equivalent to Torflow's ``sbw``. ``mu`` in this function is the equivalent to Torflow's ``sbw``.
""" """
mu = mean(bw_measurements) mu = 1
bws_gte_mean = filter(lambda bw: bw >= mu, bw_measurements) if bw_measurements:
return mean(bws_gte_mean) 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
...@@ -869,13 +869,19 @@ class V3BWLine(object): ...@@ -869,13 +869,19 @@ class V3BWLine(object):
@staticmethod @staticmethod
def bw_median_from_results(results): def bw_median_from_results(results):
return max(round(median([dl['amount'] / dl['duration'] bws = [dl['amount'] / dl['duration']
for r in results for dl in r.downloads])), 1) for r in results for dl in r.downloads]
if bws:
return max(round(median(bws)), 1)
return 1
@staticmethod @staticmethod
def bw_mean_from_results(results): def bw_mean_from_results(results):
return max(round(mean([dl['amount'] / dl['duration'] bws = [dl['amount'] / dl['duration']
for r in results for dl in r.downloads])), 1) for r in results for dl in r.downloads]
if bws:
return max(round(mean(bws)), 1)
return 1
@staticmethod @staticmethod
def last_time_from_results(results): def last_time_from_results(results):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment