laboneq.dsl.quantum
¶
Experimental
The classes defined below are considered experimental. Their interfaces may change in future releases of LabOne Q.
laboneq.dsl.quantum.quantum_element
¶
QuantumElement(uid=None, signals=None)
dataclass
¶
Bases: ABC
An abstract base class for quantum elements like Qubits or tunable couplers etc.
Initializes a new QuantumElement object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uid
|
str | None
|
A unique identifier for the quantum element. |
None
|
signals
|
dict[str, LogicalSignal | str] | None
|
A dictionary of logical signals associated with the quantum element. |
None
|
signals = QuantumElementSignalMap({}, key_validator=self._coerce_signal_type)
instance-attribute
¶
uid = uuid.uuid4().hex if uid is None else uid
instance-attribute
¶
add_signals(signals)
¶
Adds logical signals to the quantum element.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
signals
|
Dict[str, LogicalSignal]
|
A dictionary of logical signals to add to the quantum element. |
required |
calibration()
abstractmethod
¶
Calibration of the Quantum element.
experiment_signals(with_types=False, with_calibration=False)
¶
Experiment signals of the quantum element.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
with_types
|
bool
|
When true, return a list of tuples which consist of a mapped logical signal type and an experiment signal. Otherwise, just return the experiment signals. |
False
|
with_calibration
|
bool
|
Apply the qubit's calibration to the ExperimentSignal. |
False
|
from_json(filename)
classmethod
¶
load(filename)
classmethod
¶
save(filename)
¶
laboneq.dsl.quantum.quantum_operations
¶
Core classes for defining sets of quantum operations on qubits.
QuantumOperations()
¶
Quantum operations for a given qubit type.
Attributes:
Name | Type | Description |
---|---|---|
QUBIT_TYPES |
type[QuantumElement] | tuple[type[QuantumElement]] | None
|
(class attribute) The classes of qubits supported by this set of operations. The value may be a single class or a tuple of classes. |
BASE_OPS |
dict[str, Callable]
|
(class attribute) A dictionary of names and functions that define the base operations provided. |
BASE_OPS: dict[str, Callable] = None
class-attribute
instance-attribute
¶
QUBIT_TYPES: type[QuantumElement] | tuple[type[QuantumElement]] | None = None
class-attribute
instance-attribute
¶
keys()
¶
Return the names of the registered quantum operations.
register(f, name=None)
¶
Registers a quantum operation.
The given operation is wrapped in a Operation
instance
and added to this set of operations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
f
|
Callable
|
The function to register as a quantum operation. The first parameter of The qubits Additional non-qubit arguments may be passed to |
required |
name
|
str | None
|
The name of the operation. Defaults to |
None
|
Example
Create a custom operation function, register and call it:
qop = qpu.quantum_operations
def custom_op(qop, q, amplitude):
pulse = ...
play(
q.signals["drive"],
amplitude=amplitude,
pulse=pulse,
)
qop.register(custom_op)
qop.custom_op(q, amplitude=0.5)
In the example above the qop
argument to custom_op
is unused, but custom_op
could call another quantum
operation using, e.g., qop.x90(q)
, if needed.
laboneq.dsl.quantum.qpu
¶
This module defines the QuantumPlatform and QPU classes.
A QPU
contains the "physics" of a quantum device -- the qubit parameters
and definition of operations on qubits.
A QuantumPlatform
contains the QPU
, and the DeviceSetup
which describes
the control hardware used to interface to the device.
By itself a QPU
provides everything needed to build or design an
experiment for a quantum device. The DeviceSetup
provides the additional
information needed to compile an experiment for specific control hardware.
Together these provide a QuantumPlatform
-- i.e. everything needed to build,
compile and run experiments on real devices.
QPU(qubits, quantum_operations)
¶
A Quantum Processing Unit (QPU).
A QPU
provides the logical description of a quantum device needed to build
experiments for it. For example, the qubit parameters and the definition of
operations on those qubits.
It does not provide a description of the control hardware needed to compile an experiment.
In short, a QPU
defines the device physics and a DeviceSetup
defines the control
hardware being used.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
qubits
|
Qubits
|
The qubits to run the experiments on. |
required |
quantum_operations
|
QuantumOperations
|
The quantum operations to use when building the experiment. |
required |
quantum_operations = quantum_operations
instance-attribute
¶
qubits: list[QuantumElement] = [qubits] if isinstance(qubits, QuantumElement) else list(qubits)
instance-attribute
¶
copy_qubits()
¶
Return new qubits that are a copy of the original qubits.
measure_section_length(qubits)
staticmethod
¶
Calculates the length of the measure section for multiplexed readout.
In order to allow the qubits to have different readout and/or integration lengths, the measure section length needs to be fixed to the longest one across the qubits used in the experiment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
qubits
|
Qubits
|
The qubits that are being measured. |
required |
Returns:
Type | Description |
---|---|
float
|
The length of the multiplexed-readout measure section. |
override_qubits(qubit_parameters)
¶
Override qubit parameters and return a new QPU.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
qubit_parameters
|
dict[str, dict[str, int | float | str | dict | None]]
|
The qubits and their parameters that need to be updated passed a dict of the form:
|
required |
Returns: A new QPU with overridden qubit parameters. Raises: ValueError: If one of the qubits passed is not found in the qpu. If one of the parameters passed is not found in the qubit.
qubit_by_uid(uid)
¶
Returns qubit by UID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uid
|
str
|
Unique identifier of the qubit within the QPU. |
required |
Returns:
Type | Description |
---|---|
QuantumElement
|
Qubit with given |
Raises:
Type | Description |
---|---|
KeyError
|
Qubit does not exist. |
update_qubits(qubit_parameters)
¶
Updates qubit parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
qubit_parameters
|
dict[str, dict[str, int | float | str | dict | None]]
|
The qubits and their parameters that need to be updated passed a dict of the form:
|
required |
Raises:
Type | Description |
---|---|
ValueError
|
If one of the qubits passed is not found in the qpu. If one of the parameters passed is not found in the qubit. |
QuantumPlatform(setup, qpu)
¶
A quantum hardware platform.
A QuantumPlatform
provides the logical description of a quantum device needed to
define experiments (the QPU
) and the description of the control hardware needed to
compile an experiment (the DeviceSetup
).
In short, a QPU
defines the device physics and a DeviceSetup
defines the control
hardware being used.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
setup
|
DeviceSetup
|
The |
required |
qpu
|
QPU
|
The |
required |
Initialize a new QPU.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
setup
|
DeviceSetup
|
The device setup to use when running an experiment. |
required |
qpu
|
QPU
|
The QPU to use when building an experiment. |
required |
laboneq.dsl.quantum.qubit
¶
Qubit(uid=None, signals=None, parameters=None)
dataclass
¶
Bases: QuantumElement
A class for a generic two-level Qubit.
Initializes a new Qubit.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uid
|
str | None
|
A unique identifier for the Qubit. |
None
|
signals
|
dict[str, LogicalSignal] | None
|
A mapping of logical signals associated with the qubit. Qubit accepts the following keys in the mapping: 'drive', 'measure', 'acquire', 'flux' This is so that the Qubit parameters are assigned into the correct signal lines in calibration. |
None
|
parameters
|
QubitParameters | dict[str, Any] | None
|
Parameters associated with the qubit.
Required for generating calibration and experiment signals via |
None
|
parameters = QubitParameters()
instance-attribute
¶
calibration()
¶
Generate calibration from the qubits parameters and signal lines.
Qubit
requires parameters
for it to be able to produce a calibration object.
Returns:
Type | Description |
---|---|
Calibration
|
Prefilled calibration object from Qubit parameters. |
from_logical_signal_group(uid, lsg, parameters=None)
classmethod
¶
Qubit from logical signal group.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uid
|
str
|
A unique identifier for the Qubit. |
required |
lsg
|
LogicalSignalGroup
|
Logical signal group. Qubit understands the following signal line names:
This is so that the Qubit parameters are assigned into the correct signal lines in calibration. |
required |
parameters
|
QubitParameters | dict[str, Any] | None
|
Parameters associated with the qubit. |
None
|
laboneq.dsl.quantum.transmon
¶
Transmon(uid=None, signals=None, parameters=None)
dataclass
¶
Bases: QuantumElement
A class for a superconducting, flux-tuneable Transmon Qubit.
Initializes a new Transmon Qubit.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uid
|
str | None
|
A unique identifier for the Qubit. |
None
|
signals
|
dict[str, LogicalSignal | str] | None
|
A mapping of logical signals associated with the qubit. Qubit accepts the following keys in the mapping: 'drive', 'measure', 'acquire', 'flux' This is so that the Qubit parameters are assigned into the correct signal lines in calibration. |
None
|
parameters
|
TransmonParameters | dict[str, Any] | None
|
Parameters associated with the qubit.
Required for generating calibration and experiment signals via |
None
|
parameters = TransmonParameters()
instance-attribute
¶
calibration(set_local_oscillators=True)
¶
Generate calibration from the parameters and attached signal lines.
Qubit
requires parameters
for it to be able to produce calibration objects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
set_local_oscillators
|
bool
|
If True, adds local oscillator settings to the calibration. |
True
|
Returns:
Name | Type | Description |
---|---|---|
calibration |
Calibration
|
Prefilled calibration object from Qubit parameters. |
from_logical_signal_group(uid, lsg, parameters=None)
classmethod
¶
Transmon Qubit from logical signal group.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uid
|
str
|
A unique identifier for the Qubit. |
required |
lsg
|
LogicalSignalGroup
|
Logical signal group. Transmon Qubit understands the following signal line names:
This is so that the Qubit parameters are assigned into the correct signal lines in calibration. |
required |
parameters
|
TransmonParameters | dict[str, Any] | None
|
Parameters associated with the qubit. |
None
|