Skip to content

Commit

Permalink
Merge pull request #972 from qiboteam/remove-characterization
Browse files Browse the repository at this point in the history
Remove characterization
  • Loading branch information
stavros11 authored Aug 13, 2024
2 parents 0d5b313 + af0d7f9 commit 038304c
Show file tree
Hide file tree
Showing 23 changed files with 271 additions and 900 deletions.
22 changes: 0 additions & 22 deletions doc/source/getting-started/experiment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -180,28 +180,6 @@ And the we can define the runcard ``my_platform/parameters.json``:
}
},
"two_qubits": {}
},
"characterization": {
"single_qubit": {
"0": {
"anharmonicity": 0,
"Ec": 0,
"Ej": 0,
"g": 0,
"T1": 0.0,
"T2": 0.0,
"threshold": 0.0,
"iq_angle": 0.0,
"mean_gnd_states": [
0.0,
0.0
],
"mean_exc_states": [
0.0,
0.0
]
}
}
}
}
Expand Down
78 changes: 9 additions & 69 deletions doc/source/tutorials/lab.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ How to define a platform for a self-hosted QPU?
The :class:`qibolab.platform.Platform` object holds all the information required
to execute programs, and in particular :class:`qibolab.pulses.PulseSequence` in
a real QPU. It is comprised by different objects that contain information about
the qubit characterization and connectivity, the native gates and the lab's
instrumentation.
the native gates and the lab's instrumentation.

The following cell shows how to define a single qubit platform from scratch,
using different Qibolab primitives.
Expand Down Expand Up @@ -92,8 +91,7 @@ coded following the abstract :class:`qibolab.instruments.abstract.Instrument`
interface.

Furthermore, above we defined three channels that connect the qubit to the
control instrument and we assigned two native gates to the qubit. In this
example we neglected or characterization parameters associated to the qubit.
control instrument and we assigned two native gates to the qubit.
These can be passed when defining the :class:`qibolab.qubits.Qubit` objects.

When the QPU contains more than one qubit, some of the qubits are connected so
Expand Down Expand Up @@ -179,7 +177,7 @@ hold the parameters of the two-qubit gates.
)

# define the pair of qubits
pair = QubitPair(qubit0, qubit1)
pair = QubitPair(qubit0.name, qubit1.name)
pair.native_gates = TwoQubitNatives(
CZ=FixedSequenceFactory(
PulseSequence(
Expand Down Expand Up @@ -222,7 +220,7 @@ coupler but qibolab will take them into account when calling :class:`qibolab.nat
# Look above example

# define the pair of qubits
pair = QubitPair(qubit0, qubit1, coupler_01)
pair = QubitPair(qubit0.name, qubit1.name)
pair.native_gates = TwoQubitNatives(
CZ=FixedSequenceFactory(
PulseSequence(
Expand Down Expand Up @@ -408,22 +406,6 @@ a two-qubit system:
]
}
}
},
"characterization": {
"single_qubit": {
"0": {
"T1": 0.0,
"T2": 0.0,
"threshold": 0.00028502261712637096,
"iq_angle": 1.283105298787488
},
"1": {
"T1": 0.0,
"T2": 0.0,
"threshold": 0.0002694329123116206,
"iq_angle": 4.912447775569025
}
}
}
}
Expand All @@ -433,19 +415,6 @@ we need the following changes to the previous runcard:
.. code-block:: json
{
"qubits": [
0,
1
],
"couplers": [
0
],
"topology": {
"0": [
0,
1
]
},
"components": {
"flux_coupler_01": {
"bias": 0.12
Expand Down Expand Up @@ -497,15 +466,12 @@ we need the following changes to the previous runcard:
}
}
This file contains different sections: ``qubits`` is a list with the qubit
names, ``couplers`` one with the coupler names , ``settings`` defines default execution parameters, ``topology`` defines
the qubit connectivity (qubit pairs), ``native_gates`` specifies the calibrated
pulse parameters for implementing single and two-qubit gates and
``characterization`` provides the physical parameters associated to each qubit and coupler.
This file contains different sections: ``components`` defines the configuration of channel
parameters, while ``native_gates`` specifies the calibrated pulse parameters for implementing
single and two-qubit gates.
Note that such parameters may slightly differ depending on the QPU architecture,
however the pulses under ``native_gates`` should comply with the
:class:`qibolab.pulses.Pulse` API and the parameters under ``characterization``
should be a subset of :class:`qibolab.qubits.Qubit` attributes.
:class:`qibolab.pulses.Pulse` API.

Providing the above runcard is not sufficient to instantiate a
:class:`qibolab.platform.Platform`. This should still be done using a
Expand Down Expand Up @@ -642,7 +608,7 @@ With the following additions for coupler architectures:
couplers=couplers,
)

Note that this assumes that the runcard is saved as ``<folder>/parameters.yml`` where ``<folder>``
Note that this assumes that the runcard is saved as ``<folder>/parameters.json`` where ``<folder>``
is the directory containing ``platform.py``.


Expand All @@ -660,21 +626,11 @@ The runcard can contain an ``instruments`` section that provides these parameter
{
"nqubits": 2,
"qubits": [
0,
1
],
"settings": {
"nshots": 1024,
"sampling_rate": 1000000000,
"relaxation_time": 50000
},
"topology": [
[
0,
1
]
],
"instruments": {
"twpa_pump": {
"frequency": 4600000000,
Expand All @@ -684,22 +640,6 @@ The runcard can contain an ``instruments`` section that provides these parameter
"native_gates": {
"single_qubit": {},
"two_qubit": {}
},
"characterization": {
"single_qubit": {
"0": {
"T1": 0.0,
"T2": 0.0,
"threshold": 0.00028502261712637096,
"iq_angle": 1.283105298787488
},
"1": {
"T1": 0.0,
"T2": 0.0,
"threshold": 0.0002694329123116206,
"iq_angle": 4.912447775569025
}
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/qibolab/compilers/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
rz_rule,
z_rule,
)
from qibolab.components import Channel
from qibolab.platform import Platform
from qibolab.pulses import Delay, PulseSequence
from qibolab.qubits import QubitId
Expand Down Expand Up @@ -150,8 +151,12 @@ def compile(
measurement_map = {}
channel_clock = defaultdict(float)

def find_max(channels: list[Channel]):
return max(channel_clock[ch.name] for ch in channels)

def qubit_clock(el: QubitId):
return max(channel_clock[ch.name] for ch in platform.elements[el].channels)
elements = platform.qubits if el in platform.qubits else platform.couplers
return max(channel_clock[ch.name] for ch in elements[el].channels)

# process circuit gates
for moment in circuit.queue.moments:
Expand Down
18 changes: 16 additions & 2 deletions src/qibolab/components/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
configuration defined by these classes.
"""

from dataclasses import dataclass
from typing import Union
from dataclasses import dataclass, field
from typing import Optional, Union

import numpy.typing as npt

__all__ = [
"DcConfig",
Expand Down Expand Up @@ -78,5 +80,17 @@ class AcquisitionConfig:
smearing: float
"""FIXME:"""

# FIXME: this is temporary solution to deliver the information to drivers
# until we make acquisition channels first class citizens in the sequences
# so that each acquisition command carries the info with it.
threshold: Optional[float] = None
"""Signal threshold for discriminating ground and excited states."""
iq_angle: Optional[float] = None
"""Signal angle in the IQ-plane for disciminating ground and excited
states."""
kernel: Optional[npt.NDArray] = field(default=None, repr=False)
"""Integration weights to be used when post-processing the acquired
signal."""


Config = Union[DcConfig, IqMixerConfig, OscillatorConfig, IqConfig, AcquisitionConfig]
Loading

0 comments on commit 038304c

Please sign in to comment.