Skip to content

Update config access in calculate_channel_frequencies#742

Merged
chriseclectic merged 8 commits into
Qiskit:masterfrom
mtreinish:fix-dict-access-pulse
May 15, 2020
Merged

Update config access in calculate_channel_frequencies#742
chriseclectic merged 8 commits into
Qiskit:masterfrom
mtreinish:fix-dict-access-pulse

Conversation

@mtreinish
Copy link
Copy Markdown
Member

@mtreinish mtreinish commented May 10, 2020

Summary

In #695 we updated the usage of the backend configuration to avoid
to_dict() and dict based access. All the access was supposed to be
updated to be class attribute based instead. However that PR neglected
to update the usage of the calculate_channel_frequencies method. This is
causing an error when using the method now. This commit corrects the
oversight and adds a unit test covering running that method when
building a pulse system model from a backend to avoid this in the
future.

Details and comments

Fixes #741
Co-authored-by: Daniel Puzzuoli dan.puzzuoli@gmail.com

In Qiskit#695 we updated the usage of the backend configuration to avoid
to_dict() and dict based access. All the access was supposed to be
updated to be class attribute based instead. However that PR neglected
to update the usage of the calculate_channel_frequencies method. This is
causing an error when using the method now. This commit corrects the
oversight and adds a unit test covering running that method when
building a pulse system model from a backend to avoid this in the
future.

Fixes Qiskit#741
@DanPuzzuoli
Copy link
Copy Markdown
Contributor

@mtreinish thanks for these updates.

There are actually a couple of other files that need updating - the system_models/duffing_model_generators.py and the corresponding tests are still in the dict format. No errors are being raised in the tests as no computations on the frequencies are being called.

I'll update these files and also add a test that would have caught this, then open a PR to your branch.

@DanPuzzuoli
Copy link
Copy Markdown
Contributor

I've just implemented the changes from the previous comments and have opened a PR to this branch @mtreinish

mtreinish added 2 commits May 11, 2020 15:45
Additional fix dict updates

Made the following changes:

- Further updates to duffing_model_generators and corresponding tests to switch over to using UchannelLO instead of the dictionary version.
- Added additional test in test_duffing_model_generators to call PulseSystemModel.calculate_channel_frequencies - this test will now catch any errors resulting from duffing_model_generators using an invalid format for specifying u channel los.
- Fixed a bug found in writing the above test: in duffing_model_generators, if a coupling strength was 0.0 it would cause an error as it was ultimately being input as None when compiling the PulseSystemModel object, due to incorrect use of python's or function.
- Modified a couple parts of @mtreinish 's PR to directly construct UchannelLO objects (as opposed to using the from_dict method.
Copy link
Copy Markdown
Contributor

@DanPuzzuoli DanPuzzuoli 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 now covers all necessary changes to resolve this issue.

@chriseclectic chriseclectic merged commit 22901a0 into Qiskit:master May 15, 2020
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.

Pulse system model incosistently using dict based access

3 participants