AddSpectatorPreCircuitBitFlipChecks¶
- class AddSpectatorPreCircuitBitFlipChecks(*args, **kwargs)[source]¶
Bases:
TransformationPassAdd bit-flip checks at the beginning of the circuit on qubits adjacent to active qubits.
Each spectator qubit receives a pre-circuit bit-flip check: A narrowband X-pulse that flips the qubit’s state (\(|x\rangle\mapsto|x\oplus1\rangle\)), then a regular X-pulse followed by a measurement. If the QPU fails to flip the qubit from \(|0\rangle\mapsto|1\rangle\mapsto|0\rangle\), that sample may be considered unreliable and discarded. Postselecting only samples that pass all checks can improve the fidelity of distributions sampled from the QPU. Optionally via
include_unmeasured, active qubits that are not terminated by a measurement are also treated as spectators.The added measurements write to a new classical register with one bit per spectator qubit, named
spectator_creg_name(default"spec_pre").Note
These passes are only supported on Heron QPUs where fractional gates are supported.
Initialize the pass.
- Parameters:
coupling_map – A coupling map or a list of tuples indicating pairs of neighboring qubits.
x_pulse_type – The type of X-pulse to apply for the pre-check measurements. Either
"xslow"or"rx".include_unmeasured – Whether the qubits that are active but are not terminated by a measurement should also be treated as spectators. If
True, a terminal measurement is added on each of them.spectator_creg_name – The name of the classical register added for the measurements on the spectator qubits.
ignore_spectator_creg_names – List of classical register names to ignore when determining active qubits. Qubits that only have measurements to these registers are not considered active, preventing cascading spectator selection. Defaults to
["spec"](the default name used byAddSpectatorPostCircuitBitFlipChecks).ignore_creg_suffixes – A list of suffixes for classical registers that should be ignored when determining terminated qubits. Qubits with measurements into registers with these suffixes are not considered terminated, allowing pre-check measurements to be added. By default, registers ending with “_ps” are ignored to allow pre-check after post-check.
pre_check_suffix – The suffix used by AddPreCircuitBitFlipChecks for pre-check registers. This is used to identify which qubits have pre-check measurements and which barrier to extend. Defaults to “_pre”.
Attributes
- is_analysis_pass¶
Check if the pass is an analysis pass.
If the pass is an AnalysisPass, that means that the pass can analyze the DAG and write the results of that analysis in the property set. Modifications on the DAG are not allowed by this kind of pass.
- is_transformation_pass¶
Check if the pass is a transformation pass.
If the pass is a TransformationPass, that means that the pass can manipulate the DAG, but cannot modify the property set (but it can be read).
Methods
- execute(passmanager_ir, state, callback=None)¶
Execute optimization task for input Qiskit IR.
- Parameters:
passmanager_ir (DAGCircuit) – Qiskit IR to optimize.
state (DAGCircuit) – State associated with workflow execution by the pass manager itself.
callback (Callable[[Task, DAGCircuit, PropertySet, float, int], None] | None) – A callback function which is called per execution of optimization task.
- Returns:
Optimized Qiskit IR and state of the workflow.
- Return type:
- run(dag)[source]¶
Run a pass on the DAGCircuit. This is implemented by the pass developer.
- Parameters:
dag (DAGCircuit) – the dag on which the pass is run.
- Raises:
NotImplementedError – when this is left unimplemented for a pass.
- update_status(state, run_state)¶
Update workflow status.
- Parameters:
state (PassManagerState) – Pass manager state to update.
run_state (RunState) – Completion status of current task.
- Returns:
Updated pass manager state.
- Return type: