From 58270f1fccc6b40dbbbe80fcd5ed3dfaa67378fa Mon Sep 17 00:00:00 2001 From: "M. Sohaib Alam" Date: Tue, 30 Apr 2019 12:08:43 -0700 Subject: [PATCH 1/4] Removing as an argument to pyQuil's TomographyExperiment --- forest/benchmarking/direct_fidelity_estimation.py | 8 ++++---- forest/benchmarking/tomography.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/forest/benchmarking/direct_fidelity_estimation.py b/forest/benchmarking/direct_fidelity_estimation.py index 8f41fe8e..33d03c63 100644 --- a/forest/benchmarking/direct_fidelity_estimation.py +++ b/forest/benchmarking/direct_fidelity_estimation.py @@ -145,7 +145,7 @@ def generate_exhaustive_process_dfe_experiment(program: Program, qubits: list, qubits=qubits, in_states=[None, plusX, minusX, plusY, minusY, plusZ, minusZ], benchmarker=benchmarker)), - program=program, qubits=qubits) + program=program) return expr @@ -184,7 +184,7 @@ def generate_exhaustive_state_dfe_experiment(program: Program, qubits: list, qubits=qubits, in_states=[None, plusZ], benchmarker=benchmarker)), - program=program, qubits=qubits) + program=program) return expr @@ -253,7 +253,7 @@ def generate_monte_carlo_state_dfe_experiment(program: Program, qubits: List[int _monte_carlo_dfe(program=program, qubits=qubits, in_states=[None, plusZ], n_terms=n_terms, benchmarker=benchmarker)), - program=program, qubits=qubits) + program=program) return expr @@ -288,7 +288,7 @@ def generate_monte_carlo_process_dfe_experiment(program: Program, qubits: List[i _monte_carlo_dfe(program=program, qubits=qubits, in_states=[None, plusX, minusX, plusY, minusY, plusZ, minusZ], n_terms=n_terms, benchmarker=benchmarker)), - program=program, qubits=qubits) + program=program) return expr diff --git a/forest/benchmarking/tomography.py b/forest/benchmarking/tomography.py index 914d1a63..69b9aeab 100644 --- a/forest/benchmarking/tomography.py +++ b/forest/benchmarking/tomography.py @@ -74,7 +74,7 @@ def generate_state_tomography_experiment(program: Program, qubits: List[int]): :param qubits: The qubits to tomographize """ return PyQuilTomographyExperiment(settings=list(_state_tomo_settings(qubits)), - program=program, qubits=qubits) + program=program) def _sic_process_tomo_settings(qubits: Sequence[int]): @@ -144,7 +144,7 @@ def generate_process_tomography_experiment(program: Program, qubits: List[int], else: raise ValueError(f"Unknown basis {in_basis}") - return PyQuilTomographyExperiment(settings=list(func(qubits)), program=program, qubits=qubits) + return PyQuilTomographyExperiment(settings=list(func(qubits)), program=program) @dataclass From ca70d51cd90c621d22dfb9c1696be643fc31a319 Mon Sep 17 00:00:00 2001 From: "M. Sohaib Alam" Date: Tue, 30 Apr 2019 12:39:26 -0700 Subject: [PATCH 2/4] Replacing stddev with std_err --- forest/benchmarking/tests/test_process_tomography.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forest/benchmarking/tests/test_process_tomography.py b/forest/benchmarking/tests/test_process_tomography.py index f4281955..c6c9f48a 100644 --- a/forest/benchmarking/tests/test_process_tomography.py +++ b/forest/benchmarking/tests/test_process_tomography.py @@ -114,7 +114,7 @@ def wfn_measure_observables(n_qubits, tomo_expt: TomographyExperiment): yield ExperimentResult( setting=setting, expectation=wfn.reset().do_program(prog).expectation(setting.out_operator), - stddev=0., + std_err=0., total_counts=1, # don't set to zero unless you want nans ) From 2c2dc7f33ce0977ff03f4008f3d9bf6c0e3793a4 Mon Sep 17 00:00:00 2001 From: "M. Sohaib Alam" Date: Tue, 30 Apr 2019 12:50:15 -0700 Subject: [PATCH 3/4] Bumping pyQuil version up to 2.7.0 --- requirements.txt | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index e3c40015..bad7d369 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -pyquil>=2.4.0 +pyquil>=2.7.0 numpy networkx pandas diff --git a/setup.py b/setup.py index a46d1511..046ea470 100644 --- a/setup.py +++ b/setup.py @@ -50,7 +50,7 @@ def find_forest_packages(): long_description_content_type="text/markdown", long_description=open('README.md').read(), install_requires=[ - 'pyquil>=2.4.0', + 'pyquil>=2.7.0', 'numpy', 'networkx', 'pandas', From 1b3810b6ac74fa42de5a68c8c07375736c12d26f Mon Sep 17 00:00:00 2001 From: "M. Sohaib Alam" Date: Thu, 18 Apr 2019 11:18:18 -0700 Subject: [PATCH 4/4] Using std_err instead of stddev --- forest/benchmarking/direct_fidelity_estimation.py | 4 ++-- forest/benchmarking/randomized_benchmarking.py | 2 +- forest/benchmarking/tomography.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/forest/benchmarking/direct_fidelity_estimation.py b/forest/benchmarking/direct_fidelity_estimation.py index 33d03c63..bef3ac9e 100644 --- a/forest/benchmarking/direct_fidelity_estimation.py +++ b/forest/benchmarking/direct_fidelity_estimation.py @@ -318,9 +318,9 @@ def acquire_dfe_data(qc: QuantumComputer, expr: TomographyExperiment, n_shots=10 program=expr.program, out_pauli=[str(e[0].out_operator) for e in expr], pauli_point_est=np.array([r.expectation for r in res]), - pauli_std_err=np.array([r.stddev for r in res]), + pauli_std_err=np.array([r.std_err for r in res]), cal_point_est=np.array([r.calibration_expectation for r in res]), - cal_std_err=np.array([r.calibration_stddev for r in res]), + cal_std_err=np.array([r.calibration_std_err for r in res]), dimension=2**len(expr.qubits), qubits=expr.qubits) diff --git a/forest/benchmarking/randomized_benchmarking.py b/forest/benchmarking/randomized_benchmarking.py index 0b03af3a..2d0d6ba3 100644 --- a/forest/benchmarking/randomized_benchmarking.py +++ b/forest/benchmarking/randomized_benchmarking.py @@ -287,7 +287,7 @@ def run(qc: QuantumComputer, seq: List[Program], subgraph: List[List[int]], num_ _rs = list(measure_observables(qc, tomo_exp, num_trials)) # Inelegant shim from state tomo refactor. To clean up! expectations=[r.expectation for r in _rs[1:]] - variances=[r.stddev ** 2 for r in _rs[1:]] + variances=[r.std_err ** 2 for r in _rs[1:]] results.append((expectations, variances)) return results diff --git a/forest/benchmarking/tomography.py b/forest/benchmarking/tomography.py index 69b9aeab..d316d985 100644 --- a/forest/benchmarking/tomography.py +++ b/forest/benchmarking/tomography.py @@ -181,7 +181,7 @@ def shim_pyquil_results_to_TomographyData(program, qubits, results: List[Experim in_ops=[r.setting.in_operator for r in results[1:]], out_ops=[r.setting.out_operator for r in results[1:]], expectations=[r.expectation for r in results[1:]], - variances=[r.stddev ** 2 for r in results[1:]], + variances=[r.std_err ** 2 for r in results[1:]], program=program, number_qubits=len(qubits), dimension=2 ** len(qubits), @@ -858,7 +858,7 @@ def _resample_expectations_with_beta(results, prior_counts=1): resampled_results += [ExperimentResult( setting=result.setting, expectation=resampled_expect, - stddev=result.stddev, + std_err=result.std_err, total_counts=result.total_counts, )] return resampled_results