Closed stavros11 closed 8 months ago
Actually, are you sure do we need to retain
setup()
? To the best of my knowledge:
- only the LO are using it
- most of the others are calling it empty in the docstring (Qblox, Zurich & RFSoC)
- some are even calling it deprecated (QM & RFSoC)
Actually also the Qblox modules are using the setup()
in order to cache the values loaded from the runcard.
- some are even calling it deprecated (QM & RFSoC)
Actually also the Qblox modules are using the
setup()
in order to cache the values loaded from the runcard.
And also in QM it is used as of #733, not in the Controller
but in the individual devices (OPX/Octave), which is essentially similar structure with the Qblox modules.
The thing is that we need a way to deserialize the instruments
section of the runcard YAML and because the options there are instrument dependent most likely this needs to be an instrument method. Actually, we will also probably need the inverse of this (instrument.dump()
) which will serialize the settings, but I left its implementation for later.
It does not appear in Zurich because it is still following the old approach of hard-coding instrument settings in the create
method:
https://github.com/qiboteam/qibolab/blob/cc8a1b46754f91d3fc80cef00f941575f1f0f223/tests/dummy_qrc/zurich.py#L131
and maybe RFSoC does not need any instrument settings (that could be calibrated).
Attention: 16 lines
in your changes are missing coverage. Please review.
Comparison is base (
9745314
) 62.00% compared to head (fc55f79
) 62.68%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Actually, we will also probably need the inverse of this (
instrument.dump()
) which will serialize the settings, but I left its implementation for later.
These could be .load()
and .dump()
(like in json
stdlib module, and also PyYAML and many others), but I thought that most of it was handled by the ...Settings
classes, and thus being done during instantiation of the instruments (i.e. during __init__
, and uplaoded during connect
, rather than in a separate stage).
These could be
.load()
and.dump()
(like injson
stdlib module, and also PyYAML and many others), but I thought that most of it was handled by the...Settings
classes, and thus being done during instantiation of the instruments (i.e. during__init__
, and uplaoded duringconnect
, rather than in a separate stage).
Then I will rename setup()
to load()
to avoid confusion with the old setup()
.
Settings are indeed uploaded during connect
but loaded (from the runcard dict to the instrument object) using serialize.load_instrument_settings
which uses instrument.setup
. Handling in the Settings
classes is not possible, because for example for Qblox, settings look like:
module_name:
port_ name:
setting_name: setting_value
so Settings
are in the inner layer and do not have information about the ports. So it is probably more convenient to load at the module/instrument level (@PiergiorgioButtarini let us know if you have any input).
Loading in __init__
is also possible, but I am afraid that then initialization will become more complex (we are already passing addresses and names) so it may be easier to have a separate load/dump mechanism.
Settings are indeed uploaded during
connect
but loaded (from the runcard dict to the instrument object) usingserialize.load_instrument_settings
which usesinstrument.setup
. Handling in theSettings
classes is not possible, because for example for Qblox, settings look like:
I was imagining (and them proposing) __init__
, not anything else (so ...Settings
should have been used in there).
Loading in
__init__
is also possible, but I am afraid that then initialization will become more complex (we are already passing addresses and names) so it may be easier to have a separate load/dump mechanism.
The idea was just to pass the corresponding runcard section, and deserializing the Settings
inside, rather than outside. But I'm open for discussion about this, I'm not so strongly opinionated.
Qblox and Zurich qpu tests are now passing on this branch. As soon as the CI passes, I will merge this.
Fixes #673. In the end I kept
platform.connect()
andplatform.disconnect()
and the same for instruments. I also keptinstrument.setup
because it is used for loading the settings from the runcard (in serialize.py), however I removedplatform.setup()
as the loading of settings happens in the platform creation.Since we are breaking the interface anyway, I also removed some
set_*
/get_*
methods from the platform as they are not used much in qibocal anymore (with a very small exception) and the SPI driver as we have not used it for very long time and the driver may be outdated anyway (if we need it we can go back to the latest tag).Some small updates in qibocal and qibolab_platforms_qrc are needed after merging this PR!
Checklist: