tabular_function
tabular_function(
x,
distributions,
at,
inverse=False,
x_transform='none',
y_transform='none',
confidence_level=None,
allow_negative_y_values=False,
)Evaluate a tabular function.
Mirrors the C# TabularFunction: builds an uncertain paired curve from x and distributions, samples it once (the mean curve, or confidence_level if given), and evaluates Function()/InverseFunction() at at. Unlike :func:curve_interpolate and friends, the underlying curve’s shape contract is not configurable here – TabularFunction is always built strict, ascending on both axes, matching every use in the ported C# test suite.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| x | array_like | The curve’s 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 |
| at | array_like | Points to evaluate at (or, when inverse=True, points to evaluate the inverse function at). |
required |
| inverse | bool | If True, evaluates InverseFunction() instead of Function(). |
False |
| x_transform | ('none', 'logarithmic', 'log', 'normal_z') | “log” is an accepted alias for “logarithmic” (both parse to the same value); “logarithmic” is the spelling used in this package’s own examples. | "none" |
| y_transform | ('none', 'logarithmic', 'log', 'normal_z') | “log” is an accepted alias for “logarithmic” (both parse to the same value); “logarithmic” is the spelling used in this package’s own examples. | "none" |
| confidence_level | float | Quantile in [0, 1] to sample the curve at; None (default) samples the mean. |
None |
| allow_negative_y_values | bool | Allow a negative or NaN result to pass through unmodified, rather than clamping it to 0. Default False (clamp), matching every use in the ported C# test suite – the C# class default is True. |
False |
Returns
| Name | Type | Description |
|---|---|---|
| numpy.ndarray | Same length as at. |
Examples
>>> from corehydropy import Distribution, tabular_function
>>> x = [50, 100, 150, 200, 250]
>>> d = [Distribution("Deterministic", [v]) for v in [100, 200, 300, 400, 500]]
>>> tabular_function(x, d, at=50, x_transform="logarithmic")
array([100.])