aquakin.time_average#
- aquakin.time_average(integrand, t, axis=0)[source]#
Trapezoidal time-average of
integrandover the window[t0, t1].The single public helper behind every time-averaged index – the
design,aeration_system,ghgandevaluationmodules all call it directly rather than re-wrapping it. The argument order is always(values, t)(values first, times second); keep it that way so no module re-introduces an inverted-signature local copy.For a single saved point – exactly what
Plant.run_to_steady_state()returns (the terminal state only) – the window has zero width, but the time-average of a constant is that constant, so the single sample is returned directly. This yields the meaningful instantaneous (steady-state) value for a one-point solution instead of dividing by a zero window (which previously raisedZeroDivisionErrorinaeration_energy, or gave a spurious zero in the guarded kernels). The metric kernels here are called eagerly on concrete arrays after a solve, so thet.shape[0]branch is a static check.- Parameters:
integrand (array) – Values at the save times, with the time axis at
axis.t (array) – Save times, shape
(n_t,).axis (int) – The time axis of
integrand(default 0).
- Returns:
The time-average, reduced along
axis(a 0-d array for a 1-Dintegrand). Callers that need a Pythonfloatwrap the result infloat(...), as the scalar metric kernels here do.- Return type:
jnp.ndarray