# take

Python reference for `nagasim.state.take`.

`nagasim.state.take`

```python
take(layout, at: float, seed: int = 0, name: str | None = None)
```

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

Parameters
----------
layout : dict or str
    The model, or the path of its file.
at : float
    The model time to stop at; it must be before the end of the run.
seed : int, default 0
    The seed of the run that is stopped.
name : str, optional
    A label stored in the document.

Returns
-------
dict
    The state document: ``format``, ``hash`` of the model, ``model``, ``state`` and ``taken``.

Raises
------
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']
