qat.experimental.frontend.importer.pulse.post_processing module
- class PostProcessingFactory(post_processing, post_selection_enabled=True)
Bases:
objectCreates 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. WhenFalse,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 toTrue.
- 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, orNoneif it could not be resolved.- Return type:
DiscriminatorPolicyAttr|None- Returns:
A
MaximumLikelihoodPolicyAttrbuilt from the channel’s calibration, orNonewhen 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 discriminatedResultsCollectionTypeSSA value to filter, typicallymap_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
collectionif post-selection is disabled or there are no disallowed states. Otherwise aPostSelectOpwrapping the filtered collection.