Skip to content

Commit

Permalink
Fix rerun analysis how-to (#1339)
Browse files Browse the repository at this point in the history
The rerun analysis how-to has been updated with the correct syntax for
running the analysis so that the current experiment data object is
overwritten instead of creating a new one. Closes #1185.

---------

Co-authored-by: Toshinari Itoko <[email protected]>
  • Loading branch information
coruscating and itoko authored Dec 7, 2023
1 parent fd3a2b5 commit 8cc20df
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions docs/howtos/rerun_analysis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@ job IDs:

expdata = ExperimentData(experiment = experiment)
expdata.add_jobs([provider.retrieve_job(job_id) for job_id in job_ids])
experiment.analysis.run(expdata)
experiment.analysis.run(expdata, replace_results=True)

# Block execution of subsequent code until analysis is complete
expdata.block_for_results()

``expdata`` will be the new experiment data object containing results of the rerun analysis.
``expdata`` will be the new experiment data object containing results of the rerun analysis. Note that if
``replace_results`` isn't set, running the analysis will return a new :class:`.ExperimentData` object
instead of overwriting the existing one.

If you have the job data in the form of a :class:`~qiskit.result.Result` object, you can
invoke the :meth:`.add_data` method instead of :meth:`.add_jobs`:
Expand Down Expand Up @@ -115,7 +117,7 @@ first component experiment.

data = ExperimentData(experiment=pexp)
data.add_jobs([provider.retrieve_job(job_id) for job_id in job_ids])
pexp.analysis.run(data)
pexp.analysis.run(data, replace_results=True)

See Also
--------
Expand Down

0 comments on commit 8cc20df

Please sign in to comment.