-
Notifications
You must be signed in to change notification settings - Fork 127
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
Attach calibrations for gates used in calibration experiments #1160
Attach calibrations for gates used in calibration experiments #1160
Conversation
Previously EFRoughXSXAmplitudeCal and FineXDragCal only attached the calibrations for the gates being calibrated by the experiments, not the calibrations for the other gates used by the experiments.
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. Looks like this fixes and omission of when we started attaching schedules. It makes sense to attach for all the gates. Can you answer the one question before I approve?
@@ -108,6 +108,10 @@ def _attach_calibrations(self, circuit: QuantumCircuit): | |||
"""Attach the calibrations to the circuit.""" | |||
schedule = self._cals.get_schedule(self._sched_name, self.physical_qubits) | |||
circuit.add_calibration(self._sched_name, self.physical_qubits, schedule) | |||
# FineDrag always uses sx so attach it if it is not sched_name | |||
if self._sched_name != "sx": |
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.
why not use has_template
here as below?
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, the purpose of this conditional is to avoid getting and attaching sx
twice when running the sx cal (since then the self._sched_name
call of add_calibration
just above would do it). I was thinking that otherwise you would always want sx
attached. We could make it provisional though but it would be
if self._sched_name != "sx": | |
if self._sched_name != "sx" and self.has_template("sx", self.physical_qubits): |
and not just
if self.has_template("sx", self.physical_qubits):
What do you think?
This kind of nuance was what was making me think that maybe we should try to use transpile()
with routing="none"
and translation="none"
rather than a custom pass manager and attaching the calibrations directly because then we could defer to the pulse gate pass whether or not to attach calibrations for other gates in the circuit besides the one being tested.
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.
This makes sense to me. We are essentially requiring that self._cals
contains the sx
gate. I think this is an okay assumption in a calibration context. My question would have perhaps been better placed on the rough_amplitude_cal.py file below. I can rephrase and ask: "Why use has_template
at all"? The code in rough_amplitude_cal.py seems more permissive by allowing that self._cals
to not contain an X
gate. Do we need the has_template
check?
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.
It's not a workflow we make easy, so maybe we should not make an allowance for it here, but I have heard from other users who are interested in working with qutrits and my thought was that users might want to calibrate sx12 and x12 but still just rely on the defaults for sx and x. What do you think?
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 makes perfect sense. Is that worth a comment in the code?
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. Perhaps add a comment on the has check?
### Summary Previously `EFRoughXSXAmplitudeCal` and `FineXDragCal` only attached the calibrations for the gates being calibrated by the experiments, not the calibrations for the other gates used by the experiments. (cherry picked from commit 2a77748)
#1160) (#1161) This is an automatic backport of pull request #1160 done by [Mergify](https://mergify.com). Co-authored-by: Will Shanks <willshanks@us.ibm.com>
Summary
Previously
EFRoughXSXAmplitudeCal
andFineXDragCal
only attached thecalibrations for the gates being calibrated by the experiments, not the
calibrations for the other gates used by the experiments.