Skip to content

start

Python reference for nagasim.state.start.

The model with a state document's state as its initial_state.

The section's own validation then runs with the model's, as for any model.

Parameters:

Name Type Description Default
layout dict or str

The model the state was taken from, or the path of its file.

required
doc dict

A state document, from take, from_plant or read.

required
max_age float

The oldest state accepted, in model time units.

None
now float

The clock that max_age is counted from.

None
until float

The end of the run the caller is about to make, as its run length: a twin's clock is the plant's and is soon past the length the model file was studied over.

None

Returns:

Type Description
tuple

(model, []) with the state as the model's initial_state, or (None, problems) when the state does not fit the model.

See Also

nagasim.state.take : Makes the 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)
>>> model, problems = state.start(str(path), doc)
>>> problems
[]
>>> "initial_state" in model
True