# start

Python reference for `nagasim.state.start`.

`nagasim.state.start`

```python
start(layout, doc, max_age: float | None = None, now: float | None = None, until: float | None = None)
```

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
----------
layout : dict or str
    The model the state was taken from, or the path of its file.
doc : dict
    A state document, from `take`, `from_plant` or `read`.
max_age : float, optional
    The oldest state accepted, in model time units.
now : float, optional
    The clock that ``max_age`` is counted from.
until : float, optional
    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.

Returns
-------
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
