piel.analysis.metrics.statistics
================================

.. py:module:: piel.analysis.metrics.statistics


Functions
---------

.. autoapisummary::

   piel.analysis.metrics.statistics.aggregate_scalar_metrics_collection


Module Contents
---------------

.. py:function:: aggregate_scalar_metrics_collection(metrics_collection: piel.types.ScalarMetricCollection) -> piel.types.ScalarMetric

   Aggregates a ScalarMetricCollection into a single ScalarMetrics instance.

   The aggregation is performed as follows:
   - mean: Weighted mean based on count.
   - min: Minimum of all min values.
   - max: Maximum of all max values.
   - standard_deviation: Combined standard deviation considering individual means and counts.
   - count: Sum of all counts.
   - unit: Must be consistent across all ScalarMetrics.

   :param metrics_collection: A ScalarMetricsCollection instances to aggregate.
   :type metrics_collection: ScalarMetricCollection

   :returns: A single ScalarMetrics instance representing the aggregated metrics.
   :rtype: ScalarMetric

   :raises ValueError: If the input list is empty or units are inconsistent.


