Skip to content
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

Instruments section in runcard #585

Merged
merged 6 commits into from
Sep 26, 2023
Merged

Instruments section in runcard #585

merged 6 commits into from
Sep 26, 2023

Conversation

stavros11
Copy link
Member

@stavros11 stavros11 commented Sep 20, 2023

Fix #576. Needed for qibocal routines that update instrument (not qubit) parameters, such as the TWPA calibration. It is also useful to dump some instrument settings (LO frequency, etc.) in the runcard so that we can keep them in record. qibolab_platforms_qrc also needs to be updated for this to work.

@rodolfocarobene can you please confirm that my change in

lo_frequency = getattr(qubits[pulse.qubit], pulse_type).local_oscillator.frequency

is okay?

Checklist:

  • Reviewers confirm new code works as expected.
  • Tests are passing.
  • Coverage does not decrease.
  • Documentation is updated.

@codecov
Copy link

codecov bot commented Sep 20, 2023

@rodolfocarobene
Copy link
Contributor

Hi @stavros11, I used the private property to avoid multiple connections to the local oscillators. I think that the problem is still there, right?

@property
def frequency(self):
if self.is_connected:
if self.ethernet:
return int(self._get("frequency"))
return self.device.get("frequency")
return self.settings.frequency

@stavros11
Copy link
Member Author

Hi @stavros11, I used the private property to avoid multiple connections to the local oscillators. I think that the problem is still there, right?

Good point, thanks @rodolfocarobene. I changed the R&S and ERA drivers to return the cached values, instead of getting from the instrument every time. This is simpler and should have the same behavior if the setter is implemented properly.

@stavros11 stavros11 requested review from Edoardo-Pedicillo and removed request for rodolfocarobene September 21, 2023 06:48
Copy link
Contributor

@andrea-pasquale andrea-pasquale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @stavros11 for implementing this.
I did not test it yet but it looks good to me.
I will approve as soon as I test the PR.

@stavros11 stavros11 mentioned this pull request Sep 22, 2023
4 tasks
@stavros11 stavros11 added this to the Qibolab 0.1.2 milestone Sep 22, 2023
Copy link
Contributor

@andrea-pasquale andrea-pasquale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @stavros11. I tested it on hardware and it seems to work as expected.

Copy link
Member

@alecandido alecandido left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the minimal approach, and I see no problem in the implementation. Please, keep going :)

@dataclass
class LocalOscillatorSettings(InstrumentSettings):
power: Optional[float] = None
frequency: Optional[float] = None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stavros11 are them really optional?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stavros11 are them really optional?

They are needed for execution. However, we initialize them as None so that we can instantiate the instrument without passing them in the platform create methods and assign their values later using instrument.setup (or the setters) after loading the runcard.

In principle we could initialize the instrument with self.settings = None and then instantiate settings when setup or the setters are called, but it is almost the same and maybe slightly more complicated in terms of implementation.

Copy link
Member

@alecandido alecandido Sep 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the one side, I'd agree with you for the current case. But if we had many more settings, the current one is scaling bad (you need linearly more code), while your second solution does not scale at all :)
(i.e. the second solution has arguably a constant overhead, or linearly less than the other one)

@stavros11 stavros11 merged commit 18cf322 into main Sep 26, 2023
20 checks passed
@stavros11 stavros11 deleted the instruments-runcard branch September 26, 2023 09:00
stavros11 added a commit to qiboteam/qibolab_platforms_qrc that referenced this pull request Sep 26, 2023
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.

Expose TWPA parameters in runcard
4 participants