simopt.curve_utils
Curve utility functions.
This module provides utility functions for manipulating and analyzing curves.
Module Contents
- simopt.curve_utils.mean_of_curves(curves: collections.abc.Iterable[simopt.curve.Curve]) simopt.curve.Curve
Compute the pointwise mean of a collection of curves.
All curves must have identical starting and ending x-values.
- simopt.curve_utils.quantile_of_curves(curves: collections.abc.Iterable[simopt.curve.Curve], beta: float) simopt.curve.Curve
Compute the pointwise quantile of a collection of curves.
All curves must have identical starting and ending x-values.
- Parameters:
curves (Iterable[Curve]) – A collection of curves to aggregate.
beta (float) – The quantile level to compute (e.g., 0.5 for median).
- Returns:
A curve representing the pointwise quantile across the input curves.
- Return type:
- Raises:
TypeError – If input is not a valid collection of Curve objects.
- simopt.curve_utils.cdf_of_curves_crossing_times(curves: collections.abc.Iterable[simopt.curve.Curve], threshold: float) simopt.curve.Curve
Compute the CDF of crossing times from a collection of curves.
The crossing time is defined as the first x-value where a curve crosses a given threshold.
- simopt.curve_utils.quantile_cross_jump(curves: collections.abc.Iterable[simopt.curve.Curve], threshold: float, beta: float) simopt.curve.Curve
Compute a curve with a jump at the quantile of the crossing times.
The curve is piecewise-constant with a single jump located at the specified quantile of the first crossing times across the input curves.
- Parameters:
curves (list[Curve]) – A list of curves to analyze.
threshold (float) – The y-value at which to detect the first crossing.
beta (float) – The quantile level (e.g., 0.5 for median crossing time).
- Returns:
A piecewise-constant curve with a jump at the quantile crossing time, if finite.
- Return type:
- Raises:
TypeError – If input types are incorrect.
- simopt.curve_utils.difference_of_curves(curve_1: simopt.curve.Curve, curve_2: simopt.curve.Curve) simopt.curve.Curve
Compute the difference between two curves (curve_1 - curve_2).
The x-values of both curves must align exactly.
- simopt.curve_utils.max_difference_of_curves(curve_1: simopt.curve.Curve, curve_2: simopt.curve.Curve) float
Compute the maximum pointwise difference between two curves (curve_1 - curve_2).