thunder4d.gui

Graphical interface (optional: uv add "thunder4d[gui]"), see Graphical interface. Importing thunder4d.gui and thunder4d.gui.registry does not import Qt.

thunder4d.gui.main(argv=None)[source]

Entry point of the thunder4d-gui command (thunder4d-gui [input.json]). Returns 1, with the install command, when PySide6 is missing.

Registries

thunder4d.gui.registry.PANELS
thunder4d.gui.registry.PLOTS
thunder4d.gui.registry.METRICS

Ordered collections of specs, indexed by key: register(spec, replace=False), unregister(key), iteration by order then registration order.

class thunder4d.gui.registry.PanelSpec(key, title, factory, order=100.0, tooltip='')[source]

A tab of the main window; factory(session) returns its widget. The session holds the current input (config, signal config_changed) and results (results, results_changed); session.show_panel(key) brings another tab to the front. A panel with a can_close() method is asked before the window closes.

class thunder4d.gui.registry.PlotSpec(key, title, draw, requires=(), order=100.0, group='', per_pass=False, data=None)[source]

A figure of the results viewer. draw(results, fig, options) fills a matplotlib Figure; options["index"] is the selected record when per_pass. Offered only when every key of requires is in the results. data(results, options) returns the arrays written by Export data (default: the requires arrays).

class thunder4d.gui.registry.MetricSpec(key, label, unit='', scale=1.0, order=100.0, fmt='{:.4g}', warn_above=None, plot=True)[source]

A quantity followed live: the last value of sim.history[key] times scale, flagged above warn_above, drawn versus pass when plot.

thunder4d.gui.registry.available_plots(results, plots=PLOTS)[source]

The registered figures that the results can draw.

Results and background tasks

class thunder4d.gui.results.Results(data, path=None)

The arrays of a saved run, by key (a dict), with path, grid() (the simulation grid, rebuilt on the CPU) and cache (derived quantities). load_results(path) reads a .npz.

class thunder4d.gui.worker.Task(work)

work(task) run on a background thread (a QThread). Signals: output (each printed line), progress (task.report(value)), succeeded(result), failed(traceback), cancelled. task.cancel() makes the next task.check() raise Cancelled.