From 85374727ad66b884b25ddd659600ee9317db071b Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 3 Dec 2020 15:16:24 +0100 Subject: use common energytrace loader code this also fixes a nasty off-by-one in the barcode loader (now _load_energytrace): wrong: interval_start_timestamp = data[:-1, 0] * 1e-6 correct: interval_start_timestamp = data[1:, 0] * 1e-6 --- test/test_ptamodel.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'test/test_ptamodel.py') diff --git a/test/test_ptamodel.py b/test/test_ptamodel.py index fd20502..9172232 100755 --- a/test/test_ptamodel.py +++ b/test/test_ptamodel.py @@ -665,24 +665,24 @@ class TestFromFile(unittest.TestCase): ), ) static_model = model.get_static() - self.assertAlmostEqual(static_model("P14MW", "power"), 14542, places=0) + self.assertAlmostEqual(static_model("P14MW", "power"), 14540, places=0) self.assertAlmostEqual(static_model("P235UW", "power"), 899, places=0) self.assertAlmostEqual(static_model("P3_4MW", "power"), 3974, places=0) self.assertAlmostEqual(static_model("SLEEP", "power"), 672, places=0) self.assertAlmostEqual(static_model("nop10K", "duration"), 514, places=0) - self.assertAlmostEqual(static_model("nop10K", "energy"), 1207636, places=0) + self.assertAlmostEqual(static_model("nop10K", "energy"), 1219044, places=0) self.assertAlmostEqual(static_model("nop1K0", "duration"), 514, places=0) - self.assertAlmostEqual(static_model("nop1K0", "energy"), 1234947, places=0) + self.assertAlmostEqual(static_model("nop1K0", "energy"), 1199012, places=0) self.assertAlmostEqual(static_model("nop3K3", "duration"), 514, places=0) - self.assertAlmostEqual(static_model("nop3K3", "energy"), 1514341, places=0) + self.assertAlmostEqual(static_model("nop3K3", "energy"), 1501667, places=0) self.assertAlmostEqual(static_model("setup", "duration"), 27, places=0) - self.assertAlmostEqual(static_model("setup", "energy"), 19535, places=0) + self.assertAlmostEqual(static_model("setup", "energy"), 19907, places=0) self.assertAlmostEqual(static_model("switchTo3K3", "duration"), 19, places=0) self.assertAlmostEqual(static_model("switchTo3K3", "energy"), 14359, places=0) self.assertAlmostEqual(static_model("switchTo47K", "duration"), 19, places=0) self.assertAlmostEqual(static_model("switchTo47K", "energy"), 14166, places=0) self.assertAlmostEqual(static_model("switchTo750", "duration"), 19, places=0) - self.assertAlmostEqual(static_model("switchTo750", "energy"), 14166, places=0) + self.assertAlmostEqual(static_model("switchTo750", "energy"), 14131, places=0) self.assertAlmostEqual(static_model("switchToNone", "duration"), 19, places=0) self.assertAlmostEqual(static_model("switchToNone", "energy"), 14306, places=0) @@ -697,9 +697,9 @@ class TestFromFile(unittest.TestCase): "setup trans100u trans10m trans1m trans2m trans5m".split(" "), ) static_model = model.get_static() - self.assertAlmostEqual(static_model("IDLE", "power"), 760, places=0) + self.assertAlmostEqual(static_model("IDLE", "power"), 766, places=0) self.assertAlmostEqual(static_model("setup", "duration"), 15, places=0) - self.assertAlmostEqual(static_model("setup", "energy"), 13785, places=0) + self.assertAlmostEqual(static_model("setup", "energy"), 13818, places=0) self.assertAlmostEqual(static_model("trans100u", "duration"), 146, places=0) self.assertAlmostEqual(static_model("trans100u", "energy"), 136794, places=0) self.assertAlmostEqual(static_model("trans10m", "duration"), 10084, places=0) @@ -709,7 +709,7 @@ class TestFromFile(unittest.TestCase): self.assertAlmostEqual(static_model("trans2m", "duration"), 2031, places=0) self.assertAlmostEqual(static_model("trans2m", "energy"), 10500784, places=0) self.assertAlmostEqual(static_model("trans5m", "duration"), 5049, places=0) - self.assertAlmostEqual(static_model("trans5m", "energy"), 30519236, places=0) + self.assertAlmostEqual(static_model("trans5m", "energy"), 30521933, places=0) def test_et_timer_dco(self): raw_data = RawData(["test-data/20201203-110526-et_timer_dco.tar"]) @@ -722,11 +722,11 @@ class TestFromFile(unittest.TestCase): "setup trans100u trans10m trans1m trans2m trans5m".split(" "), ) static_model = model.get_static() - self.assertAlmostEqual(static_model("IDLE", "power"), 756, places=0) + self.assertAlmostEqual(static_model("IDLE", "power"), 764, places=0) self.assertAlmostEqual(static_model("setup", "duration"), 28, places=0) - self.assertAlmostEqual(static_model("setup", "energy"), 25714, places=0) + self.assertAlmostEqual(static_model("setup", "energy"), 25716, places=0) self.assertAlmostEqual(static_model("trans100u", "duration"), 158, places=0) - self.assertAlmostEqual(static_model("trans100u", "energy"), 148071, places=0) + self.assertAlmostEqual(static_model("trans100u", "energy"), 148072, places=0) self.assertAlmostEqual(static_model("trans10m", "duration"), 10097, places=0) self.assertAlmostEqual(static_model("trans10m", "energy"), 61416161, places=0) self.assertAlmostEqual(static_model("trans1m", "duration"), 1038, places=0) -- cgit v1.2.3