Spectroscopy and calibrations integration V3#88
Conversation
* Added required functionality to update spectroscopy.
nkanazawa1989
left a comment
There was a problem hiding this comment.
Thanks Daniel. I think this is nice approach though I see some complexity of mapping of experiment to parameter keys. The main question is who manages the extraction class instances.
Do you think how many experiments need this extraction? I think this is limited to rough amplitude calibration classes. If so maybe we can manage this in Rabi experiment analysis class, rather than introducing new (more general) framework.
Angle cals are also applied to multiple schedules, but this just needs a list of schedules and maybe we can write a list of schedules to update in one of experiment options.
Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
nkanazawa1989
left a comment
There was a problem hiding this comment.
I think this PR is in good shape. Few minor comments but these don't block merging.
Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
…brations_spec_integration_v3
Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
* Changed import order. * Renamed _update to _add_parameter_value.
nkanazawa1989
left a comment
There was a problem hiding this comment.
Perhaps we need to relax the experiment instance check in Amplitude, but for now this looks good to me. When we add different types of calibration and current logic becomes messy, then we can update this in future PR.
Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
Yes that is why I left it as is. I would rather implemented the other amplitude calibration experiments first and then refactor the inner workings of |
wshanks
left a comment
There was a problem hiding this comment.
Here is some minor feedback. I will approve because I don't think any of this should block merging if you want to merge now.
- Tests of the updaters might be better placed in a test_update_library module rather than spread out with the experiment tests.
- I had thought the updaters would look at analysis result values instead of fit parameters. I had thought the spectroscopy experiment produced an analysis result labeled "frequency" the way the T1 experiment produces a result labeled "T1". What do you think about analysis result values vs. fit parameter keys?
- I am not sure about the
classmethodusage in the updaters. I thinkclassmethods are a little confusing in general for non-expert Python programmers and also defining classes that you never instantiate is a little confusing. I understand the motivation for doing it this way, but I wonder if someone else wanting to modify an updater class in the future would. Maybe the docstrings should note this usage pattern though I don't know that such a docstring would be noticed. MaybeBaseUpdater.__init__could raise an exception stating that updaters are not meant to be instantiated?
|
I think these are reasonable suggestions and worth considering. |
…/qiskit-experiments into calibrations_spec_integration_v3
…ing. * _add_parameter_value is a classmethod again.
* * Added the update method to the calibrations. * Added required functionality to update spectroscopy. * * Used ParameterValue in update. * Update qiskit_experiments/calibration/calibrations.py Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com> * * Updated docstring. * * Added completion times. * * More robust quality check. * * Changed default result index to -1. * * Updated spectroscopy integration. * * Renamed calibration_types to calibration_key_types. * * Removed CalibrationExtraction. * * Removed CalibrationExtraction. * * Black lint * Update qiskit_experiments/calibration/calibration_key_types.py Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com> * * Added name for readability. * * Updated docstring. * Update qiskit_experiments/calibration/calibrations.py Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com> * * Updated default timestamp to now. * Update qiskit_experiments/calibration/calibrations.py Co-authored-by: Will Shanks <wshaos@posteo.net> * * Added an updater library. * * Made update methodology more permissible. * Reoved the previous update methodology. * * Black * * Moved methodology to class methods. * * Bug fixes, black, and lint. * * Qubits in Rabi. * Update qiskit_experiments/calibration/update_library.py Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com> * * Improved docstring. * Changed import order. * Renamed _update to _add_parameter_value. * Update qiskit_experiments/calibration/update_library.py Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com> * * Raise on Update instantiation. * * Moved cals update tests to their own library. * * Renamed test. * * Made _add_parameter_value a static method. * * Switched arguments order in update library. * * Added edgecase handling in the calibrations for parameter value adding. * _add_parameter_value is a classmethod again. * * Changed behaviour of get_parameter_value. * * Removed the adding of a microsecond. * * Test docstring fix. Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com> Co-authored-by: Will Shanks <wshaos@posteo.net>
Summary
This is a WIP PR to integrate calibration experiments with the
Calibrations. Alternatives are in PRs #80 and #79.Details and comments
In this PR we integrate the experiments and calibrations using an update method. The execution from the user's perspective is