Skip to content

chc.metrics

Stability tier: evolving.

Classical closed-loop step-response quality metrics.

Cost and oracle-regret (chc.benchmark) say how well a controller did on the task objective; these say how it got there -- the transient-response vocabulary a control engineer reads first: overshoot, settling time, rise time, steady-state error. They apply to any tracking/regulation signal (one output component vs its target), independent of the controller that produced it.

Post-hoc trajectory analysis, so NumPy float64 throughout (like chc.did), not part of the differentiable control core.

overshoot(signal, target, *, initial=None)

Peak excursion past target as a fraction of the step target - initial (0 if none).

0.05 means the response overshot the target by 5% of the step. initial defaults to the first sample.

settling_time(signal, target, dt, *, initial=None, tol=0.02)

Time after which signal stays within tol of the step and never leaves again.

tol is a fraction of the step magnitude (2% by convention). Returns 0.0 if never outside the band and inf if still outside at the end of the record (did not settle).

rise_time(signal, target, dt, *, initial=None, low=0.1, high=0.9)

Time to cross from low to high fraction of the step (10%-90% by convention).

steady_state_error(signal, target, *, window=1)

Absolute error at rest: |mean(signal[-window:]) - target| (final value by default).