Skip to content

Commit

Permalink
docs: Fix doctests and warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
stavros11 committed Jan 10, 2024
1 parent d881d1f commit d459ddc
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 24 deletions.
9 changes: 4 additions & 5 deletions doc/source/main-documentation/qibolab.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:

Expand Down
2 changes: 1 addition & 1 deletion doc/source/tutorials/instrument.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions doc/source/tutorials/transpiler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://arxiv.org/abs/quant-ph/0307177>`_.
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

Expand Down
9 changes: 3 additions & 6 deletions src/qibolab/channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions src/qibolab/couplers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 1 addition & 6 deletions src/qibolab/instruments/port.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
4 changes: 2 additions & 2 deletions src/qibolab/instruments/qblox/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit d459ddc

Please sign in to comment.