-
Notifications
You must be signed in to change notification settings - Fork 131
Update ExperimentData to store figures #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| """ | ||
| return self._backend | ||
|
|
||
| def add_data( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that you copied a lot of sections from the Terra PR. I assume that this is a temporary copy, and that once the Terra PR is merged and we inherit from the class there, these sections will be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep exactly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a follow up branch to this PR where I started to do this, but its needs a few small changes to the Terra PR that I left as review there: https://github.com/chriseclectic/qiskit-experiments/blob/resultdb/qiskit_experiments/experiment_data.py#L34
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please be aware of #29
nkanazawa1989
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. My comments are just questions.
| self._format_plot(ax, fit_result, qubit=qubit) | ||
| figures = [ax.get_figure()] | ||
| else: | ||
| figures = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Raising UserWarning would be more friendly :)
Also makes some changes to be closer to draft API for terra base class
* wip curve fit analysis * wip curve fit analysis * curve_fit complete * - unittest - bug fix - lint * black * removed redundant code * fix unittest * fix docstring * fix docstring * wording fix Co-authored-by: Yael Ben-Haim <yaelbh@il.ibm.com> * Update qiskit_experiments/analysis/curve_analysis.py Co-authored-by: Daniel Egger <38065505+eggerdj@users.noreply.github.com> * Update qiskit_experiments/analysis/curve_analysis.py Co-authored-by: Daniel Egger <38065505+eggerdj@users.noreply.github.com> * Feedback from eggerdj - add default data processor - add data processor calibraiton - integrate run_fit and series fit - add data pre-processing (i.e. RB needs to take mean) - add fitter setup for initial guess and other options * readd 52c99ea and 0420d1d * add fit functions * lint * review by eggerdj r2 - change dp calibration logic - add gaussian function * add data processor keys in metadata add data processor keys in metadata * conform to #41 * feedback from chris1 - more general docstring - add default parameter to fit funcs * feedback from chris2 - parameter dict handling * feedback from chris3 - import path * lint * add fit option validation * add unittest and integration test * black & lint * simplify the analysis class * misc * add default figure generation * lint * add default value * fix docstring typo * remove outcome from default processing options * black and lint * add processor training check * fix pre processing routine * update rb analysis as an example - add num_qubits to curve analysis - add label generation to curve analysis * post process error handling when fit failed * add axis label * update axis formatting * more integration with new options * update irb * move class attributes to options * review comment from Chris * fix bug causes list indices must be ... * Analysis result formatting * update error docstring * lint * bug fix - reorder args of protected methods (series comes before xvals) - make analysis result list - relevant test fix - add filter kwargs to interleaved analysis * lint * fix spect analysis * fix composite analysis to use instance's analysis option * adjust curve figure appearance * black * update data and option handling * - private -> protected member - param list generation and validation in new method - all nan sigma handling - zero sigma handling in curve fitter - add data extraction utils - allow bounds = None - * update spectroscopy * black & lint * rerun rb notebook * Update qiskit_experiments/analysis/curve_analysis.py Co-authored-by: Daniel Egger <38065505+eggerdj@users.noreply.github.com> * Update qiskit_experiments/analysis/curve_analysis.py Co-authored-by: Daniel Egger <38065505+eggerdj@users.noreply.github.com> * Update qiskit_experiments/analysis/curve_analysis.py Co-authored-by: Daniel Egger <38065505+eggerdj@users.noreply.github.com> * Update qiskit_experiments/analysis/curve_analysis.py Co-authored-by: Daniel Egger <38065505+eggerdj@users.noreply.github.com> * Update qiskit_experiments/analysis/curve_analysis.py Co-authored-by: Daniel Egger <38065505+eggerdj@users.noreply.github.com> * - more docstring - add y normalization * black * add TODO comment * add analysis class information to result data * fix unittest * update spect analysis docstring * Update qiskit_experiments/analysis/curve_analysis.py Co-authored-by: Daniel Egger <38065505+eggerdj@users.noreply.github.com> * rb analysis class docstring * format docstring * Update qiskit_experiments/analysis/curve_analysis.py Co-authored-by: Daniel Egger <38065505+eggerdj@users.noreply.github.com> Co-authored-by: Yael Ben-Haim <yaelbh@il.ibm.com> Co-authored-by: Daniel Egger <38065505+eggerdj@users.noreply.github.com> Co-authored-by: Christopher J. Wood <cjwood@us.ibm.com>
* Update ExperimentData to handle figures Also makes some changes to be closer to draft API for terra base class * Update composite experiment class * Update RB and T1 experiments * Update tests * Fix linting errors * fix check for matplotlib * black * linting * Fix saving figure to file * Add type hints to BaseExperiment * Fix conflicts with main * unused import * fix doc string removed by rebase * Add handling of new and legacy backends
* wip curve fit analysis * wip curve fit analysis * curve_fit complete * - unittest - bug fix - lint * black * removed redundant code * fix unittest * fix docstring * fix docstring * wording fix Co-authored-by: Yael Ben-Haim <yaelbh@il.ibm.com> * Update qiskit_experiments/analysis/curve_analysis.py Co-authored-by: Daniel Egger <38065505+eggerdj@users.noreply.github.com> * Update qiskit_experiments/analysis/curve_analysis.py Co-authored-by: Daniel Egger <38065505+eggerdj@users.noreply.github.com> * Feedback from eggerdj - add default data processor - add data processor calibraiton - integrate run_fit and series fit - add data pre-processing (i.e. RB needs to take mean) - add fitter setup for initial guess and other options * readd 52c99ea and 0420d1d * add fit functions * lint * review by eggerdj r2 - change dp calibration logic - add gaussian function * add data processor keys in metadata add data processor keys in metadata * conform to qiskit-community#41 * feedback from chris1 - more general docstring - add default parameter to fit funcs * feedback from chris2 - parameter dict handling * feedback from chris3 - import path * lint * add fit option validation * add unittest and integration test * black & lint * simplify the analysis class * misc * add default figure generation * lint * add default value * fix docstring typo * remove outcome from default processing options * black and lint * add processor training check * fix pre processing routine * update rb analysis as an example - add num_qubits to curve analysis - add label generation to curve analysis * post process error handling when fit failed * add axis label * update axis formatting * more integration with new options * update irb * move class attributes to options * review comment from Chris * fix bug causes list indices must be ... * Analysis result formatting * update error docstring * lint * bug fix - reorder args of protected methods (series comes before xvals) - make analysis result list - relevant test fix - add filter kwargs to interleaved analysis * lint * fix spect analysis * fix composite analysis to use instance's analysis option * adjust curve figure appearance * black * update data and option handling * - private -> protected member - param list generation and validation in new method - all nan sigma handling - zero sigma handling in curve fitter - add data extraction utils - allow bounds = None - * update spectroscopy * black & lint * rerun rb notebook * Update qiskit_experiments/analysis/curve_analysis.py Co-authored-by: Daniel Egger <38065505+eggerdj@users.noreply.github.com> * Update qiskit_experiments/analysis/curve_analysis.py Co-authored-by: Daniel Egger <38065505+eggerdj@users.noreply.github.com> * Update qiskit_experiments/analysis/curve_analysis.py Co-authored-by: Daniel Egger <38065505+eggerdj@users.noreply.github.com> * Update qiskit_experiments/analysis/curve_analysis.py Co-authored-by: Daniel Egger <38065505+eggerdj@users.noreply.github.com> * Update qiskit_experiments/analysis/curve_analysis.py Co-authored-by: Daniel Egger <38065505+eggerdj@users.noreply.github.com> * - more docstring - add y normalization * black * add TODO comment * add analysis class information to result data * fix unittest * update spect analysis docstring * Update qiskit_experiments/analysis/curve_analysis.py Co-authored-by: Daniel Egger <38065505+eggerdj@users.noreply.github.com> * rb analysis class docstring * format docstring * Update qiskit_experiments/analysis/curve_analysis.py Co-authored-by: Daniel Egger <38065505+eggerdj@users.noreply.github.com> Co-authored-by: Yael Ben-Haim <yaelbh@il.ibm.com> Co-authored-by: Daniel Egger <38065505+eggerdj@users.noreply.github.com> Co-authored-by: Christopher J. Wood <cjwood@us.ibm.com>
Summary
Updates the
ExperimentDataclass to handle storing figures and to bring its API a bit closer in line with the draft API of the terra base class in Qiskit/qiskit#5499This is intended as step towards being able to make
ExperimentDataa subclass of theExperimentDataV1class from Qiskit/qiskit#5499 once it is merged into terra.Details and comments
_run_analysisto be apyplot.figurerather than an axis. This allows the figures to be stored and retrieved from experiment data.add_figureandfigurefrom Experiment data and service Qiskit/qiskit#5499T1ExperimentExperimentData.datafrom property to a method to match terra class APIanalysiskwarg toBaseExperiment.runwhich can be set to false to prevent analysis from being run automatically.