Skip to content

Commit

Permalink
Updated add_data tests passed qiskit-community#1268
Browse files Browse the repository at this point in the history
  • Loading branch information
Musa-Sina-Ertugrul committed Apr 22, 2024
1 parent 7418966 commit 4c3dad6
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions qiskit_experiments/framework/experiment_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,12 +750,29 @@ def add_data(
else:
experiment_seperator[inner_datum[0]["metadata"]["experiment_type"]] = ExperimentData()
experiment_seperator[inner_datum[0]["metadata"]["experiment_type"]].add_data(inner_datum[0])
<<<<<<< HEAD
<<<<<<< HEAD
else:
self._result_data.append(datum)
=======

self._result_data.append(datum)
=======

elif "composite_metadata" in datum:
composite_flag = True
marginalized_data = self._marginalized_component_data([datum])
for inner_datum in marginalized_data:
#print(inner_datum)
if "experiment_type" in inner_datum[0]["metadata"]:
if inner_datum[0]["metadata"]["experiment_type"] in experiment_seperator:
experiment_seperator[inner_datum[0]["metadata"]["experiment_type"]].add_data(inner_datum[0])
else:
experiment_seperator[inner_datum[0]["metadata"]["experiment_type"]] = ExperimentData()
experiment_seperator[inner_datum[0]["metadata"]["experiment_type"]].add_data(inner_datum[0])

self._result_data.append(datum)
>>>>>>> 9eb2dba0 (Updated add_data tests passed #1268)

>>>>>>> e7f46c3a (Updated add_data tests passed #1268)
elif isinstance(datum, Result):
Expand All @@ -768,8 +785,6 @@ def add_data(
if composite_flag:
tmp_exp_data._set_child_data(list(experiment_seperator.values()))
self._set_child_data([tmp_exp_data])

return tmp_exp_data

def __add_data(
self,
Expand Down Expand Up @@ -834,6 +849,7 @@ def _add_data(

# self._marginalized_component_data()
# Directly add non-job data

marginalized_data = self._marginalized_component_data(data)

with self._result_data.lock:
Expand Down

0 comments on commit 4c3dad6

Please sign in to comment.