-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to control figure generation in composite experiments (#1240)
### Summary Closes #1239. An init parameter has been added to composite analysis, `generate_figures`, to control figure generation. By default, ``generate_figures`` is ``always``, meaning figures will always be generated. If ``generate_figures`` is set to ``selective``, then only figures for analysis results of bad quality will be generated. If ``generate_figures`` is set to ``never``, then figures will never be generated. This behavior can still be overridden for individual analyses by setting the analysis option ``plot``, which is now unset by default instead of `True`. ### Details and comments - I didn't end up implementing the proposal discussed in the issue where all figures would still be generated in `selective` mode if there are 10 or fewer figures. If this is preferable, we can add the behavior, but it seems a bit messy to keep a counter of all component experiments and how many figures each generates. - Added how to access child analysis classes in the Getting Started tutorial. ### Timing benchmark I ran a parallel T1 experiment over 127 qubits then timed only the analysis. - ``always``: ~120 seconds - ``selective``: ~100 seconds (generated 60/127 figures) - ``never``: ~15 seconds
- Loading branch information
1 parent
73d0a03
commit 53b3033
Showing
21 changed files
with
215 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
Control figure generation | ||
========================= | ||
|
||
Problem | ||
------- | ||
|
||
You want to change the default behavior where figures are generated with every experiment. | ||
|
||
Solution | ||
-------- | ||
|
||
For a single non-composite experiment, figure generation can be switched off by setting the analysis | ||
option ``plot`` to ``False``: | ||
|
||
.. jupyter-input:: | ||
|
||
experiment.analysis.set_options(plot = False) | ||
|
||
For composite experiments, there is a ``generate_figures`` analysis option which controls how child figures are | ||
generated. There are three options: | ||
|
||
- ``always``: The default behavior, generate figures for each child experiment. | ||
- ``never``: Never generate figures for any child experiment. | ||
- ``selective``: Only generate figures for analysis results where ``quality`` is ``bad``. This is useful | ||
for large composite experiments where you only want to examine qubits with problems. | ||
|
||
This parameter should be set on the analysis of a composite experiment before the analysis runs: | ||
|
||
.. jupyter-input:: | ||
|
||
parallel_exp = ParallelExperiment( | ||
[T1(physical_qubits=(i,), delays=delays) for i in range(2)] | ||
) | ||
parallel_exp.analysis.set_options(generate_figures="selective") | ||
|
||
Discussion | ||
---------- | ||
|
||
These options are useful for large composite experiments, where generating all figures incurs a significant | ||
overhead. | ||
|
||
See Also | ||
-------- | ||
|
||
* The `Visualization tutorial <visualization.html>`_ discusses how to customize figures |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.