diff --git a/qiskit_pulse_control/json.py b/qiskit_pulse_control/json.py index d949386..7b6bd2d 100644 --- a/qiskit_pulse_control/json.py +++ b/qiskit_pulse_control/json.py @@ -1,4 +1,5 @@ from collections.abc import Callable +import collections import json from typing import Any @@ -21,6 +22,13 @@ def default(self, any_object: Any) -> Any: if isinstance(any_object, unified_job.Job): return self._encode_job(any_object) if isinstance(any_object, unified_job.ExperimentJob): + # fix https://github.com/qiskit-community/qiskit-experiments/issues/1508 + copied_experiment = any_object.experiment.copy() + experiment_kwargs = getattr(copied_experiment, '__init_kwargs__', + collections.OrderedDict()) + if 'backend' in experiment_kwargs: + del experiment_kwargs['backend'] + encoded_value = { 'jobs': [self._encode_job(job) for job in any_object.jobs], 'experiment': diff --git a/qiskit_pulse_control/unified_job.py b/qiskit_pulse_control/unified_job.py index 1438c9c..a4b4db9 100644 --- a/qiskit_pulse_control/unified_job.py +++ b/qiskit_pulse_control/unified_job.py @@ -109,7 +109,6 @@ def experiment_data(self) -> framework.ExperimentData: return self._experiment_data self._experiment_data = framework.ExperimentData( experiment=self.experiment) - # TODO: check if the runtime jobs is done if all(job.status == providers.JobStatus.DONE for job in self.jobs): for job in self.jobs: # .add_data() cannot handle PrimitiveResult. The `job_id` @@ -124,6 +123,11 @@ def experiment_data(self) -> framework.ExperimentData: for job in self.jobs: self._experiment_data.add_jobs( [job.runtime_job for job in self.jobs]) + if (self._experiment_data.status() == + framework.ExperimentStatus.DONE): + self.experiment.analysis.run( + self._experiment_data, replace_results=True) + self.analysis_result = self._experiment_data.analysis_results() return self._experiment_data