qat.runtime.passes.analysis module

Runtime analysis passes for result indexing and post-selection.

This module provides analysis passes that run prior to result transformation. They are responsible for deriving mappings between acquired output variables and physical qubit indices, and for recording post-selection metadata produced by post-processing.

class DiscriminateResult(outputs)

Bases: ResultInfoMixin

Stores the string state-label arrays produced by the Discriminate stage of the granular post-processing pipeline.

Parameters:

outputs (dict[str, ndarray]) – Mapping from output variable name to a string ndarray of state labels (e.g. "0", "1", "2"). The global post-selection mask has already been applied when this result is stored.

outputs: dict[str, ndarray]
class EqualiseResult(outputs)

Bases: ResultInfoMixin

Stores the equalised (affine-transformed) complex IQ arrays produced by the Equalise stage of the granular post-processing pipeline.

Parameters:

outputs (dict[str, ndarray]) – Mapping from output variable name to the complex-valued IQ array after equalisation. Arrays are indexed by shot (and optionally by time for SCOPE mode). The global post-selection mask has already been applied when this result is stored.

outputs: dict[str, ndarray]
class IndexMappingAnalysis(model)

Bases: AnalysisPass

Determines a mapping from classical bit registers to qubits.

Searches through the acquires of the package and determines their associated qubit. Also looks for classical registers of the form <clreg_name>[<clreg_index>].

Supports both Executable packages and InstructionBuilder.

Parameters:

model (PhysicalHardwareModel) – The hardware model is needed for the qubit mapping.

run(acquisitions, res_mgr, *args, package, **kwargs)
Parameters:
  • acquisitions (dict[str, Any]) – The dictionary of results acquired from the target machine.

  • res_mgr (ResultManager) – The results manager to save the mapping.

  • package (InstructionBuilder | Executable) – The executable program containing the results-processing information should be passed as a keyword argument.

static var_to_physical_channel_executable(package)
Return type:

dict[str, str]

var_to_physical_channel_qat_ir(package)
Return type:

dict[str, str]

var_to_qubit_map(mapping)

Maps the variables in the mapping to qubit indices.

class IndexMappingResult(mapping)

Bases: ResultInfoMixin

Result containing a mapping from output variable names to qubit indices.

Parameters:

mapping (dict[str, int]) – Dictionary mapping variable name to physical qubit index.

mapping: dict[str, int]
class PostSelectionResult(shots_requested, shots_retained, global_mask=None)

Bases: ResultInfoMixin

Records the outcome of post-selection applied during acquisition post-processing.

Parameters:
  • shots_requested (int) – Total shots compiled and executed.

  • shots_retained (int) – Number of shots that survived post-selection.

  • global_mask (Optional[ndarray]) – Boolean array of shape (shots_requested,) where True marks a retained shot. None if no post-selection was applied.

global_mask: ndarray | None = None
shots_requested: int
shots_retained: int