diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2021-02-15 13:38:16 +0100 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2021-02-15 13:38:16 +0100 |
commit | 45310b5f95dba00b1b6e2191309961c98ba9980c (patch) | |
tree | 09cf14e2b9d5bfec2122afd06c9755950b93947a | |
parent | bb31f4b5666cb7fb72e0723afd90602693e3d344 (diff) |
pelt: Fix stretch != 1 support
-rw-r--r-- | lib/pelt.py | 6 |
1 files changed, 4 insertions, 2 deletions
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() |