-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Fix custom pulse instruction conversion to Qobj. #11829
Conversation
One or more of the the following people are requested to review this:
|
Pull Request Test Coverage Report for Build 7964805348Details
💛 - Coveralls |
As a side note, I think this bug highlights some deficiencies in the tests. We should probably beef up the tests there, but I didn't want to tie it up with the fix. |
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.
Nice fix, @TsafrirA. I just had some wording suggestions for the release notes.
We are trying to move away from Qobj any way, but it might be worth adding a custom pulse shape to this test or one like it:
qiskit/test/python/compiler/test_assembler.py
Lines 502 to 519 in 12f24a7
def test_pulse_gates_single_circ(self): | |
"""Test that we can add calibrations to circuits.""" | |
theta = Parameter("theta") | |
circ = QuantumCircuit(2) | |
circ.h(0) | |
circ.append(RxGate(3.14), [0]) | |
circ.append(RxGate(theta), [1]) | |
circ = circ.assign_parameters({theta: 3.14}) | |
with pulse.build() as custom_h_schedule: | |
pulse.play(pulse.library.Drag(50, 0.15, 4, 2), pulse.DriveChannel(0)) | |
with pulse.build() as x180: | |
pulse.play(pulse.library.Gaussian(50, 0.2, 5), pulse.DriveChannel(1)) | |
circ.add_calibration("h", [0], custom_h_schedule) | |
circ.add_calibration(RxGate(3.14), [0], x180) | |
circ.add_calibration(RxGate(3.14), [1], x180) |
releasenotes/notes/fix-custom-pulse-qobj-conversion-5d6041b36356cfd1.yaml
Outdated
Show resolved
Hide resolved
…56cfd1.yaml Co-authored-by: Will Shanks <wshaos@posteo.net>
Thanks @wshanks! I added a test to cover something like this. |
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.
Looks good!
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.
Thanks for the quick fix!
* Possible fix. * Update releasenotes/notes/fix-custom-pulse-qobj-conversion-5d6041b36356cfd1.yaml Co-authored-by: Will Shanks <wshaos@posteo.net> * release notes fix * Add test --------- Co-authored-by: Will Shanks <wshaos@posteo.net> (cherry picked from commit 060cb70)
* Possible fix. * Update releasenotes/notes/fix-custom-pulse-qobj-conversion-5d6041b36356cfd1.yaml Co-authored-by: Will Shanks <wshaos@posteo.net> * release notes fix * Add test --------- Co-authored-by: Will Shanks <wshaos@posteo.net> (cherry picked from commit 060cb70) Co-authored-by: TsafrirA <113579969+TsafrirA@users.noreply.github.com>
Summary
This is a possible fix to #11828.
Details and comments
The behavior of ParametricPulseShapes is restored to raise
ValueError
when the pulse shape is not supported, andQiskitError
when the pulse object is not recognized. The need for the second scenario is not clear to me, but as a quick fix I reverted to the code before #11410.If we think that the two error types are not needed, we can alternatively change the error type used by the assemble logic.
fixes #11828