qat.experimental.system_data.pulse.post_processing module

class DiscriminateData(noise_est, p_min, state_centroids)

Bases: object

The max-likelihood payload a channel is calibrated with.

Variables:
  • noise_est – Global Gaussian noise variance used in likelihood evaluation.

  • p_min – Minimum normalised likelihood required for acceptance. When non-zero, a shot whose winning likelihood falls below it is emitted as UNMAPPED_STATE_LABEL.

  • state_centroids – The calibrated IQ-plane centroids, in calibration order. A discriminator labels a shot by the position of the centroid it is nearest.

noise_est: float
p_min: float
state_centroids: tuple[complex, ...]
class PostProcessingView(*, channel_to_disallowed_states, known_channel_ids, channel_to_discriminate_data)

Bases: object

Post-processing configuration derived from a CanonicalSystemData.

A discriminator only assigns an IQ value to its nearest calibrated centroid, labelling centroids by their position in calibration order; it carries no notion of which outcomes are wanted. The calibrated integer keys, which encode exactly that, are resolved here into the emitted labels post-selection must discard.

Variables:
  • channel_to_disallowed_states – Mapping from logical channel identifier (mode.channel_id in the canonical schema) to the set of emitted state labels that should be post-processed out. These are positions in the channel_to_discriminate_data centroid ordering, not the calibrated keys they were derived from, plus UNMAPPED_STATE_LABEL when p_min is non-zero. Channels with nothing to discard are omitted.

  • channel_to_discriminate_data – Mapping from logical channel identifier (mode.channel_id in the canonical schema) to the single DiscriminateData calibrated for that channel. Present for every channel carrying a max-likelihood calibration, independently of whether that channel has anything to post-select out.

  • known_channel_ids – All channel IDs present in the canonical system data.

channel_to_disallowed_states: dict[str, set[int]]
channel_to_discriminate_data: dict[str, DiscriminateData]
classmethod derive(parent)

Builds the post-processing configuration from a canonical hardware model.

Walks all qubits and their modes, keyed directly by mode.channel_id. Several modes may share a channel, and a channel resolves to exactly one max-likelihood method: modes sharing a channel must carry structurally identical calibration, otherwise there is no basis for choosing between them and this raises. Disallowed labels are aligned with the centroid ordering they index into.

Channels with no max-likelihood calibration are absent from both mappings, as there is nothing to discriminate against. Every channel that does carry a calibration gets a discriminate payload, whether or not it has anything to post-select out; only channel_to_disallowed_states additionally omits channels whose disallowed-label set is empty.

Parameters:

parent (CanonicalSystemData) – The canonical hardware model to derive post-processing from.

Return type:

PostProcessingView

Returns:

The derived post-processing configuration for the system.

Raises:

ValueError – If modes sharing a channel carry different max-likelihood methods.

disallowed_states_for_channel(channel_id)

Returns the disallowed emitted state labels for a given logical channel.

Parameters:

channel_id (str) – The logical channel identifier to look up.

Return type:

set[int]

Returns:

The set of disallowed state labels, or an empty set if the channel has nothing to post-select out.

known_channel_ids: frozenset[str]
unmatched_channels(channel_ids)

Return the channel IDs that are not known to the system data at all.

A channel is considered unmatched only when it is entirely absent from the canonical system data (i.e. not in known_channel_ids).

Parameters:

channel_ids (list[str]) – The logical channel identifiers to check.

Return type:

list[str]

Returns:

A list of channel IDs from channel_ids that are absent from known_channel_ids. Empty if all are present.

UNMAPPED_STATE_LABEL = -1

The state label a maximum-likelihood discriminator emits when the winning normalised likelihood falls below p_min, i.e. when no centroid can be assigned confidently.