bloc.io.scenario#

Scenario expansion, variable maps, and KPI/figure registries.

Attributes#

Functions#

sweep_symbol_map()

Axis-name/path-leaf → symbol map used to label sweep points in scenario ids.

expand_scenarios(base_raw)

Expand a STONE YAML's inline scenarios: / sweep: blocks.

resolve_dotted(path)

Import module:attr and return attr.

import_simulation(module_name)

Import a Bloc Simulation.

Module Contents#

bloc.io.scenario.INPUT_VARIABLE_MAP: dict[str, tuple[str, str, str]]#
bloc.io.scenario.OUTPUT_VARIABLE_MAP: dict[str, tuple[str, str, str]]#
bloc.io.scenario.INPUT_CATEGORIES: dict[str, list[str]]#
bloc.io.scenario.NESTED_INPUT_MAP: dict[str, dict[str, tuple[str, str, str]]]#
bloc.io.scenario.OUTPUT_CATEGORIES: dict[str, list[str]]#
bloc.io.scenario.ENERGY_THERMAL_INLET_KEYS: list[str] = ['G_PW_IN (kW)', 'HHV_torch_input (kW)', 'HHV_2nd_inj_input (kW)']#
bloc.io.scenario.ENERGY_THERMAL_OUTLET_KEYS: list[str] = ['Heat_residual (kW)', 'HHV_pre_quench (kW)', 'Heat_losses_reactor (kW)', 'Torch_generator_losses (kW)']#
bloc.io.scenario.ELEMENT_BALANCE_DEFAULT_H: float = 0.95#
bloc.io.scenario.ELEMENT_BALANCE_DEFAULT_C: float = 0.95#
bloc.io.scenario.TF_INPUT_VARIABLE_MAP: dict[str, tuple[str, str, str]]#
bloc.io.scenario.TF_OUTPUT_VARIABLE_MAP: dict[str, tuple[str, str, str]]#
bloc.io.scenario.TF_INPUT_CATEGORIES: dict[str, list[str]]#
bloc.io.scenario.TF_OUTPUT_CATEGORIES: dict[str, list[str]]#
bloc.io.scenario.TF_DEFAULT_CONSTRAINTS: list[dict]#
bloc.io.scenario.SIM_KPI_EXTRACTORS: dict[str, Any]#
bloc.io.scenario.SIM_FIGURE_GENERATORS: dict[str, Any]#
bloc.io.scenario.STONE_FIGURE_GENERATORS: dict[str, Any]#
bloc.io.scenario.sweep_symbol_map()#

Axis-name/path-leaf → symbol map used to label sweep points in scenario ids.

Bloc’s contribution to boulder.runset.expand_scenarios() naming (e.g. diameterTF_D gives BASE__TF_D=0.03) — also registered as plugins.sweep_symbols so the Boulder GUI and out-of-process runners produce the same ids.

bloc.io.scenario.expand_scenarios(base_raw)#

Expand a STONE YAML’s inline scenarios: / sweep: blocks.

Thin wrapper over boulder.runset.expand_scenarios() — the reference implementation of the union run-set semantics, upstreamed from Bloc — that plugs in Bloc’s sweep-id symbols and its schema accessor (bloc.core.runner.BlocRunner.schema_entry(), which registers Bloc’s reactor schemas on first use so short-form sweep paths resolve without any prior Boulder plugin discovery). See the Boulder function for the full semantics; behavior is unchanged.

bloc.io.scenario.resolve_dotted(path)#

Import module:attr and return attr.

Used by the STONE calculation-note entry point to resolve export.kpi_fn: <dotted> into a callable without requiring a Python caller to import and pass it in.

Parameters:

path (str) – Dotted path of the form "package.module:attribute".

Returns:

The resolved attribute.

Return type:

Any

Raises:
  • ValueError – If path does not contain a : separator.

  • ImportError – If the module cannot be imported.

  • AttributeError – If the module does not define the requested attribute.

bloc.io.scenario.import_simulation(module_name)#

Import a Bloc Simulation.

Accepts either a Python module name (e.g. “pkg.mod”) or a filesystem path to a Python file (e.g. “../simulation_non_isothermal_reactors.py”).

Returns the imported module object.