From b7ba0c427b6b1546b20ed85a2970d45613bbb10d Mon Sep 17 00:00:00 2001 From: anna-grim Date: Tue, 19 Nov 2024 21:55:51 +0000 Subject: [PATCH] bug: filtering --- src/deep_neurographs/fragment_filtering.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/deep_neurographs/fragment_filtering.py b/src/deep_neurographs/fragment_filtering.py index cb35e91..2333233 100644 --- a/src/deep_neurographs/fragment_filtering.py +++ b/src/deep_neurographs/fragment_filtering.py @@ -52,6 +52,7 @@ def remove_curvy(fragments_graph, max_length, ratio=0.5): length = fragments_graph.edges[i, j]["length"] endpoint_dist = fragments_graph.dist(i, j) if endpoint_dist / length < ratio and length < max_length: + print(i, j) deleted_ids.add(fragments_graph.edges[i, j]["swc_id"]) delete_fragment(fragments_graph, i, j) return len(deleted_ids) @@ -218,7 +219,10 @@ def remove_xyz_entries(fragments_graph, i, j): """ for xyz in fragments_graph.edges[i, j]["xyz"]: - del fragments_graph.xyz_to_edge[tuple(xyz)] + try: + del fragments_graph.xyz_to_edge[tuple(xyz)] + except KeyError: + pass return fragments_graph