Added an interactive explorer, now as TUI and a jupyter mode - #117
Merged
Merged
Conversation
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.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.