Skip to content

Commit

Permalink
Handle distance of 0 correctly in TrackToTruth associator
Browse files Browse the repository at this point in the history
In edge case where distance was exactly zero, min_dist would evaluate
false.
  • Loading branch information
sdhiscocks committed Jul 19, 2024
1 parent e4e50ad commit 3d4ad38
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions stonesoup/dataassociator/tracktotrack.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def associate_tracks(self, tracks_set: Set[Track], truth_set: Set[GroundTruthPat

for track_state in Track.last_timestamp_generator(track):

min_dist = None
min_dist = self.association_threshold
min_truth = None

for truth in truth_set:
Expand All @@ -290,11 +290,7 @@ def associate_tracks(self, tracks_set: Set[Track], truth_set: Set[GroundTruthPat
continue

distance = self.measure(track_state, truth_state)
if min_dist and distance < min_dist:
min_dist = distance
min_truth = truth
elif not min_dist \
and distance < self.association_threshold:
if distance < min_dist:
min_dist = distance
min_truth = truth

Expand Down

0 comments on commit 3d4ad38

Please sign in to comment.