Qiskit-Extensions / qiskit-experiments

Qiskit Experiments
https://qiskit-extensions.github.io/qiskit-experiments/
Apache License 2.0
151 stars 122 forks source link

Save experiment and analysis config as artifacts #1424

Open coruscating opened 4 months ago

coruscating commented 4 months ago

Summary

Adds BaseExperiment.load and BaseExperiment.save methods and a helper function load_all() that loads both experiment and experiment data, with the option to run analysis:

from qiskit_experiments.framework import load_all
from qiskit_ibm_runtime import QiskitRuntimeService
service = QiskitRuntimeService(channel="ibm_quantum")

exp, exp_data = load_all("9e242995-d793-4940-920f-f3970d7f777b", provider=service, run_analysis=True)

This PR incorporates changes from @ItamarGoldman's in #1423. To enable saving and loading, this PR saves experiment and analysis config as experiment_config and analysis_config in experiment data artifacts. Because analysis_options shouldn't be added as a new artifact every time analysis is rerun, this also adds overwrite_name option to add_artifacts() and renames the current overwrite option to overwrite_id. have been incorporated.

To-do

Notes

load_all() is inefficient because BaseExperiment.load() and ExperimentData.load() make separate and identical calls to the experiment service. Ideally this would be combined in a separate interface class in a future refactoring.