diff --git a/dap/algos/aggregation.py b/dap/algos/aggregation.py index 3b10789..b728db4 100644 --- a/dap/algos/aggregation.py +++ b/dap/algos/aggregation.py @@ -79,9 +79,9 @@ def calc_aggregation_ready(results, data, aggregator): if "aggregation_max" not in results: return False - n_aggregated_images = aggregator.counter + aggregation_max = results["aggregation_max"] - if n_aggregated_images < results["aggregation_max"]: + if not aggregator.is_ready(aggregation_max): return False aggregator.reset() diff --git a/dap/utils/aggregator.py b/dap/utils/aggregator.py index bd6d315..1d3cfab 100644 --- a/dap/utils/aggregator.py +++ b/dap/utils/aggregator.py @@ -19,6 +19,9 @@ class Aggregator: __iadd__ = add + def is_ready(self, nmax): + return (self.counter >= nmax) + def __repr__(self): return f"{self.data!r} / {self.counter}"