qat.experimental.frontend.importer.pulse.post_processing module

class PostProcessingFactory(post_processing, post_selection_enabled=True)

Bases: object

Creates the results post-processing IR described by a derived PostProcessingView.

  • Discrimination, applied per acquisition inside the results map, turning an IQ value into an integer state label by picking that channel’s nearest calibrated centroid.

  • Post-selection, applied once to the whole discriminated collection, discarding shots whose emitted state labels are disallowed for their channel.

Parameters:
  • post_processing (PostProcessingView) – Derived post-processing view.

  • post_selection_enabled (bool) – Whether post-selection is enabled. When False, post_select() returns the passed collection unchanged.

Initialise the post-processing factory.

Parameters:
  • post_processing (PostProcessingView) – Derived post-processing view.

  • post_selection_enabled (bool) – Whether post-selection is enabled. Defaults to True.

policy_for(channel_id)

Resolve the discrimination policy calibrated for a logical channel.

Parameters:

channel_id (str | None) – The logical channel identifier (mode.channel_id) the acquisition was made on, or None if it could not be resolved.

Return type:

DiscriminatorPolicyAttr | None

Returns:

A MaximumLikelihoodPolicyAttr built from the channel’s calibration, or None when the channel has no max-likelihood calibration.

post_select(collection, label_to_channel)

Apply post-selection to a discriminated results collection.

Parameters:
  • collection (SSAValue[ResultsCollectionType]) – The discriminated ResultsCollectionType SSA value to filter, typically map_op.result.

  • label_to_channel (dict[str, str]) – Mapping from acquire output-variable name to the logical channel identifier (mode.channel_id) for that acquisition. Built by the importer from the purr IR before the kernel is emitted.

Return type:

Union[SSAValue[ResultsCollectionType], PostSelectOp]

Returns:

The unmodified collection if post-selection is disabled or there are no disallowed states. Otherwise a PostSelectOp wrapping the filtered collection.