# opencr.data.importers

*module*

Importers for published data formats.

* `lxcat_reactions`: electron-impact processes from an LXCat file
  (read by `plasmacoll.read_lxcat`), as reactions between states of a
  network. LXCat's terms of use do not allow redistribution: the files stay
  with the user and OpenCR never bundles them.
* `read_rate_table`: a two-column text file of temperature (eV) and rate
  coefficient (SI), as a `Tabulated` rate model.
* `read_adf11`: an ADAS adf11 file of effective (collisional-radiative)
  coefficients, such as OPEN-ADAS ``scd12_h.dat`` and ``acd12_h.dat``, for
  comparisons. OPEN-ADAS data are for personal use and must not be
  redistributed: OpenCR reads the user's own downloads and never ships them.

Every importer checks the data (`opencr.data.checks`) and attaches a
provenance.

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

## opencr.data.importers.LXCAT_KINDS

*attribute* · *module attribute*

```python
LXCAT_KINDS = {'EXCITATION': 'excitation', 'IONIZATION': 'ionization', 'ATTACHMENT': 'attachment'}
```

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/data/importers.py#L37-L41)

## opencr.data.importers.Adf11

*class* · *dataclass*

```python
class Adf11
```

Effective coefficients of one charge state from an ADAS adf11 file.

**Attributes**

- `density` (`np.ndarray`) — The electron densities in m^-3.
- `temperature` (`np.ndarray`) — The electron temperatures in eV.
- `coefficient` (`np.ndarray`) — The coefficients in m^3/s, shape ``(temperature, density)``.
- `header` (`str`) — The first line of the file.

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/data/importers.py#L147-L170)

### opencr.data.importers.Adf11.coefficient

*attribute* · *instance attribute*

```python
coefficient: np.ndarray
```

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/data/importers.py#L160-L160)

### opencr.data.importers.Adf11.density

*attribute* · *instance attribute*

```python
density: np.ndarray
```

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/data/importers.py#L158-L158)

### opencr.data.importers.Adf11.header

*attribute* · *instance attribute*

```python
header: str
```

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/data/importers.py#L161-L161)

### opencr.data.importers.Adf11.temperature

*attribute* · *instance attribute*

```python
temperature: np.ndarray
```

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/data/importers.py#L159-L159)

## opencr.data.importers.lxcat_reactions

*function*

```python
def lxcat_reactions(path: str | Path, target: State, products: Callable[[str, str], tuple[State, ...] | None] | Mapping[str, tuple[State, ...]], database: str, retrieved: str | None = None) -> list[Reaction]
```

Return the excitation, ionization and attachment processes of an LXCat file.

Elastic and effective blocks change no population and are skipped.

**Parameters**

- `path` (`str | Path`) — The LXCat file.
- `target` (`State`) — The target state of every process (e.g. ``Ar`` ground state).
- `products` (`Callable[[str, str], tuple[State, ...] | None] | Mapping[str, tuple[State, ...]]`) — The product states of a block, by the block's product text (``"Ar*(11.55eV)"``) or as a function of ``(kind, product)``; the electron is added. A block whose products are ``None`` or absent is skipped.
- `database` (`str`) — The database and its reference as the user's download cites it, e.g. ``"Biagi-v7.1, www.lxcat.net, retrieved 2026-10-27"``.
- `retrieved` (`str | None`) (default: `None`) — The download date (ISO 8601); today if not given.

**Returns**

- (`list[Reaction]`) — The reactions, named ``"<kind>:<target>-><products>"``.

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/data/importers.py#L44-L105)

## opencr.data.importers.read_adf11

*function*

```python
def read_adf11(path: str | Path, block: int = 0) -> Adf11
```

Read one block (charge state) of an unresolved ADAS adf11 file.

The file gives ``log10`` densities in cm^-3, ``log10`` temperatures in eV and
``log10`` coefficients in cm^3/s; they are returned in SI.

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/data/importers.py#L173-L201)

## opencr.data.importers.read_rate_table

*function*

```python
def read_rate_table(path: str | Path, reference: Reference, depends_on: str = 'electron', threshold: float = 0.0, unit_factor: float = 1.0, licence: str = 'unknown') -> tuple[Tabulated, Provenance]
```

Read a two-column table of temperature (eV) and rate coefficient.

Lines starting with ``#`` are comments. ``unit_factor`` converts the
rates to SI (e.g. 1e-6 for cm^3/s) and is recorded in the provenance.

**Returns**

- (`tuple[Tabulated, Provenance]`) — The rate model and its provenance.

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/data/importers.py#L108-L144)
