spectre.file_io.specfile_to_toml

Convert SPEC namelist files (.sp) into TOML input files.

This module exposes specfile_to_toml(), a convenience wrapper that reads an existing SPEC namelist, validates the content against the high-level InputParameters model, and writes an adjacent TOML representation that fits the Python tooling in this repository.

Module Contents

spectre.file_io.specfile_to_toml.specfile_to_toml(source: _PathLike, destination: _PathLike | None = None) tuple[pathlib.Path, spectre.file_io.input_parameters.InputParameters] | list[tuple[pathlib.Path, spectre.file_io.input_parameters.InputParameters]]

Translate a SPEC .sp namelist into a TOML input file.

Parameters

source:

Path to either a single .sp file or a directory containing such files.

destination:

Optional target file or directory. When omitted, the TOML file will be placed next to the source namelist. When source is a directory, destination should also refer to a directory.

Raises

FileNotFoundError

If source does not exist.

ValueError

When source is a directory but destination resolves to a file.