From e5c99e754553539043f08f25a501cc1c0244d5b2 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 15 Mar 2024 11:39:28 -0400 Subject: [PATCH 1/3] Adding progress bar for CLSync --- src/aspire/abinitio/commonline_base.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/aspire/abinitio/commonline_base.py b/src/aspire/abinitio/commonline_base.py index c33a63cec1..95e3ff2b0f 100644 --- a/src/aspire/abinitio/commonline_base.py +++ b/src/aspire/abinitio/commonline_base.py @@ -5,7 +5,7 @@ import scipy.sparse as sparse from aspire.operators import PolarFT -from aspire.utils import common_line_from_rots, fuzzy_mask +from aspire.utils import common_line_from_rots, fuzzy_mask, tqdm from aspire.utils.random import choice logger = logging.getLogger(__name__) @@ -167,6 +167,10 @@ def build_clmatrix(self): # Note that only use half of each ray pf = self._apply_filter_and_norm("ijk, k -> ijk", pf, r_max, h) + # Setup a progress bar + _total_pairs_to_test = self.n_check * (self.n_check - 1) // 2 + pbar = tqdm(desc="Searching over common line pairs", total=_total_pairs_to_test) + # Search for common lines between [i, j] pairs of images. # Creating pf and building common lines are different to the Matlab version. # The random selection is implemented. @@ -211,6 +215,8 @@ def build_clmatrix(self): clmatrix[j, i] = cl2 cl_dist[i, j] = sval shifts_1d[i, j] = shifts[shift] + pbar.update() + pbar.close() self.clmatrix = clmatrix self.shifts_1d = shifts_1d From 434e6331b5c36c5aff3d440be05d53c0769d4764 Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 15 Mar 2024 11:42:36 -0400 Subject: [PATCH 2/3] fix logging message in estimator --- src/aspire/reconstruction/estimator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aspire/reconstruction/estimator.py b/src/aspire/reconstruction/estimator.py index e002b7c3da..679b3e1234 100644 --- a/src/aspire/reconstruction/estimator.py +++ b/src/aspire/reconstruction/estimator.py @@ -51,7 +51,7 @@ def __init__( self.src = src if basis is None: - logger.info("{self.__class__.__name__} instantiating default basis.") + logger.info(f"{self.__class__.__name__} instantiating default basis.") basis = FFBBasis3D(src.L, dtype=src.dtype) self.basis = basis self.dtype = self.src.dtype From 6d5342892e75524abba58c5f2d6f6affcecc4dfc Mon Sep 17 00:00:00 2001 From: Garrett Wright Date: Fri, 15 Mar 2024 14:07:58 -0400 Subject: [PATCH 3/3] fix total pairs count --- src/aspire/abinitio/commonline_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aspire/abinitio/commonline_base.py b/src/aspire/abinitio/commonline_base.py index 95e3ff2b0f..e3d8fa50db 100644 --- a/src/aspire/abinitio/commonline_base.py +++ b/src/aspire/abinitio/commonline_base.py @@ -168,7 +168,7 @@ def build_clmatrix(self): pf = self._apply_filter_and_norm("ijk, k -> ijk", pf, r_max, h) # Setup a progress bar - _total_pairs_to_test = self.n_check * (self.n_check - 1) // 2 + _total_pairs_to_test = self.n_img * (self.n_check - 1) // 2 pbar = tqdm(desc="Searching over common line pairs", total=_total_pairs_to_test) # Search for common lines between [i, j] pairs of images.