pySimBlocks.project.load_simulation_config¶
- pySimBlocks.project.load_simulation_config.extract_external_refs(expr: str) set[str][source]¶
Extract all external reference names (
#varsyntax) from an expression string.Hex color literals (e.g.
#d62728in plotseries_styles) are ignored.- Parameters:
expr – A YAML value string potentially containing
#namereferences.- Returns:
Set of referenced variable names with the
#prefix stripped.
- pySimBlocks.project.load_simulation_config.eval_value(value: Any, scope: dict) Any[source]¶
Evaluate a single YAML value as a Python expression.
The value is converted to string,
#prefixes are stripped, bare list literals are wrapped innp.array(), and the result is evaluated usingevalwith a restricted namespace containing onlynpandscope. If evaluation fails the original value is returned unchanged.- Parameters:
value – Raw YAML value (string, number, list, etc.).
scope – Variable scope for expression evaluation (from the external parameters module).
- Returns:
Evaluated Python object, or
valueunchanged if evaluation fails.
- pySimBlocks.project.load_simulation_config.eval_recursive(obj: Any, scope: dict) Any[source]¶
Recursively evaluate all values in a nested dict/list using
eval_value().- Parameters:
obj – A nested dict, list, or scalar YAML value.
scope – Variable scope for expression evaluation.
- Returns:
The same structure with all leaf values passed through
eval_value().
- pySimBlocks.project.load_simulation_config.load_simulation_config(project_yaml: str | Path) Tuple[SimulationConfig, Dict[str, Any], Path][source]¶
Load simulation and diagram configuration from a unified project.yaml.
- Parameters:
project_yaml – Path to the unified
project.yamlfile.- Returns:
A tuple
(SimulationConfig, model_dict, params_dir)whereparams_diris the directory of the project file.- Raises:
FileNotFoundError – If the project file does not exist.
ValueError – If the file is malformed or required fields are missing.