Skip to content

Commit d27fe41

Browse files
Fix QuantumVolumeAnalysis (#711)
Fixes QuantumVolumeAnalysis to remove unnecessary dependence on the QuantumVolume experiment instance being stored in the ExperimentData, since this is not saved to the result DB and will be missing from loaded data.
1 parent f612c0b commit d27fe41

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

qiskit_experiments/library/quantum_volume/qv_analysis.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import numpy as np
2121
import uncertainties
22+
from qiskit_experiments.exceptions import AnalysisError
2223
from qiskit_experiments.curve_analysis import plot_scatter, plot_errorbar
2324
from qiskit_experiments.framework import (
2425
BaseAnalysis,
@@ -55,14 +56,19 @@ def _default_options(cls) -> Options:
5556
return options
5657

5758
def _run_analysis(self, experiment_data):
58-
depth = experiment_data.experiment.num_qubits
5959
data = experiment_data.data()
6060
num_trials = len(data)
61+
depth = None
6162
heavy_output_prob_exp = []
6263

6364
for data_trial in data:
65+
trial_depth = data_trial["metadata"]["depth"]
66+
if depth is None:
67+
depth = trial_depth
68+
elif trial_depth != depth:
69+
raise AnalysisError("QuantumVolume circuits do not all have the same depth.")
6470
heavy_output = self._calc_ideal_heavy_output(
65-
data_trial["metadata"]["ideal_probabilities"], data_trial["metadata"]["depth"]
71+
data_trial["metadata"]["ideal_probabilities"], trial_depth
6672
)
6773
heavy_output_prob_exp.append(
6874
self._calc_exp_heavy_output_probability(data_trial, heavy_output)

0 commit comments

Comments
 (0)