Skip to content

V1.3.0 graphical interface - #54

Merged
victorkolt merged 8 commits into
mainfrom
v.1.3.0-gui
Nov 9, 2026
Merged

victorkolt merged 8 commits into
mainfrom
v.1.3.0-gui

Conversation

@melvinrdn

Copy link
Copy Markdown
Collaborator

Graphical interface for v1.3.0: pip install "thunder4d[gui]", then thunder4d-gui (PySide6, optional, the core never imports Qt). Four tabs, from left to right: design helper, simulation builder, run, results. Everything is saved as the standard input file and .npz results, so a GUI session can be rerun from a script.

  • Design helper: laser presets, target, limits and search space; the search runs in the background (fast1d or analytic) with Stop, ranked designs with their report, design map, "Use in simulation builder".
  • Simulation builder: every field of the input file in readable units, checked while typing, with the eigenmode, P/Pcr, mirror fluence and grid size; CSV import of spectra and mirror curves.
  • Run: pass by pass in the background, live energy, B, peak power and intensity, mode content and M²; Stop (and errors) still save the passes done.
  • Results: 11 figures (caustic, spectra, compressed pulse, spectrograms, ...), pass selector, export of figures and data.
  • Extensible: the windows are built from registries (input fields, live metrics, figures, panels), so later features plug in without touching them. A test fails if a key of the input file has no field description.

Changes to the core:

  • history["peak_intensity"] (W/m², cell centre); the benchmarks use it instead of their own subclass.
  • sim.save() writes mirror_scale: the mirror records of the lens frame are in frame units, the file alone could not convert them.
  • resume() accepts checkpoints written before a history key existed.
  • inputfile: FIELDS, input_problems() and describe_input() (quick checks in milliseconds).
  • cell.match(power) now needs lam= (it silently used 1030 nm); nonlinear_mode(P, lam) too. Every call in the repo already passed it.

Docs and README rewritten shorter (quickstart, user guide, GUI, development); every snippet of the guide runs. Roadmap: v1.3.0 done, version 1.3.0. The tests workflow now installs the Qt libraries for the offscreen GUI tests: this PR is their first CI run.

Closes #18 #19 #20 #21 #22 #23

…registries (refs #18)

- thunder4d.gui: PySide6 main window built from the PANELS registry, Session shared between panels
- registry.py (Qt-free): PANELS, PLOTS (offered when the results hold their keys), METRICS (live values)
- thunder4d-gui [input.json] / python -m thunder4d.gui; without the extra it says how to install it
- [gui] extra (PySide6-Essentials + matplotlib); PySide6 and pytest-qt in the dev group
- GUI tests offscreen; Qt system libraries installed in the tests workflow
- inputfile: FIELDS (how each key is shown and edited; a test checks every key has one),
  input_problems (problems by key, used by check_input), describe_input (eigenmode, grid,
  P/Pcr, mirror fluence in milliseconds)
- gui.fields: one editor per kind of field (EDITORS), CSV/text import and table dialog
- gui.panels.builder: form generated from FIELDS, live checks and summary, open/save of the
  standard input file; only a valid input is published to the session
- gui.panels.design: laser (datasheet presets), target, limits and search space edited through
  DESIGN_FIELDS; screen + refine in the background with Fast 1+1D or analytic estimates, Stop;
  ranked designs with their report, design map around the selected one, save as JSON;
  "Use in simulation builder" exports it with design.to_input and switches tab
- gui.worker.Task: background thread relaying prints, result, errors and cancellation
- gui.plotting.FigureWidget: matplotlib figure with its toolbar
- fields: float_list and multichoice editors; Session.show_panel to switch tabs
- simulation: history["peak_intensity"] (max of |E|^2 at the cell centre, W/m^2) with a test
- gui.panels.run: runs the builder's input pass by pass in the background, progress and ETA,
  Stop after the current pass (results saved), live values and curves of registry.METRICS,
  spectrum input vs now, log; the saved results are published to the session
- gui.metrics: built-in live metrics (energy, B, peak power, peak intensity, mode content, M2)
- gui.results: Results (arrays of a saved run + its path), load_results
- main window asks panels with can_close() before quitting (unsaved input, running computation)
- gui.panels.results: figures of registry.PLOTS that the run can draw (PlotSpec.requires), grouped,
  pass selector for per-pass figures, export of the figure (PNG/PDF/SVG) and of its data (NPZ/CSV),
  open any saved .npz; a failing figure is reported in the panel
- gui.plots: transmission and B, peak power and intensity, caustic (centre and mirrors), beam quality,
  fluence on the mirrors, spectra versus pass, output and compressed pulse, fluence map, (x, lambda)
  and (theta, lambda) spectrograms, mode content per colour
- gui.results: grid rebuilt from the saved run (same compressed pulse as the live grid)
- simulation.save: mirror_scale, so the mirror records of the lens-frame solver can be converted to
  physical units from the file alone (test: the saved mirror spot is the eigenmode w_mirror)
- docs: page "Graphical interface" (install, launch, tutorial from a laser to a compressed pulse,
  files, extending the interface through its registries), API page thunder4d.gui, links from the
  index, how-to-run, extending and the README
- docs/gui_screenshots.py regenerates the tutorial screenshots offscreen
- results viewer: compressed pulse drawn on an 8x oversampled time axis (coarse grids)
- simulation.resume: checkpoints written before a history key existed resume (key filled with None);
  wall_s keeps counting from the checkpoint
- gui.worker: per-thread stdout instead of redirect_stdout, so tasks running together keep their own log
  and the real stdout is restored
- gui.plots: oversampled compressed pulse only on small grids (43 s -> 2 s on a benchmark-size grid)
- builder: asks before an input from another panel replaces unsaved edits; that input counts as unsaved
- run panel: an error in a pass still saves the passes done; the input label reads the current session
- design panel: incomplete ranges, empty required fields and no gas are flagged before the search
- benchmarks: peak intensity read from history["peak_intensity"] (old checkpoints: I_peak), no subclass
- one _jsonable (inputfile) reused by the design helper and the benchmarks; input_duration_s and
  PEAK_POWER_FACTOR shared by make_grid and describe_input; unused backend.gpu_error removed
- cell.match(power) needs its wavelength (no silent 1030 nm default); nonlinear_mode(P, lam)
- builder: no question when switching designs without manual edits
- gui.worker: prints are dropped when there is no console (pythonw)
- tests: compressed pulse on large grids, match wavelength, no-console task
- README rewritten (acronym, install, example, validation table); shorter package description
- documentation restructured: index, quickstart, user guide (simulation, lens frame, design helper,
  accuracy), GUI, development; old pages removed, API and benchmark pages kept; every guide snippet runs
- roadmap: v1.3.0 done; version 1.3.0
@melvinrdn melvinrdn added this to the v1.3.0 milestone Nov 9, 2026
@victorkolt
victorkolt merged commit 7463283 into main Nov 9, 2026
5 checks passed
@melvinrdn
melvinrdn deleted the v.1.3.0-gui branch November 10, 2026 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants