# forecast_from_state

Python reference for `nagasim.twin.forecast_from_state`.

`nagasim.twin.forecast_from_state`

```python
forecast_from_state(model, horizon, replications, seed, workers, should_stop, base_dir = None)
```

The default runner: *horizon* from the clock the model's state starts at.

The parameters are the model's own: nothing is bound from live data inside a forecast.

Parameters
----------
model : dict
    The model with a state as its ``initial_state`` (see `nagasim.state.start`).
horizon : float
    How far to look ahead of the state's clock, in model time units.
replications : int
    Replications of the forecast.
seed : int
    The seed of the first replication.
workers : int or str
    Worker processes, as `nagasim.forecast.forecast` takes them.
should_stop : callable or None
    Asked between replications; true ends the forecast early.
base_dir : str or Path, optional
    The folder relative paths in the model resolve against.

Returns
-------
ForecastResult
    The forecast, as `nagasim.forecast.forecast` returns it.

See Also
--------
nagasim.forecast.forecast : What it calls.
nagasim.twin.read_result : Reads the result a twin writes.

Examples
--------
>>> from pathlib import Path
>>> import nagasim
>>> from nagasim import state, twin
>>> path = Path(nagasim.__file__).parent / "models" / "single_server.json"
>>> model, _ = state.start(str(path), state.take(str(path), at=50.0))
>>> fc = twin.forecast_from_state(model, horizon=100, replications=2, seed=0,
...                               workers=1, should_stop=None)
>>> type(fc).__name__
'ForecastResult'
