suboptimumg.log_analysis.yaw_plots#
- suboptimumg.log_analysis.yaw_plots.eval_lpv_bode(chassis, irl_car, V_grid, f_grid)[source]#
Evaluate the analytic Bode surface over a (speed, frequency) grid.
- Parameters:
chassis (ChassisParams) – Chassis scalars to evaluate the transfer function at.
irl_car (IrlCar) – Source of the mass, wheelbase, and CG split.
V_grid (NDArray[np.float64]) – Speed grid (m/s), length
nV.f_grid (NDArray[np.float64]) – Frequency grid (Hz), length
nf.
- Returns:
mag (NDArray[np.float64]) – Dimensionless magnitude
|H(j 2 pi f; V)|, shape(nV, nf).phase_deg (NDArray[np.float64]) – Phase, unwrapped along the frequency axis (deg), shape
(nV, nf).
- Return type:
tuple[NDArray[float64], NDArray[float64]]
- suboptimumg.log_analysis.yaw_plots.plot_bode_slices(fits, V_picks, f_grid, linear_scale=False)[source]#
Two-panel magnitude/phase Bode of one or more fits, at fixed speeds.
Every (fit, speed) pair becomes its own series. Fits after the first are drawn dashed, so a comparison model reads clearly against the headline one.
- Parameters:
fits (dict[str, YawFit]) – Fits keyed by display name.
V_picks (NDArray[np.float64] or list of float) – Speeds to slice at (m/s).
f_grid (NDArray[np.float64]) – Frequency grid (Hz).
linear_scale (bool, optional) – Plot magnitude linearly rather than in dB.
- Return type:
go.Figure
- suboptimumg.log_analysis.yaw_plots.plot_bode_surface(fit, V_grid, f_grid, log_mag=True)[source]#
Magnitude Bode surface of a fit over (speed, frequency).
- Parameters:
fit (YawFit) – Supplies the linear-region chassis parameters and geometry.
V_grid (NDArray[np.float64]) – Speed grid (m/s).
f_grid (NDArray[np.float64]) – Frequency grid (Hz).
log_mag (bool, optional) – Plot magnitude in dB rather than linear.
- Return type:
go.Figure
- suboptimumg.log_analysis.yaw_plots.plot_fit_overlay(window_arrays, prediction, subwindow_indices=None, max_display_hz=50.0, height_per_subplot=220, error_ylim=(-1.0, 1.0), relative_time=True)[source]#
Measured vs simulated yaw rate per sub-window, residual on the second axis.
Works for a training fit (
fit.train) or a held-out evaluation, since both are aPrediction.- Parameters:
window_arrays (list of WindowArrays) – Source sub-windows.
prediction (Prediction) – Predictions to overlay; must be aligned with
window_arrays.subwindow_indices (list of int, range, slice, or None, optional) – Which sub-windows to draw.
Nonedraws all of them.max_display_hz (float, optional) – Downsample the traces to at most this rate, for browser responsiveness.
height_per_subplot (int, optional) – Pixel height per sub-window row.
error_ylim (tuple[float, float], optional) – Fixed initial range for the residual axis (rad/s).
relative_time (bool, optional) – Start each sub-window’s time axis at zero.
- Return type:
go.Figure
- Raises:
ValueError – If
subwindow_indicesselects nothing.
- suboptimumg.log_analysis.yaw_plots.plot_residual_vs(window_arrays, prediction, x_of='amplitude', n_bins=24)[source]#
Residual structure against steering, steering amplitude, or speed.
A flat binned mean means the model has extracted everything systematic. Residual that grows with
"amplitude"is the classic tire-saturation signature, and the reason the Ca-decay scheduler exists.- Parameters:
window_arrays (list of WindowArrays) – Source sub-windows.
prediction (Prediction) – Supplies the residuals; must be aligned with
window_arrays.x_of ({"input", "amplitude", "speed"}, optional) – What to put on the x axis: signed steering (deg), absolute steering (deg), or speed (m/s).
n_bins (int, optional) – Number of quantile bins for the mean/sigma overlay.
- Return type:
go.Figure
- Raises:
ValueError – If
x_ofis unrecognised.