-
Notifications
You must be signed in to change notification settings - Fork 126
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
Removing complex values support from Calibrations #1067
Removing complex values support from Calibrations #1067
Conversation
Regarding deprecation warnings, I have not seen much community use of Calibrations so far, so I would not put too much effort into backwards compatibility or a transition period. Some things that could be done:
|
…qiskit-experiments into AmpAngleSymbolicPulses
…into AmpAngleSymbolicPulses � Conflicts: � test/calibration/test_setup_library.py
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 @TsafrirA , this PR looks great. I really wanted to upgrade library pulses before terra 0.25 which we start actual deprecation for complex parameters.
|
||
if self._link_parameters: | ||
y_amp, y_beta = 1.0j * x_amp, x_beta | ||
y_amp, y_beta, y_angle = x_amp, x_beta, x_angle + np.pi / 2 |
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.
I think angle must be separated to cope with mixer skew, i.e. angle difference is not exactly pi/2. So they should have independent angles but default value can be angle + pi/2 for y gate. Please confirm @wshanks
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.
We could do that, but I think that would contradict the logic which was in place before. If the amplitudes were linked, then the angles were also linked in the previous implementation. Linking the angles will preserve the previous logic. This doesn't mean that the previous logic is bullet-proof. What do you think @wshanks ?
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.
That's fair point. Since (sx, rz, cx) are enough to compose a universal set, I think experimentalist who requested sy to the library wants to correct for the mixer skew. But we can keep the logical change minimum and do this in the follow up.
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.
Hmm, I think mixer skew is a lower level concern that we don't need to worry about too much in the qiskit layer where some details about the signal generation hardware are abstracted. If a user is worried about it, they could choose not to link the parameters. Perhaps a user would like to link amp but not angle...we can wait until someone requests that.
The main thing regarding angle is that sx and x can have different angles to account for non-linearity in the mixer or other components.
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.
I think this is fine. The user has the option to unlink the parameters and therefore has full flexibility. We could be more granular as to what parameters we link and do not link but I would not go down that rabbit hole here.
qiskit_experiments/calibration_management/basis_gate_library.py
Outdated
Show resolved
Hide resolved
releasenotes/notes/adjust-symbolic-pulses-amp-angle-representation-f5c40007416cf938.yaml
Outdated
Show resolved
Hide resolved
releasenotes/notes/adjust-symbolic-pulses-amp-angle-representation-f5c40007416cf938.yaml
Outdated
Show resolved
Hide resolved
releasenotes/notes/adjust-symbolic-pulses-amp-angle-representation-f5c40007416cf938.yaml
Outdated
Show resolved
Hide resolved
releasenotes/notes/adjust-symbolic-pulses-amp-angle-representation-f5c40007416cf938.yaml
Show resolved
Hide resolved
…tion-f5c40007416cf938.yaml Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
…tion-f5c40007416cf938.yaml Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
…tion-f5c40007416cf938.yaml Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
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 @TsafrirA this looks almost good to me. Minor comments for docs. If you are happy with them I'll merge this PR. We can come back to handling of sy angle link in future.
releasenotes/notes/adjust-symbolic-pulses-amp-angle-representation-f5c40007416cf938.yaml
Outdated
Show resolved
Hide resolved
Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
…tion-f5c40007416cf938.yaml Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
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.
|
||
if self._link_parameters: | ||
y_amp, y_beta = 1.0j * x_amp, x_beta | ||
y_amp, y_beta, y_angle = x_amp, x_beta, x_angle + np.pi / 2 |
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.
Hmm, I think mixer skew is a lower level concern that we don't need to worry about too much in the qiskit layer where some details about the signal generation hardware are abstracted. If a user is worried about it, they could choose not to link the parameters. Perhaps a user would like to link amp but not angle...we can wait until someone requests that.
The main thing regarding angle is that sx and x can have different angles to account for non-linearity in the mixer or other components.
from qiskit_experiments.test.pulse_backend import SingleTransmonTestBackend | ||
|
||
|
||
class TestHalfAngleCal(QiskitExperimentsTestCase): |
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.
Out of scope for this PR, but it would be good to have a basic test of the class working.
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.
I agree, I already opened an issue - #1123 .
releasenotes/notes/adjust-symbolic-pulses-amp-angle-representation-f5c40007416cf938.yaml
Outdated
Show resolved
Hide resolved
releasenotes/notes/adjust-symbolic-pulses-amp-angle-representation-f5c40007416cf938.yaml
Outdated
Show resolved
Hide resolved
releasenotes/notes/adjust-symbolic-pulses-amp-angle-representation-f5c40007416cf938.yaml
Show resolved
Hide resolved
releasenotes/notes/adjust-symbolic-pulses-amp-angle-representation-f5c40007416cf938.yaml
Outdated
Show resolved
Hide resolved
releasenotes/notes/adjust-symbolic-pulses-amp-angle-representation-f5c40007416cf938.yaml
Outdated
Show resolved
Hide resolved
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.
LGTM. Minor comments only.
|
||
if self._link_parameters: | ||
y_amp, y_beta = 1.0j * x_amp, x_beta | ||
y_amp, y_beta, y_angle = x_amp, x_beta, x_angle + np.pi / 2 |
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.
I think this is fine. The user has the option to unlink the parameters and therefore has full flexibility. We could be more granular as to what parameters we link and do not link but I would not go down that rabbit hole here.
…tion-f5c40007416cf938.yaml Co-authored-by: Will Shanks <wshaos@posteo.net>
…tion-f5c40007416cf938.yaml Co-authored-by: Will Shanks <wshaos@posteo.net>
Co-authored-by: Will Shanks <wshaos@posteo.net>
…tion-f5c40007416cf938.yaml Co-authored-by: Will Shanks <wshaos@posteo.net>
Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>
Co-authored-by: Will Shanks <wshaos@posteo.net>
…tion-f5c40007416cf938.yaml Co-authored-by: Will Shanks <wshaos@posteo.net>
…tion-f5c40007416cf938.yaml Co-authored-by: Will Shanks <wshaos@posteo.net>
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! I just suggested one small grammar change.
I wonder if we should have a release note when we increase the minimum version of terra?
releasenotes/notes/adjust-symbolic-pulses-amp-angle-representation-f5c40007416cf938.yaml
Outdated
Show resolved
Hide resolved
Oops, in my last comment, I meant "release note", not "release" (I edited it now but I am just commenting since the meaning is so different). |
…tion-f5c40007416cf938.yaml Co-authored-by: Will Shanks <wshaos@posteo.net>
releasenotes/notes/adjust-symbolic-pulses-amp-angle-representation-f5c40007416cf938.yaml
Outdated
Show resolved
Hide resolved
releasenotes/notes/adjust-symbolic-pulses-amp-angle-representation-f5c40007416cf938.yaml
Outdated
Show resolved
Hide resolved
…tion-f5c40007416cf938.yaml Co-authored-by: Will Shanks <wshaos@posteo.net>
…tion-f5c40007416cf938.yaml Co-authored-by: Will Shanks <wshaos@posteo.net>
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.
LGTM.
Summary
This PR aims to remove the use of complex amplitude for
SymbolicPulse
in calibration experiments. Most notable changes are to theHalfAngleCal
experiment and theFixedFrquencyTransmon
library. With these changes, support of complex values in general raises aPendingDeprecationWarning
.Details and comments
Qiskit Terra recently changed the representation of
SymbolicPulse
from complex amplitude to (amp
,angle
). Once the deprecation is completed, some calibration experiments will fail. Additionally, assignment of complex parameters in general has caused problems recently (See Qiskit-Terra issue 9187), and is also being phased out (See Qiskit-Terra PR 9735).Most calibration experiments are oblivious to these changes, with the exception of
HalfAngleCal
andRoughAmplitudeCal
. The libraryFixedFrequencyTransmon
also has to conform with the new representation.To create as little breaking changes as possible, the following were changed:
FixedFrequencyTransmon
library was converted to the new representation. All experiments will work as they have been with it.RoughAmplitudeCal
was changed such that it will work for both real or complexamp
, without changing the type of the value.HalfAngleCal
was changed to calibrate 'angle' instead of the complex amplitude. A user which uses theFixedFrequencyTransmon
library will experience no change (except for the added parameters). A user which uses custom built schedules will experience an error. To simplify the transition, most likely scenarios (schedule with noangle
parameter,cal_parameter_name="amp"
) will raise an informative error with explanation about the needed changes.A
PendingDeprecationWarning
is raised with every initialization ofParameterValue
with complex type value (which also covers addition of parameter value to a calibration). Note that Qiskit-Terra PR 9897 will also raise a warning from the Terra side, for all assignment of complex parameters.Handling of loaded calibrations which do not conform to the new representation will be sorted out once PR #1120 is merged, as it introduces a major change in calibration loading.