Skip to content

Spectroscopy and calibrations integration V3#88

Merged
eggerdj merged 47 commits into
qiskit-community:mainfrom
eggerdj:calibrations_spec_integration_v3
Jun 23, 2021
Merged

Spectroscopy and calibrations integration V3#88
eggerdj merged 47 commits into
qiskit-community:mainfrom
eggerdj:calibrations_spec_integration_v3

Conversation

@eggerdj
Copy link
Copy Markdown
Contributor

@eggerdj eggerdj commented Jun 7, 2021

  • Added required functionality to update spectroscopy.

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

spec = QubitSpectroscopy(3)
spec_data = spec.run()
calibrations.update(spec_data)

eggerdj added 2 commits June 7, 2021 17:25
Copy link
Copy Markdown
Collaborator

@nkanazawa1989 nkanazawa1989 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread qiskit_experiments/calibration/calibrations.py Outdated
Comment thread qiskit_experiments/calibration/calibrations.py Outdated
Comment thread qiskit_experiments/calibration/calibrations.py Outdated
Comment thread qiskit_experiments/calibration/calibrations.py Outdated
Comment thread qiskit_experiments/characterization/qubit_spectroscopy.py Outdated
Comment thread qiskit_experiments/calibration/calibration_types.py
Comment thread qiskit_experiments/calibration/calibration_extraction.py Outdated
@eggerdj eggerdj added this to the Release 1 milestone Jun 14, 2021
Copy link
Copy Markdown
Collaborator

@nkanazawa1989 nkanazawa1989 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this PR is in good shape. Few minor comments but these don't block merging.

Comment thread qiskit_experiments/calibration/backend_calibrations.py Outdated
Comment thread qiskit_experiments/calibration/calibration_key_types.py
Comment thread qiskit_experiments/calibration/calibrations.py Outdated
Comment thread qiskit_experiments/calibration/calibrations.py Outdated
Comment thread qiskit_experiments/calibration/calibrations.py Outdated
Comment thread qiskit_experiments/calibration/calibrations.py Outdated
Comment thread qiskit_experiments/characterization/qubit_spectroscopy.py Outdated
Comment thread qiskit_experiments/characterization/t1_experiment.py
@eggerdj eggerdj changed the title [WIP] Spectroscopy and calibrations integration V3 Spectroscopy and calibrations integration V3 Jun 15, 2021
Comment thread qiskit_experiments/calibration/calibrations.py Outdated
Comment thread qiskit_experiments/calibration/update_library.py Outdated
Comment thread qiskit_experiments/calibration/update_library.py Outdated
eggerdj and others added 2 commits June 22, 2021 08:43
Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
* Changed import order.
* Renamed _update to _add_parameter_value.
Copy link
Copy Markdown
Collaborator

@nkanazawa1989 nkanazawa1989 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread qiskit_experiments/calibration/update_library.py Outdated
Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
@eggerdj
Copy link
Copy Markdown
Contributor Author

eggerdj commented Jun 22, 2021

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.

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 Amplitude.

Copy link
Copy Markdown
Collaborator

@wshanks wshanks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 classmethod usage in the updaters. I think classmethods 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. Maybe BaseUpdater.__init__ could raise an exception stating that updaters are not meant to be instantiated?

@nkanazawa1989
Copy link
Copy Markdown
Collaborator

I think these are reasonable suggestions and worth considering.

Comment thread qiskit_experiments/calibration/update_library.py
@eggerdj eggerdj merged commit c2aa037 into qiskit-community:main Jun 23, 2021
@eggerdj eggerdj deleted the calibrations_spec_integration_v3 branch June 23, 2021 17:34
paco-ri pushed a commit to paco-ri/qiskit-experiments that referenced this pull request Jul 11, 2022
* * 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants