Skip to content

take

Python reference for nagasim.state.take.

The state document of layout at model time at of the run with seed.

Parameters:

Name Type Description Default
layout dict or str

The model, or the path of its file.

required
at float

The model time to stop at; it must be before the end of the run.

required
seed int

The seed of the run that is stopped.

0
name str

A label stored in the document.

None

Returns:

Type Description
dict

The state document: format, hash of the model, model, state and taken.

Raises:

Type Description
StateError

(E_STATE_UNSUPPORTED) for what a state cannot carry, an instant with an event due and a time at or after the end of the run.

See Also

nagasim.state.start : Builds a model that begins from a state document.

Examples:

>>> from pathlib import Path
>>> import nagasim
>>> from nagasim import state
>>> path = Path(nagasim.__file__).parent / "models" / "single_server.json"
>>> doc = state.take(str(path), at=50.0, seed=0)
>>> doc["format"] == state.FORMAT
True
>>> sorted(doc)
['format', 'hash', 'model', 'state', 'taken']