Skip to content

Avoid to_dict() when possible in pulse system model#695

Merged
chriseclectic merged 4 commits into
Qiskit:masterfrom
mtreinish:no-to-dict-pulse-system-model
Apr 14, 2020
Merged

Avoid to_dict() when possible in pulse system model#695
chriseclectic merged 4 commits into
Qiskit:masterfrom
mtreinish:no-to-dict-pulse-system-model

Conversation

@mtreinish
Copy link
Copy Markdown
Member

@mtreinish mtreinish commented Apr 14, 2020

Summary

As fall out from Qiskit/qiskit#4016 there was a bug in the
to_dict() method of the backend configuration that was resulting in
UChannelLO objects not getting converted to their dict form in the
output of to_dict(). While this is being fixed in
Qiskit/qiskit#4124 this commit side steps the issue by adapting
the access patterns in the pulse system model to rely on class attribute
access and getattr() instead of dict access and get().

Details and comments

This is an alternative to the fix from a combination of #694 and Qiskit/qiskit#4124

As fall out from Qiskit/qiskit#4016 there was a bug in the
to_dict() method of the backend configuration that was resulting in
UChannelLO objects not getting converted to their dict form in the
output of to_dict(). While this is being fixed in
Qiskit/qiskit#4124 this commit side steps the issue by adapting
the access patterns in the pulse system model to rely on class attribute
access and getattr() instead of dict access and get().
@mtreinish mtreinish force-pushed the no-to-dict-pulse-system-model branch from 8bbb4d5 to f8fa61f Compare April 14, 2020 12:18
Comment thread qiskit/providers/aer/pulse/pulse_system_model.py Outdated
Comment thread qiskit/providers/aer/pulse/pulse_system_model.py Outdated
Comment thread qiskit/providers/aer/pulse/pulse_system_model.py Outdated
@chriseclectic chriseclectic added the stable-backport-potential The issue or PR might be minimal and/or import enough to backport to stable label Apr 14, 2020
@chriseclectic chriseclectic merged commit 579fdce into Qiskit:master Apr 14, 2020
@mtreinish mtreinish deleted the no-to-dict-pulse-system-model branch April 14, 2020 20:35
hhorii pushed a commit to hhorii/qiskit-aer that referenced this pull request Apr 16, 2020
* Avoid to_dict() when possible in pulse system model

As fall out from Qiskit/qiskit#4016 there was a bug in the
to_dict() method of the backend configuration that was resulting in
UChannelLO objects not getting converted to their dict form in the
output of to_dict(). While this is being fixed in
Qiskit/qiskit#4124 this commit side steps the issue by adapting
the access patterns in the pulse system model to rely on class attribute
access and getattr() instead of dict access and get().

Co-authored-by: Christopher J. Wood <cjwood@us.ibm.com>
@chriseclectic chriseclectic added this to the Aer 0.5.1 milestone Apr 20, 2020
chriseclectic added a commit to chriseclectic/qiskit-aer that referenced this pull request Apr 20, 2020
* Avoid to_dict() when possible in pulse system model

As fall out from Qiskit/qiskit#4016 there was a bug in the
to_dict() method of the backend configuration that was resulting in
UChannelLO objects not getting converted to their dict form in the
output of to_dict(). While this is being fixed in
Qiskit/qiskit#4124 this commit side steps the issue by adapting
the access patterns in the pulse system model to rely on class attribute
access and getattr() instead of dict access and get().

Co-authored-by: Christopher J. Wood <cjwood@us.ibm.com>
mtreinish added a commit to mtreinish/qiskit-aer that referenced this pull request May 10, 2020
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
chriseclectic pushed a commit that referenced this pull request May 15, 2020
* Update config access in calculate_channel_frequencies

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.

Fixes #741

* updated duffing_model_generators.py and corresponding tests to new UchannelLO object (instead of dict)

* added test for duffing_model_generators including doing channel frequency calculations in resulting system_model to catch any formatting issues

Co-authored-by: Daniel Puzzuoli <dan.puzzuoli@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stable-backport-potential The issue or PR might be minimal and/or import enough to backport to stable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants