Commit 5a9be7c5 authored by juga's avatar juga
Browse files

Add methods to obtain median/last observed bw

parent f34d0c0d
......@@ -317,6 +317,24 @@ class V3BWLine(object):
for rt in _ResultType])
return rt_dict
def desc_obs_bw_bs_mean_from_results(results):
desc_obs_bws = []
for r in results:
if r.relay_observed_bandwidth is not None:
if desc_obs_bws:
return max(round(mean(desc_obs_bws)), 1)
return None
def desc_obs_bw_bs_last_from_results(results):
# the last is at the end of the list
for r in reversed(results):
if r.relay_observed_bandwidth is not None:
return r.relay_observed_bandwidth
return None
def bw_keyvalue_tuple_ls(self):
"""Return list of KeyValue Bandwidth Line tuples."""
Supports Markdown
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