summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2018-01-26 08:27:19 +0100
committerDaniel Friesel <derf@finalrewind.org>2018-01-26 08:27:19 +0100
commit56011e9f63fffacd734c843e2106017f2a24e727 (patch)
treeff63c35d8dc167023f733937dddccaaa4390d5df
parent94622c2c44cc466a3c4137be8d35024fe1543a47 (diff)
use median for static models, not mean. d'oh.
-rwxr-xr-xlib/dfatool.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/dfatool.py b/lib/dfatool.py
index 0340427..5cece86 100755
--- a/lib/dfatool.py
+++ b/lib/dfatool.py
@@ -330,16 +330,34 @@ class EnergyModel:
for key in ['power', 'energy', 'duration', 'timeout', 'rel_energy_prev', 'rel_energy_next']:
if key in elem:
try:
+ static_model[name][key] = np.median(elem[key])
+ except RuntimeWarning:
+ print('[W] Got no data for {} {}'.format(name, key))
+ except FloatingPointError as fpe:
+ print('[W] Got no data for {} {}: {}'.format(name, key, fpe))
+
+ def static_median_getter(name, key, **kwargs):
+ return static_model[name][key]
+
+ return static_median_getter
+
+ def get_static_using_mean(self):
+ static_model = {}
+ for name, elem in self.by_name.items():
+ static_model[name] = {}
+ for key in ['power', 'energy', 'duration', 'timeout', 'rel_energy_prev', 'rel_energy_next']:
+ if key in elem:
+ try:
static_model[name][key] = np.mean(elem[key])
except RuntimeWarning:
print('[W] Got no data for {} {}'.format(name, key))
except FloatingPointError as fpe:
print('[W] Got no data for {} {}: {}'.format(name, key, fpe))
- def getter(name, key, **kwargs):
+ def static_mean_getter(name, key, **kwargs):
return static_model[name][key]
- return getter
+ return static_mean_getter
def states(self):
return sorted(list(filter(lambda k: self.by_name[k]['isa'] == 'state', self.by_name.keys())))