From 4221d5a7b52fcb0e0840859e080ed80bd406b455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jord=C3=A3o=20Bragantini?= Date: Thu, 22 Dec 2022 13:46:46 -0800 Subject: [PATCH] Fix filter nodes parents bug (#15) --- ultrack/core/export/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ultrack/core/export/utils.py b/ultrack/core/export/utils.py index b359040..6e9ec7b 100644 --- a/ultrack/core/export/utils.py +++ b/ultrack/core/export/utils.py @@ -386,7 +386,6 @@ def _filter_nodes_by_per_time_point( LOG.info(f"Removing nodes {removed_ids} at time {time}") df = df.drop(removed_ids) - df.loc[df["parent_id"].isin(removed_ids), "parent_id"] = NO_PARENT return df @@ -427,4 +426,7 @@ def filter_nodes_generic( ) ) + orphan = np.logical_not(df["parent_id"].isin(df.index)) + df.loc[orphan, "parent_id"] = NO_PARENT + return df