# opencr.analysis.scan

*module*

Parameter scans over the conditions.

`scan` solves a model on the outer product of values of condition
fields (``electron_temperature``, ``electron_density``, a driver density as
``density:<state>`` or a total as ``total:<element>``) and returns an xarray
dataset with the populations and, for quasi-static solves, the effective rate
coefficients between the drivers and the photon emissivity coefficients.
Each point is an independent reference solve; the batched backends
(`opencr.backends`) do the same for Maxwellian scans in one pass.

The values of an axis take astropy quantities or strings (``"1e12 cm-3"``,
``"300 K"``) as well as numbers in the unit of the field (eV, m^-3).

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/analysis/scan.py#L1-L1)

## opencr.analysis.scan.scan

*function*

```python
def scan(model: Model, conditions: Conditions, mode: str = 'quasi-static', effective: bool = True, lines: bool = True, **axes: Sequence[float]) -> xr.Dataset
```

Solve ``model`` on a grid of conditions.

**Parameters**

- `model` (`Model`) — The model.
- `conditions` (`Conditions`) — The conditions every point starts from.
- `mode` (`str`) (default: `'quasi-static'`) — The steady-state mode.
- `effective` (`bool`) (default: `True`) — Add ``effective_rate`` (target driver, source driver) and, with ``lines``, ``pec`` (line, driver) for quasi-static solves.
- `lines` (`bool`) (default: `True`) — Add the line emissivities.
- `**axes` (`Sequence[float]`) (default: `{}`) — The condition fields to scan and their values, e.g. ``electron_temperature=np.geomspace(0.5, 50, 20)``. Use ``{"density:H(n=1)": [...]}`` or ``{"total:H": [...]}`` unpacked with ``**``. The values are in eV or m^-3, or quantities.

**Returns**

- (`xr.Dataset`) — A dataset over the axes (and ``state``, ``line``, ``driver``).

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/analysis/scan.py#L72-L164)
