Skip to content

Commit 4b38419

Browse files
Fix 'check_for_deletion' method for UpdateTimeStepsDeleter. Now takes into account when multiple prediction states are appended at a single timestamp.
1 parent 782792b commit 4b38419

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

stonesoup/deleter/time.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,17 @@ def check_for_deletion(self, track, **kwargs):
3030
`False` if track has an :class:`~.Update` with measurements within
3131
time steps; `True` otherwise.
3232
"""
33-
return not any(isinstance(state, Update) and state.hypothesis
34-
for state in track[-self.time_steps_since_update:])
33+
timestamps_set = set()
34+
35+
for state in track[::-1]:
36+
timestamps_set.add(state.timestamp)
37+
if len(timestamps_set) > self.time_steps_since_update:
38+
return True
39+
40+
if isinstance(state, Update) and state.hypothesis:
41+
return False
42+
43+
return False
3544

3645

3746
class UpdateTimeDeleter(Deleter):

0 commit comments

Comments
 (0)