From 7a05d8f095c2c36f861512be6829f571a85835ac Mon Sep 17 00:00:00 2001 From: Sven Augustin Date: Fri, 30 Aug 2024 15:56:27 +0200 Subject: [PATCH] moved aggregator.reset() [this now also resets if aggregation_max wasnt given] --- dap/algos/aggregation.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/dap/algos/aggregation.py b/dap/algos/aggregation.py index baf317e..19a741d 100644 --- a/dap/algos/aggregation.py +++ b/dap/algos/aggregation.py @@ -4,23 +4,13 @@ from .thresh import threshold def calc_apply_aggregation(results, data, pixel_mask_pf, aggregator): calc_apply_threshold(results, data) # changes data in place - data = calc_data(results, data, aggregator) + data = calc_aggregate(results, data, aggregator) calc_mask_pixels(data, pixel_mask_pf) # changes data in place aggregation_ready = calc_aggregation_ready(results, aggregator) return data, aggregation_ready -def calc_data(results, data, aggregator): - apply_aggregation = results.get("apply_aggregation", False) - - if not apply_aggregation: - aggregator.reset() - - return calc_aggregate(results, data, aggregator) - - - #TODO: this is duplicated in calc_apply_threshold and calc_radial_integration def calc_apply_threshold(results, data): apply_threshold = results.get("apply_threshold", False) @@ -41,9 +31,11 @@ def calc_apply_threshold(results, data): def calc_aggregate(results, data, aggregator): apply_aggregation = results.get("apply_aggregation", False) if not apply_aggregation: + aggregator.reset() return data if "aggregation_max" not in results: + aggregator.reset() return data aggregator += data