uvisbox.Modules.CurveBoxplot.curve_boxplot_stats

Module Contents

uvisbox.Modules.CurveBoxplot.curve_boxplot_stats.curve_boxplot_summary_statistics(curves, boxplot_style=None, workers=12)[source]

Compute curve band depth summary statistics without visualization.

This function computes curve band depths, sorts curves, and identifies percentile bands and outliers based on the configuration.

Parameters:
  • curves (numpy.ndarray) – 3D array of shape (n_curves, n_steps, n_dims) containing curve data. Input data is not modified (computation happens on a copy).

  • boxplot_style (BoxplotStyleConfig, optional) – Configuration for the boxplot including percentiles and outlier settings. If None, uses default configuration.

  • workers (int, optional) – Number of worker processes for parallel computation of band depths. Default is 12. Set to 1 or None to use sequential processing (useful for debugging).

Returns:

stats – Dictionary containing the following keys: - ‘depths’: np.ndarray of shape (n_curves,) - band depths for each curve - ‘sorted_indices’: np.ndarray of shape (n_curves,) - original indices sorted by depth (descending) - ‘sorted_curves’: np.ndarray of shape (n_curves, n_steps, n_dims) - curves sorted by depth (descending) - ‘median_curve’: np.ndarray of shape (n_steps, n_dims) - curve with highest depth - ‘percentiles’: list of floats - percentile values from boxplot_style - ‘outliers’: np.ndarray of shape (n_outliers, n_steps, n_dims) - outlier curves beyond largest percentile - ‘n_dims’: int - dimensionality of curves (2 or 3)

Return type:

dict

Raises:

ValueError – If curves is not a 3D array or if n_dims is not 2 or 3.

Examples

>>> import numpy as np
>>> from uvisbox.Modules.CurveBoxplot.curve_boxplot_stats import curve_boxplot_summary_statistics
>>> from uvisbox.Core.CommonInterface import BoxplotStyleConfig
>>>
>>> # Generate synthetic curve data (50 curves, 100 time steps, 2D)
>>> curves = np.random.randn(50, 100, 2).cumsum(axis=1)
>>>
>>> # Basic usage with default settings
>>> stats = curve_boxplot_summary_statistics(curves)
>>> print(f"Median curve shape: {stats['median_curve'].shape}")
>>> print(f"Number of outliers: {stats['outliers'].shape[0]}")
>>>
>>> # Custom percentiles
>>> style = BoxplotStyleConfig(percentiles=[10, 50, 90], show_outliers=True)
>>> stats = curve_boxplot_summary_statistics(curves, boxplot_style=style)