Skip to content

TOML-first examples: species tables, 11-line scripts, scans by override - #64

Open
rogeriojorge wants to merge 5 commits into
feature/auto-plotsfrom
feature/toml-examples
Open

rogeriojorge wants to merge 5 commits into
feature/auto-plotsfrom
feature/toml-examples

Conversation

@rogeriojorge

@rogeriojorge rogeriojorge commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

Stacked on #63, which is stacked on #62.

Problem

Each 1D example re-implemented the Hermite–Fourier initial state by hand: index arithmetic for Ck_0 and Fk_0, and a separate TOML file per scan. Users copied 60–130 lines to set up a case.

Change

  • Two cases are now TOML files: input_1D_landau_damping.toml and input_1D_two_stream.toml describe their species physically and run with spectrax <file>. Their scripts shrink from 65 and 59 lines to 11 each: load, simulate, plot.
  • Scans reuse the same files: the damping-rate and growth-rate scans set the box length per wavenumber with load_parameters(file, Lx=...). The growth scan also changes resolution and the seed with species={...} overrides. This replaces two duplicated TOML files and their index arithmetic.
  • No pandas: the scans read their CSV references with NumPy.
  • Orszag–Tang unchanged: its initial magnetic field is not a species description, so it stays a Python example.

load_parameters(input_file, **overrides) accepts any input or solver key, plus species={name: {...}}.

Before After
Lines in the 1D example scripts 375 78
Files in Examples 13 11

Checks

  • Both examples run, and their automatic figures show Landau damping and the two-stream trapping vortex.
  • The full suite passes.

Landau damping and two-stream are described entirely in their TOML files and run with spectrax input.toml; their scripts shrink to a few lines. The growth- and damping-rate scans reuse those files through load_parameters overrides, so two duplicated TOML files and their index arithmetic go away.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant