qat.experimental.analysis.post_processing module

Extract runtime-ready post-processing metadata from experimental results IR.

This module analyses results-dialect operations (for example results.map and results.post_select) and produces a compact representation used by runtime execution. The extracted model includes per-measurement acquire metadata, record-level post-selection rules, record assignments, and the set of returned measurement aliases.

class PostProcessingAnalysis(acquire_data=<factory>, post_selects=<factory>, assigns=<factory>, returns=<factory>)

Bases: object

Container for post-processing metadata extracted from results IR.

The fields in this model are runtime-oriented:

  • acquire_data captures per-measurement acquire mode, shape, and granular post-processing chain.

  • post_selects captures record-level filtering predicates.

  • assigns captures record alias materialisation (including grouped and array-style aliases).

  • returns captures the final set of record aliases to emit.

Note

post_selects are intentionally kept separate from acquire_data[alias].post_processing. Even when a predicate references a single alias, post-selection is applied to the full record, not to an individual measurement processing chain.

Variables:
  • acquire_data – Runtime acquire metadata by measurement alias.

  • post_selects – Record-level post-selection rules.

  • assigns – Runtime Assign instructions derived from record construction and grouping operations.

  • returns – Final set of measurement aliases to include in output records.

acquire_data: dict[str, AcquireData]
assigns: list[Assign]
post_selects: list[PostSelect]
returns: set[str]
extract_post_processing_instructions(top_level, acquire_shape)

Extract post-processing metadata from a top-level IR operation.

The traversal supports either a module-like container or a function-like container as long as it contains at most one results.map operation and any number of results.post_select operations. This is designed for the current “legacy” implementation of runtime, which uses post-processing instructions in a prescribed way that is not very extensible. This analysis will ensure those restrictions are met, and will raise an exception if they are not.

This analysis pass will not have a place in the future with a more sophisticated runtime, and will be replaced with something more flexible and extensible.

The returned PostProcessingAnalysis is ready to be embedded in an executable for runtime consumption.

Parameters:
  • top_level (Operation) – The operation to extract the post-processing instructions from.

  • acquire_shape (int | tuple[int, ...]) – Acquisition shape to attach to each extracted AcquireData. An int is normalised to a single-element tuple.

Return type:

PostProcessingAnalysis

Returns:

The post-processing instructions extracted from the operation.

Raises:

PassFailedException – If unsupported operations, predicates, or incompatible result-flow patterns are encountered.