diff options
author | Daniel Friesel <derf@finalrewind.org> | 2019-03-25 15:09:35 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2019-03-25 15:09:35 +0100 |
commit | 1e84b8feb7f288fcc1e3f3d00458ea25276a552b (patch) | |
tree | c49630d205f07e57c2d89462e93d072b628137f6 /lib/utils.py | |
parent | 88960e8ddf9d26331fc30f31a1d692cbc7a7c39c (diff) |
_mean_std_by_param: Handle no partitions for attribute
Diffstat (limited to 'lib/utils.py')
-rw-r--r-- | lib/utils.py | 7 |
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) |