uncertain_curve_sample
uncertain_curve_sample(
x,
distributions,
probability=None,
order_x='ascending',
order_y='ascending',
strict_x=True,
strict_y=True,
)Sample an uncertain paired curve.
Mirrors the C# UncertainOrderedPairedData.CurveSample()/CurveSample(double): collapses a curve whose Y-coordinate is a whole distribution at each x down to a plain x-y curve, either at the distributions’ means (probability=None, the default) or at a shared quantile (probability in [0, 1]).
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| x | array_like | x positions, at least one element. | required |
| distributions | Distribution or list of Distribution | One distribution per element of x, or a single distribution recycled across every x. |
required |
| probability | float | Quantile in [0, 1] to sample at; None (default) samples the mean. Values outside [0, 1] are rejected – the underlying C# CurveSample(double) silently clamps them instead, so this range check is enforced here rather than core-side. |
None |
| order_x | ('ascending', 'descending', 'none') | "ascending" |
|
| order_y | ('ascending', 'descending', 'none') | "ascending" |
|
| strict_x | bool | True |
|
| strict_y | bool | True |
Returns
| Name | Type | Description |
|---|---|---|
| numpy.ndarray | An (n, 2) array with columns [x, y]. |
Examples
>>> from corehydropy import Distribution, uncertain_curve_sample
>>> x = [1, 2, 3, 5]
>>> d = [Distribution("Triangular", [1, 2, 3]), Distribution("Triangular", [2, 4, 5]),
... Distribution("Triangular", [6, 8, 12]), Distribution("Triangular", [13, 19, 20])]
>>> uncertain_curve_sample(x, d, probability=0.5)
array([[ 1. , 2. ],
[ 2. , 3.732051 ],
[ 3. , 8.535898 ],
[ 5. , 17.58258 ]])