Skip to content

config

cosmic_warp.core.config

YAML configuration loader for SpacecraftSimulator.

The configuration format is documented in docs/guides/configuration.md. Unknown keys are rejected so typos fail loudly instead of silently falling back to defaults.

create_simulator_from_yaml

create_simulator_from_yaml(
    path: str, *, device: str = None
) -> SpacecraftSimulator

Load a simulator from a YAML file. device, if given, overrides simulation.device, so a scenario written for CUDA also runs on CPU.

Source code in cosmic_warp/core/config.py
def create_simulator_from_yaml(path: str, *, device: str = None) -> SpacecraftSimulator:
    """Load a simulator from a YAML file. device, if given, overrides
    simulation.device, so a scenario written for CUDA also runs on CPU."""
    config = _load_yaml(path)
    if device is not None:
        config["simulation"] = {**(config.get("simulation") or {}), "device": device}
    return create_simulator_from_config(config)