qiskit-experiments icon indicating copy to clipboard operation
qiskit-experiments copied to clipboard

Save experiment and analysis config as artifacts

Open coruscating opened this issue 11 months ago • 0 comments

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

  • [ ] add tests
  • [ ] add seeds used in final circuit generation
  • [ ] update rerun analysis and cloud database service documentation with usage examples

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.

coruscating avatar Mar 18 '24 17:03 coruscating