From cb48ece77ffb3c1769d107fc3d81ecb5dc557c85 Mon Sep 17 00:00:00 2001 From: Sergei Trofimov Date: Thu, 12 Jan 2017 11:29:44 +0000 Subject: [PATCH] daq: fixing energy metric calculation The summary energy metric was being calculated incorrectly. Instead of dividing power by the sampling rate, it was being multiplied by it and divided by a million for some reason. --- wlauto/instrumentation/daq/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wlauto/instrumentation/daq/__init__.py b/wlauto/instrumentation/daq/__init__.py index 67cfa41c..3a290b80 100644 --- a/wlauto/instrumentation/daq/__init__.py +++ b/wlauto/instrumentation/daq/__init__.py @@ -266,7 +266,7 @@ class Daq(Instrument): metric_name = '{}_{}'.format(port, metric) context.result.add_metric(metric_name, round(value, 3), UNITS[metric]) self._results[key][metric_name] = round(value, 3) - energy = sum(data[metrics.index('power')]) * (self.sampling_rate / 1000000) + energy = sum(data[metrics.index('power')]) / self.sampling_rate context.result.add_metric('{}_energy'.format(port), round(energy, 3), UNITS['energy']) def teardown(self, context):