From 8ea38fe69f952ad715aa68b1215bdbc4293679fb Mon Sep 17 00:00:00 2001 From: Holly Whittome Date: Tue, 16 Jan 2024 16:50:15 +0000 Subject: [PATCH] checks in get_latest_roots that all IDs are current --- caveclient/chunkedgraph.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/caveclient/chunkedgraph.py b/caveclient/chunkedgraph.py index d0e19170..a5e499d2 100644 --- a/caveclient/chunkedgraph.py +++ b/caveclient/chunkedgraph.py @@ -1009,7 +1009,9 @@ def get_latest_roots(self, root_id, timestamp=None, timestamp_future=None): out_degree_dict = dict(lineage_graph.out_degree) nodes = np.array(list(out_degree_dict.keys())) out_degrees = np.array(list(out_degree_dict.values())) - return nodes[out_degrees == 0] + out_degree_nodes = nodes[out_degrees == 0] + are_they_current = self.is_latest_roots(out_degree_nodes,timestamp=timestamp) + return out_degree_nodes[are_they_current] else: # then timestamp is in fact in the past lineage_graph = self.get_lineage_graph( @@ -1021,7 +1023,9 @@ def get_latest_roots(self, root_id, timestamp=None, timestamp_future=None): in_degree_dict = dict(lineage_graph.in_degree) nodes = np.array(list(in_degree_dict.keys())) in_degrees = np.array(list(in_degree_dict.values())) - return nodes[in_degrees == 0] + in_degree_nodes = nodes[in_degrees == 0] + are_they_current = self.is_latest_roots(in_degree_nodes,timestamp=timestamp) + return in_degree_nodes[are_they_current] def get_original_roots(self, root_id, timestamp_past=None): """Returns root IDs that are the latest successors of a given root ID.