Skip to content

API Reference

parse_args(argv=None)

Parse CLI args and attach a resolved path field.

resolve_input_path(ref)

Resolve a user-provided reference into a TOML filepath.

Accepts
  • full path ".../file.toml"
  • basename with extension "file.toml"
  • basename without extension "file"
Search order

1) exact ref (as-is) 2) .toml in CWD (if no .toml given) 3) examples/.toml 4) default examples/linear_slab.toml


hermite_coupling_factors(Nn)

Return sqrt(n) and sqrt(n+1) arrays of length Nn with sqrt(0)=0. These appear in the v_|| streaming operator couplings.

lb_eigenvalues(Nn, Nm, alpha=1.0, beta=2.0)

Diagonal Lenard–Bernstein rates in Hermite–Laguerre space.






ElectrostaticDrive

Bases: Module

Very simple electrostatic drive: E_∥ ~ C_{0,0} / kpar; dC_{1,0}/dt += - coef * sqrt(2) * i * E_∥

LenardBernstein

Bases: Module

Diagonal Lenard–Bernstein model in Hermite–Laguerre space: dC/dt += -nu*(α n + β m) C.

NonlinearConvolution

Bases: Module

Quadratic E–a convolution in Fourier space, only Laguerre m=0 is active.

State expected (nonlinear mode): C[k, n, m], complex. E_k = i * a_{k, n=0, m=0} / k N_{k, n>=1, m=0} = sqrt(2n) * sum_{k'} E_{k'} * a_{k-k', n-1, m=0} = sqrt(2n) * IFFT[ FFT(E) * FFT(a[:, n-1]) ]

Dealiasing options
  • two_thirds: zero spectral coefficients for |idx| > floor(Nk/3)
  • houli: multiply by exp(-36 * (|idx|/ (Nk/2))^36)
  • none: do nothing
Notes
  • Assumes a uniform FFT grid in k (use klist of equally spaced values).
  • Leaves Laguerre m>0 untouched; only m=0 updated.

StreamingOperator

Bases: Module

Hermite streaming along straight B; Fourier in z with kpar.

dC_{n,m}/dt += -i * (kpar*vth/sqrt(2)) * [ sqrt(n+1) C_{n+1,m} + sqrt(n) C_{n-1,m} ]

__call__(C)

Complex-space streaming RHS.

StreamingOperatorKS

Bases: Module

Streaming with multiple Fourier modes: expects C[k, n, m].


panel_energy(ax, res)

[0,0] Energies vs t: W_f, W_E, ∫C dt, ∫P_N dt, and their sum.

plot_energy(res)

Interactive energy panel (same as summary [0,0]).

save_summary(res, out_png)

Save a 3x2 summary figure composed from reusable panel functions.

Layout

(0,0) Energies vs t: W_f, W_E, ∫C dt, and W_f+W_E+∫C dt (0,1) density(x,t) imshow (vertical = x, horizontal = t) (1,0) f(v_parallel, v_perp) imshow at t=0 (1,1) f(v_parallel, v_perp) imshow at final time (2,0) Hermite heatmap |C_{n,m=0}(t)| (2,1) Stacked heatmap of |C_{n,m}(t)| blocks over time


info_line(msg)

Print a single status line (respects Rich/NO_COLOR settings).

init_pretty(prefer_rich=True)

Initialize pretty output. - Disables color if NO_COLOR is set (case-insensitive). - Uses Rich only if available, preferred, and NO_COLOR is not set. - Prints a minimal tip if Rich is preferred but not installed.



ComplexTerm

Bases: Protocol

Any physics operator that maps complex HL coefficients to a complex RHS.

````