From 45310b5f95dba00b1b6e2191309961c98ba9980c Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 15 Feb 2021 13:38:16 +0100 Subject: pelt: Fix stretch != 1 support --- lib/pelt.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/pelt.py b/lib/pelt.py index 26da00f..9a11807 100644 --- a/lib/pelt.py +++ b/lib/pelt.py @@ -49,6 +49,7 @@ class PELT: self.jump = int(self.jump) self.min_dist = int(self.min_dist) + self.stretch = int(self.stretch) if os.getenv("DFATOOL_PELT_MODEL"): # https://centre-borelli.github.io/ruptures-docs/user-guide/costs/costl1/ @@ -150,8 +151,9 @@ class PELT: if len(res[1]) > 0 and res[1][-1] == len(signal): res[1].pop() if self.stretch != 1: - res[1] = np.array( - np.around(np.array(res[1]) / self.stretch), dtype=np.int + res = ( + res[0], + np.array(np.around(np.array(res[1]) / self.stretch), dtype=np.int), ) changepoints_by_penalty[res[0]] = res[1] changepoint_counts = list() -- cgit v1.2.3