summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-03-25 15:09:35 +0100
committerDaniel Friesel <derf@finalrewind.org>2019-03-25 15:09:35 +0100
commit1e84b8feb7f288fcc1e3f3d00458ea25276a552b (patch)
treec49630d205f07e57c2d89462e93d072b628137f6
parent88960e8ddf9d26331fc30f31a1d692cbc7a7c39c (diff)
_mean_std_by_param: Handle no partitions for attribute
-rw-r--r--lib/utils.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/utils.py b/lib/utils.py
index 8b0eab5..64f1780 100644
--- a/lib/utils.py
+++ b/lib/utils.py
@@ -149,6 +149,9 @@ def _mean_std_by_param(by_param, state_or_tran, attribute, param_index, verbose
vprint(verbose, '[W] parameter value partition for {} contains only one element -- skipping'.format(param_value))
else:
vprint(verbose, '[W] parameter value partition for {} is empty'.format(param_value))
+ if len(partitions) == 0:
+ vprint(verbose, '[W] Found no partitions for {}/{}/{} ???'.format(state_or_tran, attribute, param_index))
+ return 0.
return np.mean([np.std(partition) for partition in partitions])
def _corr_by_param(by_name, state_or_trans, attribute, param_index):
@@ -170,9 +173,10 @@ def _all_params_are_numeric(data, param_idx):
return True
return False
-class TimingAnalysis:
+class OptionalTimingAnalysis:
def __init__(self, enabled = True):
self.enabled = enabled
+ self.wrapped_lines = list()
self.index = 1
def get_header(self):
@@ -193,6 +197,7 @@ class TimingAnalysis:
for line in lines:
if re.fullmatch('.+;', line):
ret.append('TIMEIT( {:d}, {} )'.format(self.index, line))
+ self.wrapped_lines.append(line)
self.index += 1
else:
ret.append(line)