zoomy_core.analysis.plotting module#
Plotting helpers for zoomy_core.analysis.
Lightweight wrappers around matplotlib. Lazy-imported so the package stays usable without matplotlib installed.
Two main entry points:
plot_dispersion(result, k_range, ...)—line plot of phase velocity
C(k) = ω/k(or ω(k)) for each propagating mode in aplane_wave_dispersionresult. Accepts reference curves (e.g. Airytanh(kH)/(kH)) for overlay comparison.plot_hyperbolic_region_2d(M_x, M_t, axis_a, axis_b, fixed_subs, ...)—2D color map of the hyperbolic region over a chosen parameter pair, with all other parameters held at user-specified values. Mirrors the Koellermeier–Torrilhon-style figures used to characterise the loss-of-hyperbolicity region in the SME family.
- zoomy_core.analysis.plotting.plot_dispersion(result, k_range, *, k_var=None, ax=None, n_points=200, mode='phase_velocity', fixed_subs=None, references=None, nondimensionalise_by=None, squared=False, title=None, mode_labels=None, drop_zero_modes=True, **plot_kwargs)#
Plot dispersion curves from a
plane_wave_dispersionresult.- Parameters:
result (Dict) – dict from
plane_wave_dispersion().k_range (Tuple[float, float]) –
(k_lo, k_hi)numeric range over which to evaluate.k_var (Optional[Symbol]) – wavenumber symbol; auto-detected as
Symbol('k')if absent.ax – matplotlib axis to draw on; new figure created if None.
n_points (int) – grid resolution along k.
mode (str) –
'phase_velocity'(C = ω/k) or'omega'.fixed_subs (Optional[Dict]) – dict
{Symbol: number}for the non-k free symbols.references (Optional[Dict[str, Callable]]) – dict
{label: callable(k_arr)}for overlay curves (e.g.{'Airy': lambda k: np.sqrt(np.tanh(k*H)/(k*H))}).nondimensionalise_by (Optional[Tuple[str, Any]]) – tuple
(label, expr); if given, the y-axis becomesy / exprand the label includeslabel(e.g.('gH', g*H)).squared (bool) – if True, plot
y**2instead ofy(forC²/(gH)).title (Optional[str]) – optional plot title.
mode_labels (Optional[List[str]]) – if given, list of length
len(solutions)for the legend; otherwisemode 0, mode 1, ….drop_zero_modes (bool) – if True (default), skip ω-solutions that are identically zero (trivial constraint modes).
- Returns:
{'k', 'curves', 'figure', 'axis'}.
- zoomy_core.analysis.plotting.plot_hyperbolic_region_2d(M_x, M_t, axis_a, axis_b, fixed_subs, *, ax=None, n_a=100, n_b=100, tol=1e-09, drop_infinite=True, show='binary', title=None, cmap=None)#
2D color map of hyperbolicity over a chosen parameter pair.
Each
(a_val, b_val)grid point is evaluated by:Substituting all of
fixed_subsplus{axis_a[0]: a_val, axis_b[0]: b_val}intoM_xandM_t.Computing the generalised eigenvalues of the pencil
(M_x_num, M_t_num)viascipy.linalg.eig.Filtering infinite eigenvalues (constraint modes); the state is hyperbolic iff every remaining eigenvalue has
|imag| < tol.
- Parameters:
M_x – pencil matrices (sympy).
M_t – pencil matrices (sympy).
axis_a (Tuple[Symbol, float, float]) –
(symbol_a, lo, hi)for the x-axis parameter.axis_b (Tuple[Symbol, float, float]) –
(symbol_b, lo, hi)for the y-axis parameter.fixed_subs (Dict) – dict of values for every other free symbol in
M_xandM_t.n_a (int) – grid resolution.
n_b (int) – grid resolution.
show (str) –
'binary'(default — green=hyperbolic, red=non) or'imag_max'(color bymax |Im λ|).cmap (Optional[str]) – optional matplotlib colormap name.
tol (float) –
drop_infinite (bool) –
title (Optional[str]) –
- Returns:
dict with
a_grid,b_grid,is_hyperbolic(bool 2D array),imag_max(float 2D array),figure,axis.