qermit.postselection#

postselect_mitres.gen_postselect_mitres(postselect_mgr: PostselectMgr, **kwargs) MitRes#

Generates MitRes running given circuit and applying postselection.

Parameters:
  • backend (Backend) – Backend on this circuits are run.

  • postselect_mgr (PostselectMgr) – Postselection manager.

Returns:

MitRes running given circuit and applying postselection.

Return type:

MitRes

class qermit.postselection.postselect_manager.PostselectMgr(compute_cbits: List[Bit], postselect_cbits: List[Bit])[source]#

Class for tracking and applying post selection to results. Includes other methods to analyse the results after post selection.

__init__(compute_cbits: List[Bit], postselect_cbits: List[Bit])[source]#

Initialisation method.

Parameters:
  • compute_cbits (List[Bit]) – Bits in the circuit which are not affected by post selection.

  • postselect_cbits (List[Bit]) – Bits on which the post selection is based.

Raises:

Exception – Raised if a bit is in both compute_cbits and postselect_cbits.

__weakref__#

list of weak references to the object (if defined)

dict_to_result(result_dict: Dict[Tuple[int, ...], int]) BackendResult[source]#

Convert dictionary to BackendResult.

Parameters:

result_dict (Dict[Tuple[int, ...], int]) – Dictionary to convert.

Returns:

Corresponding BackendResult.

Return type:

BackendResult

get_postselected_shot(shot: Tuple[int, ...]) Tuple[int, ...][source]#

Removes postselection bits from shot.

is_postselect_shot(shot: Tuple[int, ...]) bool[source]#

Determines if shot survives postselection

merge_result(result: BackendResult) BackendResult[source]#

Transforms BackendResult so that postselection bits are removed, but no shots are removed by postselection.

Parameters:

result (BackendResult) – Result to be transformed.

Returns:

Result with postselection bits removed.

Return type:

BackendResult

postselect_result(result: BackendResult) BackendResult[source]#

Transforms BackendResult to keep only shots which should be post selected.

Parameters:

result (BackendResult) – Result to be modified.

Returns:

Postselected shots.

Return type:

BackendResult