tlo.progressbar module
Progress bar for visualising progress of simulation runs.
- class ProgressBar(n_step: int, description: str | None = None, n_col: int = 10, unit: str = 'step', min_refresh_time: float = 1.0)[source]
Bases:
object
Iterable object for tracking progress of an iterative task.
Implements both string and HTML representations to allow richer display in interfaces which support HTML output, for example Jupyter notebooks or interactive terminals.
- GLYPHS = ' ▏▎▍▌▋▊▉█'
Characters used to create string representation of progress bar.
- property n_step
Total number of steps in task.
- property description
“Description of task being tracked.
- property step
Progress step count.
- property prop_complete
Proportion complete (float value in [0, 1]).
- property perc_complete
Percentage complete formatted as string.
- property elapsed_time
Elapsed time formatted as string.
- property iter_rate
Mean iteration rate if ≥ 1 unit/s or reciprocal s/unit as string.
- property est_remaining_time
Estimated remaining time to completion formatted as string.
- property n_block_filled
Number of filled blocks in progress bar.
- property n_block_empty
Number of empty blocks in progress bar.
- property prop_partial_block
Proportion filled in partial block in progress bar.
- property filled_blocks
Filled blocks string.
- property empty_blocks
Empty blocks string.
- property partial_block
Partial block character.
- property progress_bar
Progress bar string.
- property bar_color
CSS color property for HTML progress bar.
- property stats
Comma-delimited string list of statistic key=value pairs.
- property prefix
Text to prefix progress bar with.
- property postfix
Text to postfix progress bar with.
- class StreamDisplay(io: TextIO | None = None)[source]
Bases:
object
Base class for using I/O streams as an updatable display.
- class AnsiStreamDisplay(io: TextIO | None = None)[source]
Bases:
StreamDisplay
Use I/O stream which supports ANSI escape sequences as an updatable display.
- class BasicStreamDisplay(io: TextIO | None = None)[source]
Bases:
StreamDisplay
Use I/O stream without ANSI escape sequence support as an updatable display.