From fa70e65faa755eb9512d18063b151e924a571731 Mon Sep 17 00:00:00 2001 From: Matt Einhorn Date: Thu, 23 May 2024 01:38:41 -0400 Subject: [PATCH] Scipy doesn't have callback so don't show progress. --- brainglobe_utils/cells/cells.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/brainglobe_utils/cells/cells.py b/brainglobe_utils/cells/cells.py index 64be3ab..7d97fa4 100644 --- a/brainglobe_utils/cells/cells.py +++ b/brainglobe_utils/cells/cells.py @@ -513,15 +513,21 @@ def match_cells( if flip: c1, c2 = c2, c1 - progress = tqdm(desc="Matching cells", total=len(c1), unit="cells") - __progress_update.updater = progress.update + progress = None + if not use_scipy: + # with scipy we don't have callbacks so no updates + progress = tqdm(desc="Matching cells", total=len(c1), unit="cells") + __progress_update.updater = progress.update + # for each index corresponding to c1, returns the index in c2 that matches try: assignment = match_points(c1, c2, threshold, pre_match, use_scipy) - progress.close() finally: __progress_update.updater = None + if progress is not None: + progress.close() + missing_c1, good_matches, missing_c2 = analyze_point_matches( c1, c2, assignment, threshold )