Skip to content

Uncertainty contracts and evaluation

These reusable primitives describe explicit parameter assumptions and evaluate one sample through the deterministic barrel solver. See the uncertainty guide for scope and provenance requirements. Study orchestration and design acceptance remain downstream concerns.

Independent, early-stage culvert hydraulics library.

The package exposes internally tested geometry and hydraulic components through provisional combined solvers. External engineering validation is not yet complete.

HydraulicUncertaintyParameter

Bases: StrEnum

Hydraulic inputs currently supported by the uncertainty evaluation primitive.

unit property

Return the canonical SI unit for this parameter.

HydraulicUncertaintyUnit

Bases: StrEnum

Canonical units carried by public uncertainty values.

ParameterBounds dataclass

Inclusive finite lower and upper bounds in an explicit unit.

BoundedParameterSpec dataclass

Deterministic bounded uncertainty specification without a probability model.

UniformParameterSpec dataclass

Uniform probability specification with explicit bounds and provenance.

SampledParameter dataclass

One sampled hydraulic input with identity, SI unit and uncertainty source.

HydraulicSample dataclass

One low-level evaluation sample containing unique hydraulic parameters.

EvaluationFailureKind

Bases: StrEnum

Expected deterministic solver failure categories retained by an evaluation.

HydraulicEvaluationFailure dataclass

Expected solver failure retained instead of silently dropping the sample.

BarrelUncertaintyEvaluation dataclass

Outcome of evaluating one sample through the public barrel solver.

status property

Hydraulic result status, or None when the deterministic solve failed.

warnings property

Structured hydraulic warnings retained from a successful solve.

convergence property

Numerical convergence evidence retained from a successful solve.

sample_bounded_parameter(spec, *, count)

Return an inclusive evenly spaced deterministic sweep over the stated bounds.

A single requested sample is placed at the midpoint. Two or more samples include both stated bounds exactly. No probability distribution is implied.

sample_uniform_parameter(spec, *, count, seed)

Return reproducible uniform samples using an explicit local random seed.

evaluate_barrel_sample(sample, *, barrel, discharge, tailwater, inlet_coefficients=None, entrance_loss_coefficient=None, entrance_loss_source=None, configuration=None, g=GRAVITATIONAL_ACCELERATION)

Evaluate one uncertainty sample through the public barrel solver.

Only explicit deterministic hydraulic inputs are varied. Numerical tolerances are intentionally absent from the uncertainty parameter vocabulary. Expected input-domain and convergence failures are returned as data; unexpected programming errors propagate.