From ebdb8bfb7b8e08aae29c2c2057616a87462ca8a8 Mon Sep 17 00:00:00 2001 From: David Hendriks <davidhendriks93@gmail.com> Date: Wed, 8 Sep 2021 16:24:28 +0100 Subject: [PATCH] changed robs function to prevent overriding internal functions min and max --- binarycpython/utils/functions.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/binarycpython/utils/functions.py b/binarycpython/utils/functions.py index ecf901772..539601288 100644 --- a/binarycpython/utils/functions.py +++ b/binarycpython/utils/functions.py @@ -354,6 +354,7 @@ def datalinedict(line : str, Note: if the parameter is a floating point number, it will be converted to Python's float type. """ + return {param:convfloat(value) for param, value in zip(parameters, line.split())} def pad_output_distribution(dist : dict, @@ -361,23 +362,22 @@ def pad_output_distribution(dist : dict, """ Given a distribution, dist (a dictionary), which should be binned every binwidth (float), fill the distribution with zeros when there is no data. Note: this changes the data in place. """ + # sorted list of the keys skeys = sorted(dist.keys(), key = lambda x: float(x)) # get min and max, offset by the binwidth - min = skeys[ 0] - binwidth - max = skeys[-1] + binwidth + min_val = skeys[ 0] - binwidth + max_val = skeys[-1] + binwidth # pad with zeros - x = min - while x <= max: + x = min_val + while x <= max_val: dist[x] = dist.setdefault(x,0.0) x += binwidth return dist - - class catchtime(object): """ Context manager to calculate time spent -- GitLab