From d459ddc9ea2330204eacd0b67a06f67ba87f0cf3 Mon Sep 17 00:00:00 2001 From: Stavros Efthymiou <35475381+stavros11@users.noreply.github.com> Date: Wed, 10 Jan 2024 14:02:57 +0400 Subject: [PATCH] docs: Fix doctests and warnings --- doc/source/main-documentation/qibolab.rst | 9 ++++----- doc/source/tutorials/instrument.rst | 2 +- doc/source/tutorials/transpiler.rst | 4 ++-- src/qibolab/channels.py | 9 +++------ src/qibolab/couplers.py | 4 ++-- src/qibolab/instruments/port.py | 7 +------ src/qibolab/instruments/qblox/controller.py | 4 ++-- 7 files changed, 15 insertions(+), 24 deletions(-) diff --git a/doc/source/main-documentation/qibolab.rst b/doc/source/main-documentation/qibolab.rst index 3d919d623c..ad2c467d1b 100644 --- a/doc/source/main-documentation/qibolab.rst +++ b/doc/source/main-documentation/qibolab.rst @@ -201,9 +201,9 @@ Note that while channels are defined in a device-independent manner, the port pa from qibolab.instruments.rfsoc import RFSoC controller = RFSoC(name="dummy", address="192.168.0.10", port="6000") - channel1 = Channel("my_channel_name_1", port=controller[1]) - channel2 = Channel("my_channel_name_2", port=controller[2]) - channel3 = Channel("my_channel_name_3", port=controller[3]) + channel1 = Channel("my_channel_name_1", port=controller.ports(1)) + channel2 = Channel("my_channel_name_2", port=controller.ports(2)) + channel3 = Channel("my_channel_name_3", port=controller.ports(3)) Channels are then organized in :class:`qibolab.channels.ChannelMap` to be passed as a single argument to the platform. Following the tutorial in :doc:`/tutorials/lab`, we can continue the initialization: @@ -704,13 +704,12 @@ Controllers (subclasses of :class:`qibolab.instruments.abstract.Controller`): - Dummy Instrument: :class:`qibolab.instruments.dummy.DummyInstrument` - Zurich Instruments: :class:`qibolab.instruments.zhinst.Zurich` - Quantum Machines: :class:`qibolab.instruments.qm.driver.QMOPX` - - Qblox: :class:`qibolab.instruments.qblox.cluster.Cluster` + - Qblox: :class:`qibolab.instruments.qblox.controller.QbloxCluster` - Xilinx RFSoCs: :class:`qibolab.instruments.rfsoc.driver.RFSoC` Other Instruments (subclasses of :class:`qibolab.instruments.abstract.Instrument`): - Erasynth++: :class:`qibolab.instruments.erasynth.ERA` - RohseSchwarz SGS100A: :class:`qibolab.instruments.rohde_schwarz.SGS100A` - - Qutech SPI rack: :class:`qibolab.instruments.qutech.SPI` Instruments all implement a set of methods: diff --git a/doc/source/tutorials/instrument.rst b/doc/source/tutorials/instrument.rst index 783470c813..40fe602730 100644 --- a/doc/source/tutorials/instrument.rst +++ b/doc/source/tutorials/instrument.rst @@ -189,7 +189,7 @@ write something like this: instrument = DummyInstrument("my_instrument", "0.0.0.0:0") channels = ChannelMap() - channels |= Channel("ch1out", port=instrument["o1"]) + channels |= Channel("ch1out", port=instrument.ports("o1")) The interesting part of this section is the ``port`` parameter that works as an diff --git a/doc/source/tutorials/transpiler.rst b/doc/source/tutorials/transpiler.rst index bc31caea63..5b06086ddd 100644 --- a/doc/source/tutorials/transpiler.rst +++ b/doc/source/tutorials/transpiler.rst @@ -64,14 +64,14 @@ Instead of completely disabling, custom transpilation steps can be given: Now circuits will only be transpiled to native gates, without any connectivity matching steps. -The :class:`qibolab.transpilers.gate_decompositions.NativeGates` transpiler used in this example assumes Z, RZ, GPI2 or U3 as the single-qubit native gates, and supports CZ and iSWAP as two-qubit natives. +The transpiler used in this example assumes Z, RZ, GPI2 or U3 as the single-qubit native gates, and supports CZ and iSWAP as two-qubit natives. In this case we restricted the two-qubit gate set to CZ only. If the circuit to be executed contains gates that are not included in this gate set, they will be transformed to multiple gates from the gate set. Arbitrary single-qubit gates are typically transformed to U3. Arbitrary two-qubit gates are transformed to two or three CZ gates following their `universal CNOT decomposition `_. The decomposition of some common gates such as the SWAP and CNOT is hard-coded for efficiency. -Multiple transpilation steps can be implemented using the :class:`qibolab.transpilers.pipeline.Pipeline`: +Multiple transpilation steps can be implemented using the transpiler ``Passes``: .. testcode:: python diff --git a/src/qibolab/channels.py b/src/qibolab/channels.py index 9d934f6d1f..b9b7f0d227 100644 --- a/src/qibolab/channels.py +++ b/src/qibolab/channels.py @@ -127,12 +127,9 @@ class ChannelMap: def add(self, *items): """Add multiple items to the channel map. - If - :class: `qibolab.channels.Channel` objects are given they are - added to the channel map. If a different type is - given, a - :class: `qibolab.channels.Channel` with the corresponding name - is created and added to the channel map. + If :class: `qibolab.channels.Channel` objects are given they are dded to the channel map. + If a different type is given, a :class: `qibolab.channels.Channel` with the corresponding name + is created and added to the channel map. """ for item in items: if isinstance(item, Channel): diff --git a/src/qibolab/couplers.py b/src/qibolab/couplers.py index d05563e937..8f1884dda9 100644 --- a/src/qibolab/couplers.py +++ b/src/qibolab/couplers.py @@ -13,8 +13,8 @@ class Coupler: """Representation of a physical coupler. Coupler objects are instantiated by - :class: `qibolab.platforms.platform.Platform` but they are - passed to instrument designs in order to play pulses. + :class: `qibolab.platforms.platform.Platform` + and are passed to instruments to play pulses on them. """ name: QubitId diff --git a/src/qibolab/instruments/port.py b/src/qibolab/instruments/port.py index 51aecff6a8..09f7860971 100644 --- a/src/qibolab/instruments/port.py +++ b/src/qibolab/instruments/port.py @@ -35,9 +35,4 @@ class Port: instruments).""" filters: dict """Filters to be applied to the channel to reduce the distortions when - sending flux pulses. - - Useful for two-qubit gates. Quantum Machines ( - :class: `qibolab.instruments.qm.QMOPX`) associate filters to - channels but this may not be the case in other instruments. - """ + sending flux pulses.""" diff --git a/src/qibolab/instruments/qblox/controller.py b/src/qibolab/instruments/qblox/controller.py index 147eea885c..4c1325a1d9 100644 --- a/src/qibolab/instruments/qblox/controller.py +++ b/src/qibolab/instruments/qblox/controller.py @@ -76,9 +76,9 @@ def disconnect(self): def setup(self): """Empty method to comply with Instrument interface. - Setup of the modules happens in the create method: - >>> instruments = load_instrument_settings(runcard, instruments) + Setup of the modules happens in the platform ``create`` method + using :meth:`qibolab.serialize.load_instrument_settings`. """ def _termination_handler(self, signum, frame):