Skip to content

Added an interactive explorer, now as TUI and a jupyter mode - #117

Merged
lu-kas merged 4 commits into
masterfrom
feat/explorer
Sep 21, 2026
Merged

lu-kas merged 4 commits into
masterfrom
feat/explorer

Conversation

@lu-kas

@lu-kas lu-kas commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Adds fdsreader.explorer, a subpackage with one core and two front ends:

  explore()                  widgets for Jupyter
  fdsreader-explorer-cli     a terminal application

Both show a time bar, a 2D slice and any number of device or HRR curves.
A desktop front end would sit beside them as explorer/gui.py.

The core is importable with nothing but numpy, so the command line front
end works on a machine with no plotting stack and no browser; matplotlib
and ipywidgets are a new "notebook" extra, resolved lazily through a
module-level __getattr__ so that importing fdsreader.explorer.cli never
pulls them in.

Slices are read one time step at a time. A slice file is a sequence of
fixed-size records, so the wanted frame is seeked to directly: drawing a
frame of a 749-step slice costs 0.3 MB and 0.1 ms, against 161 MB and
39 ms for materialising the whole series. The global colour scale is read
from the .bnd files FDS writes beside the slice files, so it needs no
field data at all.

ExplorerState holds the selection and the rules acting on it, so a front
end cannot invent its own meaning for "per step" or for the colour limits.

fields.py assembles the stitched grid from the sub-slices rather than
calling Slice.get_coordinates(), which raises for cell-centered slices
(it takes the sub-slice dict keys, which are mesh ids, for meshes).

Frames are verified to agree with Slice.to_global() cell for cell, and
the terminal drawing is pinned by golden-text tests. 40 new tests, none
of which need matplotlib or ipywidgets.
Adds an Explorer section covering both front ends -- the Jupyter one and
the command line one -- and mentions the optional "notebook" extra in the
installation instructions.
It draws one view and exits. The README and the docs page described both
front ends as interactive, which is only true of the Jupyter one.
fdsreader-explorer-cli -i opens a full-screen view where the slice and
the curves are chosen from lists inside the application, instead of being
named on the command line.

Built on curses from the standard library, so it adds no dependency. The
module is absent on Windows, where the error names windows-curses.

Key handling and layout are plain functions -- Interactive.handle_key and
layout() -- so the behaviour is tested without a terminal. The drawing,
the modal list pickers and the colour pairs are the only part that needs
curses.

The colour scale now defaults to the whole run interactively, where frames
should stay comparable while stepping, and to the step on screen for a
single picture, which is what a lone frame wants. --scale still overrides
both.

23 new tests.
@lu-kas
lu-kas merged commit 316ea9d into master Sep 21, 2026
7 checks passed
@lu-kas
lu-kas deleted the feat/explorer branch September 21, 2026 09:47
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