rizer.misc.simulation.post_process_registry#

Registry of post-process quantity computations run once per simulation.

Mirrors the PLOT_KINDS/PLOT_KINDS_BY_ID registry pattern in rizer.misc.simulation.plot_registry. Every entry is a pure function of the raw simulation state array – never of another entry’s output – so entries can be added, removed, or reordered freely; run_post_processors raises loudly on any output-key collision between entries instead of letting one silently overwrite another.

Attributes#

Classes#

PostProcessQuantity

One post-process computation and the metadata its outputs need.

Functions#

run_post_processors(→ tuple[dict[str, numpy.ndarray], ...)

Run every POST_PROCESSORS entry over states and merge the results.

Module Contents#

class rizer.misc.simulation.post_process_registry.PostProcessQuantity#

One post-process computation and the metadata its outputs need.

Parameters:
  • key (str) – Short identifier for this processor, used in collision error messages.

  • compute (typing.Callable) – Pure function of the raw simulation state array – never of another processor’s output – returning one or more named output columns, as compute(states) -> dict[str, numpy.ndarray].

  • units (dict of str to str, or typing.Callable) – Unit for every key compute returns. A dict for a processor whose output keys are known ahead of time, or a function of states (as units(states) -> dict[str, str]) for one whose output keys depend on the mechanism’s species list.

  • descriptions (dict of str to str, or typing.Callable) – Human-readable description for every key compute returns, in the same dict-or-callable shape as units.

key: str#
compute: collections.abc.Callable[[cantera.SolutionArray], dict[str, numpy.ndarray]]#
units: _StaticOrPerStates#
descriptions: _StaticOrPerStates#
rizer.misc.simulation.post_process_registry.POST_PROCESSORS: tuple[PostProcessQuantity, Ellipsis]#
rizer.misc.simulation.post_process_registry.run_post_processors(states: cantera.SolutionArray) tuple[dict[str, numpy.ndarray], dict[str, str], dict[str, str]]#

Run every POST_PROCESSORS entry over states and merge the results.

Parameters:

states (cantera.SolutionArray) – Raw simulation state array.

Returns:

  • arrays (dict of str to numpy.ndarray) – Every processor’s computed columns, merged.

  • units (dict of str to str) – Unit for every key in arrays.

  • descriptions (dict of str to str) – Description for every key in arrays.

Raises:

ValueError – If two processors declare an overlapping output key.