AddPreCircuitBitFlipChecks

class AddPreCircuitBitFlipChecks(*args, **kwargs)[source]

Bases: TransformationPass

Add bit-flip checks at the beginning of the circuit on active qubits terminated by a measurement.

A pre-circuit bit-flip check consists of a narrowband X-pulse that rotates the qubit from \(|0\rangle\mapsto|1\rangle\) followed by a normal X-pulse that rotates the qubit back to the ground state \(|0\rangle\) and a measurement. If the QPU fails to flip the qubit from \(|0\rangle\mapsto|1\rangle\mapsto|0\rangle\) on a given shot, 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.

The added measurements write to new classical registers that are copies of the DAG’s registers, with modified names (by default, appending "_pre" to the register name).

Note

These passes are only supported on Heron QPUs where fractional gates are supported.

Initialize the pass.

Parameters:
  • x_pulse_type – The type of X-pulse to apply for the pre-check measurements. Either "xslow" or "rx".

  • pre_check_suffix – A fixed suffix to append to the names of the classical registers when copying them.

  • ignore_creg_suffixes – A list of suffixes for classical registers that should be ignored (not copied). By default, registers ending with “_ps” are ignored to avoid adding pre-check to post-check registers.

  • ignore_creg_names – A list of exact classical register names that should be ignored (not copied). By default, registers named “spec” are ignored to avoid adding pre-check to spectator registers.

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:

tuple[DAGCircuit, PassManagerState]

name()

Name of the pass.

Return type:

str

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:

PassManagerState