From 9380cd304e9085c2208e9cc0333f5f2f8b4b4c15 Mon Sep 17 00:00:00 2001 From: Yael Ben-Haim Date: Tue, 11 Jan 2022 13:40:42 +0200 Subject: [PATCH 1/4] Removed sub-experiment info from composite analysis result --- .../framework/composite/composite_analysis.py | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/qiskit_experiments/framework/composite/composite_analysis.py b/qiskit_experiments/framework/composite/composite_analysis.py index ddf6671cb8..fa4b2a34d3 100644 --- a/qiskit_experiments/framework/composite/composite_analysis.py +++ b/qiskit_experiments/framework/composite/composite_analysis.py @@ -16,8 +16,7 @@ from typing import List, Dict import numpy as np from qiskit.result import marginal_counts -from qiskit_experiments.framework import BaseAnalysis, ExperimentData, AnalysisResultData -from qiskit_experiments.database_service.device_component import Qubit +from qiskit_experiments.framework import BaseAnalysis, ExperimentData class CompositeAnalysis(BaseAnalysis): @@ -69,7 +68,6 @@ def _run_analysis(self, experiment_data: ExperimentData): # child data is handled by the `replace_results` kwarg of the # parent container it is safe to always clear and replace the # results of child containers in this step - analysis_results = [] for i, (sub_data, sub_exp) in enumerate(zip(marginalized_data, component_exps)): sub_exp_data = experiment_data.child_data(component_ids[i]) @@ -85,17 +83,6 @@ def _run_analysis(self, experiment_data: ExperimentData): # we always run with replace result on component analysis sub_exp.analysis.run(sub_exp_data, replace_results=True) - # Record the component experiment id and type as an analysis result - # for evidence analysis has started and to display in the service DB - result = AnalysisResultData( - name=sub_exp_data.experiment_type, - value=sub_exp_data.experiment_id, - device_components=[ - Qubit(qubit) for qubit in sub_exp_data.metadata.get("physical_qubits", []) - ], - ) - analysis_results.append(result) - # Add callback to wait for all component analysis to finish before returning # the parent experiment analysis results def _wait_for_components(experiment_data, component_ids): @@ -104,7 +91,7 @@ def _wait_for_components(experiment_data, component_ids): experiment_data.add_analysis_callback(_wait_for_components, component_ids=component_ids) - return analysis_results, [] + return [], [] def _initialize_components(self, experiment, experiment_data): """Initialize child data components and return list of child experiment IDs""" From ed8559b278790eb4cb7c9b5ec2d90c816206f670 Mon Sep 17 00:00:00 2001 From: Yael Ben-Haim Date: Tue, 11 Jan 2022 17:51:37 +0200 Subject: [PATCH 2/4] release notes --- releasenotes/notes/kids-in-analysis-df7b4dcbeb5b3125.yaml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 releasenotes/notes/kids-in-analysis-df7b4dcbeb5b3125.yaml diff --git a/releasenotes/notes/kids-in-analysis-df7b4dcbeb5b3125.yaml b/releasenotes/notes/kids-in-analysis-df7b4dcbeb5b3125.yaml new file mode 100644 index 0000000000..8af6eaff5c --- /dev/null +++ b/releasenotes/notes/kids-in-analysis-df7b4dcbeb5b3125.yaml @@ -0,0 +1,4 @@ +--- +upgrade: + - | + Analysis results of composite experiments have changed, and do not include information about sub-experiments anymore. Instead, use ``CompositeExperiment.child_data`` to retrieve sub-experiments of a given composite experiment. This change affects parallel and batch experiments as special cases. From cd82e2cb867c8c1d8e3b54fc0b1f49f0168de2b3 Mon Sep 17 00:00:00 2001 From: Yael Ben-Haim Date: Tue, 11 Jan 2022 19:33:50 +0200 Subject: [PATCH 3/4] Update releasenotes/notes/kids-in-analysis-df7b4dcbeb5b3125.yaml Co-authored-by: Christopher J. Wood --- releasenotes/notes/kids-in-analysis-df7b4dcbeb5b3125.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/releasenotes/notes/kids-in-analysis-df7b4dcbeb5b3125.yaml b/releasenotes/notes/kids-in-analysis-df7b4dcbeb5b3125.yaml index 8af6eaff5c..272ba7b0dc 100644 --- a/releasenotes/notes/kids-in-analysis-df7b4dcbeb5b3125.yaml +++ b/releasenotes/notes/kids-in-analysis-df7b4dcbeb5b3125.yaml @@ -1,4 +1,7 @@ --- upgrade: - | - Analysis results of composite experiments have changed, and do not include information about sub-experiments anymore. Instead, use ``CompositeExperiment.child_data`` to retrieve sub-experiments of a given composite experiment. This change affects parallel and batch experiments as special cases. + The :class:`.ParallelExperiment` and :class:`.BatchExperiment` composite experiments + have been changed to no longer return analysis results containing information about + sub-experiments. Instead, use the :meth:`~.ParallelExperiment.child_data` method to + retrieve sub-experiments of a given composite experiment. From 173cfda48ee403f0a26fea636b0a5b13ab61704a Mon Sep 17 00:00:00 2001 From: Yael Ben-Haim Date: Thu, 13 Jan 2022 22:12:37 +0200 Subject: [PATCH 4/4] removed a debug print --- test/test_composite.py | 1 - 1 file changed, 1 deletion(-) diff --git a/test/test_composite.py b/test/test_composite.py index 7d6fae2929..09a7784829 100644 --- a/test/test_composite.py +++ b/test/test_composite.py @@ -230,7 +230,6 @@ def test_composite_tags(self): expdata.tags = ["a", "c", "a"] data1.tags = ["b"] - print(expdata.tags) self.assertEqual(sorted(expdata.tags), ["a", "c"]) self.assertEqual(sorted(data1.tags), ["b"]) self.assertEqual(sorted(data2.tags), [])