stormvogel.show

Shorter api for showing a model.

Functions

show(...)

Create and show a visualization of a Model using a visjs Network.

show_bird(→ stormvogel.visualization.JSVisualization)

Show a simple model with a bird state.

Module Contents

stormvogel.show.show(model: stormvogel.model.Model, result: stormvogel.result.Result | None = None, engine: str = 'js', pos_function: Callable[[stormvogel.graph.ModelGraph], dict[int, Any]] | None = None, pos_function_scaling: int = 750, scheduler: stormvogel.result.Scheduler | None = None, layout: stormvogel.layout.Layout | None = None, show_editor: bool = False, debug_output: ipywidgets.Output | None = None, use_iframe: bool = False, do_init_server: bool = True, max_states: int = 1000, max_physics_states: int = 500) stormvogel.visualization.JSVisualization | stormvogel.visualization.MplVisualization | None

Create and show a visualization of a Model using a visjs Network.

Parameters:
  • model – The stormvogel model to be displayed.

  • result – A result associated with the model. The results are displayed as numbers on a state. Enable the layout editor for options. If this result has a scheduler, then the scheduled actions will have a different color etc. based on the layout.

  • engine – The engine that should be used for the visualization. Can be either "js" for the interactive HTML/JavaScript visualization, or "mpl" for matplotlib.

  • pos_function – Function that takes a ModelGraph and maps it to a dictionary of node positions. It is often useful to import these from networkx, see https://networkx.org/documentation/stable/_modules/networkx/drawing/layout.html for some examples. In particular, nx.bfs_layout seems to work great for models with a directed acyclic graph structure.

  • pos_function_scaling – Scaling factor for the positions when using networkx positions.

  • scheduler – The scheduled actions will have a different color etc. based on the layout. If both result and scheduler are set, then scheduler takes precedence.

  • layout – Layout used for the visualization.

  • show_editor – For interactive visualization. Show an interactive layout editor.

  • debug_output – For interactive visualization. Output widget that can be used to debug interactive features.

  • use_iframe – For interactive visualization. Wrap the generated HTML inside of an IFrame. In some environments, the visualization works better with this enabled.

  • do_init_server – For interactive visualization. Initialize a local server that is used for communication between JavaScript and Python. If this is set to False, then exporting network node positions and SVG/PDF/LaTeX is impossible.

  • max_states – If the model has more states, then the network is not displayed.

  • max_physics_states – If the model has more states, then physics are disabled.

Returns:

A JSVisualization or MplVisualization object, or None on error.

Raises:

ValueError – If the engine is not recognized.

stormvogel.show.show_bird() stormvogel.visualization.JSVisualization

Show a simple model with a bird state.