summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2021-02-15 12:50:46 +0100
committerDaniel Friesel <daniel.friesel@uos.de>2021-02-15 12:50:46 +0100
commit0b6b55d6a8529d71c42393a6ca4818313c73e554 (patch)
treed08bb5ad50cdbc22e010292f61fee17055fda4d0
parent2e6d1db608181b05efe5ac1e97dcc1e094c7fd58 (diff)
debug output
-rw-r--r--lib/model.py6
-rw-r--r--lib/pelt.py17
2 files changed, 15 insertions, 8 deletions
diff --git a/lib/model.py b/lib/model.py
index bfe0a3c..518566c 100644
--- a/lib/model.py
+++ b/lib/model.py
@@ -942,7 +942,9 @@ class PTAModel:
changepoints_by_trace.append(changepoints_by_penalty[penalty])
if np.median(num_changepoints_by_trace) < 1:
- logger.debug(f" we found no changepoints with penalty {penalty}")
+ logger.debug(
+ f" we found no changepoints {num_changepoints_by_trace} with penalties {penalty_by_trace}"
+ )
substate_counts = [1 for i in self.by_param[by_param_key]["param"]]
substate_data = {
"duration": self.by_param[by_param_key]["duration"],
@@ -954,7 +956,7 @@ class PTAModel:
num_changepoints = np.argmax(np.bincount(num_changepoints_by_trace))
logger.debug(
- f" we found {num_changepoints} changepoints from {num_changepoints_by_trace} with penalties {penalty_by_trace}"
+ f" we found {num_changepoints} changepoints {num_changepoints_by_trace} with penalties {penalty_by_trace}"
)
return self.pelt.calc_raw_states(
self.by_param[by_param_key]["timestamps"],
diff --git a/lib/pelt.py b/lib/pelt.py
index 2f533a5..26da00f 100644
--- a/lib/pelt.py
+++ b/lib/pelt.py
@@ -42,7 +42,7 @@ class PELT:
self.name_filter = None
self.refinement_threshold = 200e-6 # 200 µW
self.range_min = 0
- self.range_max = 100
+ self.range_max = 88
self.stretch = 1
self.with_multiprocessing = True
self.__dict__.update(kwargs)
@@ -138,7 +138,7 @@ class PELT:
return None, changepoints
queue = list()
- for i in range(0, 100):
+ for i in range(self.range_min, self.range_max):
queue.append((algo, i))
if self.with_multiprocessing:
with Pool() as pool:
@@ -155,7 +155,7 @@ class PELT:
)
changepoints_by_penalty[res[0]] = res[1]
changepoint_counts = list()
- for i in range(0, 100):
+ for i in range(self.range_min, self.range_max):
changepoint_counts.append(len(changepoints_by_penalty[i]))
start_index = -1
@@ -227,9 +227,14 @@ class PELT:
if len(substates) == expected_substate_count:
usable_measurements.append((i, substates))
- logger.debug(
- f"{len(usable_measurements)} of {len(changepoints_by_signal)} measurements have {expected_substate_count} sub-states"
- )
+ if len(usable_measurements) <= len(changepoints_by_signal) * 0.5:
+ logger.info(
+ f"Only {len(usable_measurements)} of {len(changepoints_by_signal)} measurements have {expected_substate_count} sub-states. Try lowering the jump step size"
+ )
+ else:
+ logger.debug(
+ f"{len(usable_measurements)} of {len(changepoints_by_signal)} measurements have {expected_substate_count} sub-states"
+ )
for i in range(expected_substate_count):
substate_data.append(