CodeEntropy.levels.frame_dag module

Frame-local DAG execution.

This module defines the frame-scoped DAG used during the MAP stage of the hierarchy workflow. Each frame is processed independently to produce frame-local outputs (e.g., axes and covariance data), which are later reduced outside this DAG.

class CodeEntropy.levels.frame_dag.FrameContext(shared: dict[str, Any], frame_index: int, frame_covariance: Any = None, data: dict[str, Any] | None = None)[source]

Bases: object

Container for per-frame execution context.

Variables:
  • shared (dict[str, Any]) – Shared workflow data (mutated across the full workflow).

  • frame_index (int) – Absolute trajectory frame index being processed.

  • frame_covariance (Any) – Frame-local covariance output produced by FrameCovarianceNode.

  • data (dict[str, Any] | None) – Additional frame-local scratch space for nodes, if needed.

data: dict[str, Any] | None = None
frame_covariance: Any = None
frame_index: int
shared: dict[str, Any]
class CodeEntropy.levels.frame_dag.FrameGraph(universe_operations: Any | None = None)[source]

Bases: object

Execute a frame-local directed acyclic graph.

The graph is run once per trajectory frame. Nodes may read shared inputs from ctx[“shared”] and must write only frame-local outputs into the frame context.

Expected node outputs:
  • “frame_covariance”

build() FrameGraph[source]

Build the default frame DAG topology.

Returns:

Self, to allow fluent chaining.

execute_frame(shared_data: dict[str, Any], frame_index: int) Any[source]

Execute the frame DAG for one selected analysis frame.

FrameGraph owns trajectory positioning for frame-local execution. Higher-level orchestration passes explicit frame indices but must not rely on hidden MDAnalysis cursor state.

Parameters:
  • shared_data – Shared workflow data dictionary. Must contain "frame_source".

  • frame_index – Frame index valid for the active analysis universe. During this migration stage this is local to the frame-reduced universe.

Returns:

Frame-local covariance payload produced by FrameCovarianceNode.

Raises:
  • KeyError – If "frame_source" is missing from shared_data.

  • IndexError – If frame_index is outside trajectory bounds.