Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add quality check of calibration results #25

Merged
merged 24 commits into from
Dec 14, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Code reformat
  • Loading branch information
Daniel Mills authored and Daniel Mills committed Dec 13, 2021
commit 00be1940e2f999d32e1e7e95870ed463fe6cdb55
29 changes: 21 additions & 8 deletions qermit/clifford_noise_characterisation/ccl.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@
TaskGraph,
)
from qermit.taskgraph import gen_compiled_MitRes
from .cdr_post import cdr_calibration_task_gen, cdr_correction_task_gen, _PolyCDRCorrect, cdr_quality_check_task_gen
from .cdr_post import (
cdr_calibration_task_gen,
cdr_correction_task_gen,
_PolyCDRCorrect,
cdr_quality_check_task_gen,
)
import numpy as np
import random
from enum import Enum
Expand Down Expand Up @@ -460,12 +465,12 @@ def gen_CDR_MitEx(
:key model: Model characterised by state circuits, default _PolyCDRCorrect(1) (see cdr_post.py for other options).
:key likelihood_function: LikelihoodFunction used to filter state circuit results, given by a LikelihoodFunction Enum,
default set to none.
:key tolerance: Sets an allowed distance between exact expectation value
:key tolerance: Sets an allowed distance between exact expectation value
of the calibration circuits and 0.
:key distance_tolerance: The absolute tolerance on the distance between
:key distance_tolerance: The absolute tolerance on the distance between
expectation values of the calibration and original circuit.
:key calibration_fraction: The upper bound on the fraction of calibration
circuits which have noisy expectation values far from that of the
:key calibration_fraction: The upper bound on the fraction of calibration
circuits which have noisy expectation values far from that of the
original circuit.
"""
_states_sim_mitex = copy.copy(
Expand Down Expand Up @@ -509,8 +514,11 @@ def gen_CDR_MitEx(
_experiment_taskgraph.parallel(_states_sim_taskgraph)

_post_calibrate_task_graph = TaskGraph(_label="FitCalibrate")
_post_calibrate_task_graph.append(ccl_likelihood_filtering_task_gen(likelihood_function))
_post_calibrate_task_graph.append(cdr_calibration_task_gen(
_post_calibrate_task_graph.append(
ccl_likelihood_filtering_task_gen(likelihood_function)
)
_post_calibrate_task_graph.append(
cdr_calibration_task_gen(
device_backend,
kwargs.get("model", _PolyCDRCorrect(1)),
kwargs.get("tolerance", 0.01),
Expand All @@ -519,7 +527,12 @@ def gen_CDR_MitEx(

_post_task_graph = TaskGraph(_label="QualityCheckCorrect")
_post_task_graph.parallel(_post_calibrate_task_graph)
_post_task_graph.prepend(cdr_quality_check_task_gen(distance_tolerance=kwargs.get("distance_tolerance", 0.1), calibration_fraction=kwargs.get("calibration_fraction", 0.5)))
_post_task_graph.prepend(
cdr_quality_check_task_gen(
distance_tolerance=kwargs.get("distance_tolerance", 0.1),
calibration_fraction=kwargs.get("calibration_fraction", 0.5),
)
)

_experiment_taskgraph.prepend(
ccl_state_task_gen(n_non_cliffords, n_pairs, total_state_circuits)
Expand Down