qiskit-experiments
qiskit-experiments copied to clipboard
Rerunning composite analysis doesn't work
What is the current behavior?
As reported by @TsafrirA, loading a composite experiment from the cloud service and rerunning the analysis doesn't work properly.
Steps to reproduce the problem
exps_t1 = []
exps_t2 = []
for q in (0, 2):
exp_t1 = T1((q,), delays=np.linspace(0, 300e-6, 20))
exp_t2 = T2Ramsey((q,), delays=np.linspace(0, 300e-6, 20))
exps_t1.append(exp_t1)
exps_t2.append(exp_t2)
batch = BatchExperiment(
[
ParallelExperiment(exps_t1),
ParallelExperiment(exps_t2),
],
backend=backend,
)
exp_data = batch.run()
exp_data.save()
...
exp_data_2 = ExperimentData.load(exp_id,service=service,provider=provider)
exp_data_2 = batch.analysis.run(exp_data_2)
This populates the main experiment data container but not the analysis results and figures of the child experiments. The current workaround is to turn on flatten_results
.
What is the expected behavior?
All child experiment data should be correctly populated.
The cause for problems here is exp_data.save()
because save
only saves the children that were already added to exp_data
, and adding new children is done concurrently. Doing exp_data.block_for_results().save()
fixes it; if a major code refactor is on the way, I don't think this specific problem should be handled, but the way in which children are created.
The user wants to save a long experiment without waiting for it to complete and then load it and run the analysis later, so the block_for_results()
fix won't work for this workflow. Since turning on flatten_results
does work right now, I'm fine with addressing this in the refactor.