[tor-commits] [sbws/master] Replace mininum by maximum in bandwidth filtered

juga at torproject.org juga at torproject.org
Mon Oct 29 08:50:30 UTC 2018


commit 19713fa1570c4644cab9c27094ee72405b355367
Author: juga0 <juga at riseup.net>
Date:   Sat Oct 27 14:26:33 2018 +0000

    Replace mininum by maximum in bandwidth filtered
    
    Bandwidth filtered is the maximum between the bandwidth
    measurements and their mean, not the minimum (#28215)
---
 CHANGELOG.md         | 6 ++++--
 sbws/lib/v3bwfile.py | 4 ++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 484742b..8315c4c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
 
 - Update python minimal version in setup (#28043)
 - Catch unhandled exception when we fail to resolve a domain name (#28141)
+- Bandwidth filtered is the maximum between the bandwidth measurements and
+  their mean, not the minimum (#28215)
 
 ### Changed
 
@@ -24,8 +26,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
 
 - Write bw file only when the percentage of measured relays is bigger than 60%
   (#28062)
-- When the percentage of measured relays is less than the 60%, do not include 
-  the relays in the bandwidth file and instead include some statistics in the 
+- When the percentage of measured relays is less than the 60%, do not include
+  the relays in the bandwidth file and instead include some statistics in the
   header (#28076)
 - When the percentage of measured relays is less than the 60% and it was more
   before, warn about it (#28155)
diff --git a/sbws/lib/v3bwfile.py b/sbws/lib/v3bwfile.py
index c35c865..dfa1bbd 100644
--- a/sbws/lib/v3bwfile.py
+++ b/sbws/lib/v3bwfile.py
@@ -763,7 +763,7 @@ class V3BWFile(object):
         # mean (Torflow's strm_avg)
         mu = mean([l.bw_bs_mean for l in bw_lines])
         # filtered mean (Torflow's filt_avg)
-        muf = mean([min(l.bw_bs_mean, mu) for l in bw_lines])
+        muf = mean([max(l.bw_bs_mean, mu) for l in bw_lines])
         # bw sum (Torflow's tot_net_bw or tot_sbw)
         sum_bw = sum([l.bw_bs_mean for l in bw_lines])
         # Torflow's clipping
@@ -781,7 +781,7 @@ class V3BWFile(object):
             bw_new = kb_round_x_sig_dig(
                 max(
                     l.bw_bs_mean / mu,  # ratio
-                    min(l.bw_bs_mean, mu) / muf  # ratio filtered
+                    max(l.bw_bs_mean, mu) / muf  # ratio filtered
                     ) * desc_obs_bw, \
                 digits=num_round_dig)  # convert to KB
             # Cap maximum bw





More information about the tor-commits mailing list