Skip to main content

internals.errors

internals.errors

Errors, warnings, and notes.

Most errors are Python’s own (ValueError, TypeError, a KeyError for a name that is not found); the few kept as classes here are those that code may want to catch by kind, e.g. ss.CapabilityError. A note is a line about something that was assumed or approximated: it is kept in sim.notes and printed when verbose is 1 or more (see ss.note()).

Used with: agents and compartments; declared and coded modules

Classes

Name Description
AlreadyRunError A sim that has already run (or been finalized) is stepped, finalized, or added to again; sim.run() runs it again from the start
CapabilityError The requested solver cannot run part of the model. Three cases: there is no sensible approximation (contact tracing,

AlreadyRunError

internals.errors.AlreadyRunError(*args)

A sim that has already run (or been finalized) is stepped, finalized, or added to again; sim.run() runs it again from the start

CapabilityError

internals.errors.CapabilityError()

The requested solver cannot run part of the model. Three cases: there is no sensible approximation (contact tracing, transmission trees, agent-only custom code); a function or condition asked for something that exists only per agent in a compartmental run; or an approximation would be needed and approximations="error". Names the part, what it asked for, and what would fix it

Functions

Name Description
note Say something that was assumed or approximated, in one line

note

internals.errors.note(msg, sim=None, verbose=None)

Say something that was assumed or approximated, in one line

The note is kept in sim.notes (if a sim is supplied), whatever the verbosity, and is printed if verbose (by default the sim’s) is 1 or more.

Parameters

Name Type Description Default
msg str what was assumed or approximated required
sim Sim the sim to keep the note in None
verbose int whether to print it None

Example

ss.note("unit='day' (from start and stop dates)", sim=sim)