Skip to main content
IBM Quantum Platform

AddPostSelectionMeasures

class AddPostSelectionMeasures(*args, **kwargs)

GitHub

Bases: TransformationPass

Add a post selection measurement after every terminal measurement.

A post selection measurement is a measurement that follows a regular measurement on a given qubit. It consists of a narrowband X-pulse followed by a regular measurement operation. In the absence of noise, it is expected to return (b + 1) % 2, where b is the outcome of the original measurement.

This pass adds post selection measurements after every terminal measurement, i.e., after every measurement that is not followed by another operation on the same wire. The added measurements are placed after a barrier, and write to new classical registers that are copies of the DAG’s registers, with modified names.

Note

When this pass encounters a control flow operation, it iterates through all of its blocks. It marks as “terminated” only those qubits that are terminated in every one of the blocks, and it treats as unterminated every other qubit.

Initialize the pass.

Parameters

  • x_pulse_type – The type of X-pulse to apply for the post-selection measurements.
  • post_selection_suffix – A fixed suffix to append to the names of the classical registers when copying them.

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

execute(passmanager_ir, state, callback=None)

Execute optimization task for input Qiskit IR.

Parameters

  • passmanager_ir (Any) – Qiskit IR to optimize.
  • state (PassManagerState) – State associated with workflow execution by the pass manager itself.
  • callback (Callable | None) – A callback function which is caller per execution of optimization task.

Returns

Optimized Qiskit IR and state of the workflow.

Return type

tuple[Any, PassManagerState]

name

name()

Name of the pass.

Return type

str

run

run(dag)

GitHub

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

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

Was this page helpful?
Report a bug, typo, or request content on GitHub.