libera_utils.footprint_matching.aggregation.aggregate#

libera_utils.footprint_matching.aggregation.aggregate(strategy: str, values: ndarray, weights: ndarray, **kwargs: Any) → AggregationResult#

Run a named aggregation strategy and wrap it with sample bookkeeping.

Looks strategy up in the registry, invokes it on (values, weights), and packages the result in an AggregationResult with the number of samples that contributed.

Parameters:
  • strategy (str) – Registered strategy name (a key of _STRATEGIES).

  • values (np.ndarray) – Per-cell data values and PSF weights (any shape; flattened internally by the strategies via the usable-mask helper).

  • weights (np.ndarray) – Per-cell data values and PSF weights (any shape; flattened internally by the strategies via the usable-mask helper).

  • **kwargs – Extra strategy arguments (n_categories for the mode strategies).

Return type:

AggregationResult

Raises:

ValueError – If strategy is not registered.