# checks

Python reference for `nagasim.laws.checks`.

`nagasim.laws.checks`

```python
checks(layout: dict, results: dict, warmup: float | None = None)
```

Every computable law and guardrail for one run (see the module docstring).

Parameters
----------
layout : dict
    The model as run; its ``simulation.warmup`` is the one the run used, unless
    *warmup* says which the batch used.
results : dict
    The frames of the run, from `nagasim.api.run_model`.
warmup : float, optional
    The warm-up the run really used, when it is not the model's.

Returns
-------
list of dict
    One ``{"name", "verdict", "why", "law"}`` per check; the verdict is ``"passed"``,
    ``"partial"`` or ``"failed"``. Empty when there is nothing to check (no
    entities, no resources).

See Also
--------
nagasim.laws.of_run : The same checks summarised for runs already made.

Examples
--------
>>> import json
>>> from pathlib import Path
>>> import nagasim
>>> from nagasim import api, laws
>>> path = Path(nagasim.__file__).parent / "models" / "single_server.json"
>>> layout = json.loads(path.read_text(encoding="utf-8"))
>>> results = api.run_model(layout, replications=1, run_length=200, warmup=20, seed=0)
>>> checks = laws.checks(layout, results)
>>> [c["law"] for c in checks]
['utilisation', 'little (resource)', 'censoring']
>>> sorted(checks[0])
['law', 'name', 'verdict', 'why']
