uvisbox.Modules.FunctionalBoxplot.functional_boxplot_stats
Module Contents
- uvisbox.Modules.FunctionalBoxplot.functional_boxplot_stats.functional_boxplot_band_depths(data, method='fbd')[source]
Compute band depths for a set of functional curves.
- Parameters:
curves (np.ndarray) – 2D array of shape (N, D) where N is the number of curves and D is the number of points per curve.
method (str, optional) – Band-depth method:
"fbd"for functional band depth (default) or"mfbd"for modified functional band depth.
- uvisbox.Modules.FunctionalBoxplot.functional_boxplot_stats.functional_boxplot_get_band(data, percentile, method='fbd')[source]
Compute the band envelope for a given percentile using functional band depth.
- Parameters:
data (np.ndarray) – 2D array of shape (N, D) where N is the number of curves and D is the number of points per curve.
percentile (float) – Percentile value (0-100) for the band envelope.
method (str, optional) – Band-depth method:
"fbd"for functional band depth (default) or"mfbd"for modified functional band depth.
- Returns:
bottom_curve (np.ndarray) – 1D array representing the bottom envelope of the band.
top_curve (np.ndarray) – 1D array representing the top envelope of the band.
Examples
>>> data = np.random.randn(100, 50) # 100 curves, 50 points each >>> bottom, top = functional_boxplot_get_band(data, 50, method='fbd') # 50th percentile band
- uvisbox.Modules.FunctionalBoxplot.functional_boxplot_stats.functional_boxplot_summary_statistics(data, method='fbd', boxplot_style=None)[source]
Compute functional boxplot summary statistics without visualization.
This function computes the same statistics as functional_boxplot but returns them as numpy arrays in a dictionary instead of creating a plot.
- Parameters:
data (np.ndarray) – 2D array of shape (N, D) where N is the number of curves and D is the number of points per curve.
method (str, optional) – Band-depth method:
"fbd"for functional band depth (default) or"mfbd"for modified functional band depth.boxplot_style (BoxplotStyleConfig, optional) – Configuration for the boxplot including percentiles and outlier settings. If None, uses default configuration.
- Returns:
stats – Contains
depths,median,percentile_bands,outliers,sorted_curves, andsorted_indices. Each percentile band is a(bottom_curve, top_curve)tuple; both curves have shape(D,).- Return type:
dict
- Raises:
ValueError – If data is not 2D or if method is invalid.
Examples
>>> import numpy as np >>> from uvisbox.Modules.FunctionalBoxplot.functional_boxplot_stats import functional_boxplot_summary_statistics >>> from uvisbox.Core.CommonInterface import BoxplotStyleConfig >>> >>> # Generate synthetic functional data >>> t = np.linspace(0, 1, 100) >>> data = np.array([np.sin(2*np.pi*t) + 0.2*np.random.randn(100) for _ in range(50)]) >>> >>> # Basic usage with default settings >>> stats = functional_boxplot_summary_statistics(data) >>> print(f"Median curve shape: {stats['median'].shape}") >>> print(f"Number of outliers: {stats['outliers'].shape[0]}") >>> print(f"Available percentile bands: {list(stats['percentile_bands'].keys())}") >>> >>> # Access specific percentile band >>> bottom_25, top_25 = stats['percentile_bands']['25_percentile_band'] >>> print(f"25th percentile band shapes: {bottom_25.shape}, {top_25.shape}") >>> >>> # Custom percentiles >>> style = BoxplotStyleConfig(percentiles=[10, 50, 90], show_outliers=True) >>> stats = functional_boxplot_summary_statistics(data, boxplot_style=style)