Skip to content

Commit

Permalink
Document that QVPlotter works with only one series
Browse files Browse the repository at this point in the history
  • Loading branch information
wshanks committed Jan 29, 2024
1 parent 6261d50 commit 79404db
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions qiskit_experiments/library/quantum_volume/qv_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,24 @@


class QuantumVolumePlotter(BasePlotter):
"""Plotter for QuantumVolumeAnalysis"""
"""Plotter for QuantumVolumeAnalysis
.. note::
This plotter only supports one series, named ``hops``, which it expects
to have an ``individual`` data key containing the individual heavy
output probabilities for each circuit in the experiment. Additional
series will be ignored.
"""

@classmethod
def expected_series_data_keys(cls) -> List[str]:
"""Returns the expected series data keys supported by this plotter.
Data Keys:
hops: Heavy-output probability fraction for each circuit
individual: Heavy-output probability fraction for each individual circuit
"""
return ["hops"]
return ["individual"]

@classmethod
def expected_supplementary_data_keys(cls) -> List[str]:
Expand Down Expand Up @@ -89,8 +97,7 @@ def _default_options(cls) -> Options:
return options

def _plot_figure(self):
series = self.series[0]
(hops,) = self.data_for(series, ["hops"])
(hops,) = self.data_for("hops", ["individual"])
trials = np.arange(1, 1 + len(hops))
hop_accumulative = np.cumsum(hops) / trials
hop_twosigma = 2 * (hop_accumulative * (1 - hop_accumulative) / trials) ** 0.5
Expand Down Expand Up @@ -185,7 +192,7 @@ def _run_analysis(self, experiment_data):
hop_result, qv_result = self._calc_quantum_volume(heavy_output_prob_exp, depth, num_trials)

if self.options.plot:
self.options.plotter.set_series_data("hops", hops=hop_result.extra["HOPs"])
self.options.plotter.set_series_data("hops", individual=hop_result.extra["HOPs"])
self.options.plotter.set_supplementary_data(depth=hop_result.extra["depth"])
figures = [self.options.plotter.figure()]
else:
Expand Down

0 comments on commit 79404db

Please sign in to comment.