Skip to main content

internals.display

internals.display

Not for the user: how a model is shown: describe(), diagram(), and equations(); and how a sim is (sim.describe(), sim.what_modifies(), sim.check_dt())

Users reach these through ss.Disease and ss.Sim. They are kept apart from the graph, which holds the model, so showing it does not change it. A declared model is shown in full; a module written as code is shown by what the sim knows of it.

Used with: agents and compartments; declared and coded modules

Classes

Name Description
Description The description of a model (see sim.describe()): sections, each with a title and rows of a key, its text, and what was guessed
Diagram A diagram as the text of a Mermaid flowchart (https://mermaid.js.org), which a notebook draws

Description

internals.display.Description()

The description of a model (see sim.describe()): sections, each with a title and rows of a key, its text, and what was guessed

Shown in color in a terminal, as tables in a notebook, and as plain text otherwise (str(desc)), with each guess in brackets at the end of its line.

Methods

Name Description
add Add a row to the last section: a key (or ’’ to go on from the row before), its text, and what was guessed
as_text As ss.display.Text: plain text that shows itself in color in a terminal and as tables in a notebook
extend Add the sections of another description
html As HTML: a table for each section
section Start a section, e.g. section("Disease 'sir'", '3 states, 2 transitions')
text As lines of text; in color, a guess too long for the line goes on the next
add
internals.display.Description.add(key, text, guess=None)

Add a row to the last section: a key (or ’’ to go on from the row before), its text, and what was guessed

as_text
internals.display.Description.as_text()

As ss.display.Text: plain text that shows itself in color in a terminal and as tables in a notebook

extend
internals.display.Description.extend(other)

Add the sections of another description

html
internals.display.Description.html()

As HTML: a table for each section

section
internals.display.Description.section(title, summary=None)

Start a section, e.g. section("Disease 'sir'", '3 states, 2 transitions')

text
internals.display.Description.text(color=False, width=None)

As lines of text; in color, a guess too long for the line goes on the next

Diagram

internals.display.Diagram()

A diagram as the text of a Mermaid flowchart (https://mermaid.js.org), which a notebook draws

It is a string, so print() gives the text, and it can be pasted into anything that draws Mermaid (GitHub, Quarto, most Markdown viewers). In JupyterLab (4.1 or later) and in a page built by Quarto, it is drawn as a Markdown block.