Draft: Add distortion correction protocols
Explanation of changes
This MR adds different distortion correction protocols to Quantify.
- The previous
DistortionCorrection
class is renamed toSoftwareDistortionCorrection
. This is most likely not a breaking change provided only the old style hardware config is being used. - A
HardwareDistortionCorrection
class is introduced. This class is to be subclassed by the relevant hardware backends. - The Qblox backend introduces the
QbloxHardwareDistortionCorrection
class with the distortion correction parameters that will be set on Qblox hardware. - The conversion method a
HardwareCompilationConfig
to the old style hardware config is updated to be able to convert the above classes. - In the old style hardware config, the key
correction_type
is used to identify betweensoftware
orqblox
. If not provided, it is assumed to be software to maintain backwards compatibility. More correction types may be added in the future. The key for a hardware distortion correction will be of the form<cluster_name>.module<module_number>.real_output_<output_number>
. If the key is provided and a real output is not defined in the hardware config, no error or warning is thrown. Instead, it will only be applied on the output specified by the distortion corrections key. - During qblox's
hardware_compile
method, theapply_distortion_corrections
method is modified to only apply software corrections. - The compiler containers in the qblox backend now also pass
distortion_corrections
to the relevant instrument. If the instrument is a Cluster, the entire distortion corrections dictionary is passed along. If the instrument is a QCM, the relevant part of the distortions corrections dictionary is parsed and passed along. - A new
QcmSettings
class is defined for theQcmModule
compiler so it can hold these extra global settings. - The
prepare
method of theQcmModule
now also moves the distortion corrections to the compiler's_settings
object.
Note the actual settings that are sent to Qblox hardware might be modified. But the ground work here will be useful.
Motivation of changes
The motivation for choosing the key for the distortion corrections to be of the form <cluster_name>.module<module_number>.real_output_<output_number>
is because it is applied to a single real output in Qblox hardware. I originally wanted to apply it to a port, but a port is on the device, and multiple outputs could lead to the same port (perhaps through a power splitter or so).
Merge checklist
See also merge request guidelines
-
Merge request has been reviewed (in-depth by a knowledgeable contributor), and is approved by a project maintainer. -
New code is covered by unit tests (or N/A). -
New code is documented and docstrings use numpydoc format (or N/A). -
New functionality: considered making private instead of extending public API (or N/A). -
Public API changed: added @deprecated
(or N/A). -
Newly added/adjusted documentation and docstrings render properly (or N/A). -
Pipeline fix or dependency update: post in #software-for-developers
channel to mergemain
back in or update local packages (or N/A). -
Tested on hardware (or N/A). -
CHANGELOG.md
andAUTHORS.md
have been updated (or N/A). -
Windows tests in CI pipeline pass (manually triggered by maintainers before merging). - Maintainers do not hit Auto-merge, we need to actively check as manual tests do not block pipeline
For reference, the issues workflow is described in the contribution guidelines.
Edited by Rohit Navarathna