summaryrefslogtreecommitdiff
path: root/lib/utils.py
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2023-06-13 13:31:47 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2023-06-13 13:31:47 +0200
commit3574282c2b6fa669382828011df3a9bfd804a29b (patch)
tree96a724b90b0195340dd59b09c3e77e364f65e0e5 /lib/utils.py
parenta8a49f244fabc7e3129537c30d668e82a268cac5 (diff)
add --normalize-nfp support (e.g. for MBps -> Bps)
Diffstat (limited to 'lib/utils.py')
-rw-r--r--lib/utils.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/utils.py b/lib/utils.py
index 5b40f51..ed5aa14 100644
--- a/lib/utils.py
+++ b/lib/utils.py
@@ -447,6 +447,15 @@ def by_param_to_by_name(by_param: dict) -> dict:
return by_name
+def normalize_nfp_in_aggregate(aggregate, nfp_norm):
+ for name in aggregate.keys():
+ for new_name, old_name, norm_function in nfp_norm:
+ if old_name in aggregate[name]["attributes"]:
+ aggregate[name][new_name] = norm_function(aggregate[name].pop(old_name))
+ aggregate[name]["attributes"].remove(old_name)
+ aggregate[name]["attributes"].append(new_name)
+
+
def shift_param_in_aggregate(aggregate, parameters, parameter_shift):
"""
Remove entries which do not have certain parameter values from `aggregate`.