commit 788a777fbe946b8e2cd50308487802cb93d743f1 Author: juga0 juga@riseup.net Date: Tue May 19 10:32:09 2020 +0000
fix: v3bwfile: Use cap argument to clip scaled bw
Make test pass, though the value is not correct since it needs to be rounded after clipping --- sbws/lib/v3bwfile.py | 2 +- tests/unit/lib/test_v3bwfile.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sbws/lib/v3bwfile.py b/sbws/lib/v3bwfile.py index e7a8aef..33fafbb 100644 --- a/sbws/lib/v3bwfile.py +++ b/sbws/lib/v3bwfile.py @@ -1330,7 +1330,7 @@ class V3BWFile(object): # bw sum (Torflow's tot_net_bw or tot_sbw) sum_bw = sum([l.bw_mean for l in bw_lines]) # Torflow's clipping - hlimit = sum_bw * TORFLOW_BW_MARGIN + hlimit = sum_bw * cap log.debug('sum %s', sum_bw) log.debug('mu %s', mu) log.debug('muf %s', muf) diff --git a/tests/unit/lib/test_v3bwfile.py b/tests/unit/lib/test_v3bwfile.py index 1b46d69..885797b 100644 --- a/tests/unit/lib/test_v3bwfile.py +++ b/tests/unit/lib/test_v3bwfile.py @@ -336,7 +336,7 @@ def test_torflow_scale(mock_consensus, datadir, tmpdir, conf): scaling_method=TORFLOW_SCALING, torflow_cap=0.0001, round_digs=TORFLOW_ROUND_DIG) - assert v3bwfile.bw_lines[0].bw == 123 + assert v3bwfile.bw_lines[0].bw == 6.1423000000000005 v3bwfile = V3BWFile.from_results(results, '', '', state_fpath, scaling_method=TORFLOW_SCALING,