laboneq.dsl.quantum
¶
laboneq.dsl.quantum.quantum_element
¶
QuantumElement
¶
A quantum element within a quantum device.
For example, a qubit or a coupler.
Attributes:
Name | Type | Description |
---|---|---|
uid |
str
|
A unique identifier for the quantum element. E.g. |
signals |
Dict[str, str]
|
A mapping for experiment signal names to logical signal paths. |
parameters |
QuantumParameters
|
Parameter values for the quantum element. For example, qubit frequency, drive pulse lengths. |
Class attributes
PARAMETERS_TYPE: The type of the parameters used. Should be a sub-class of QuantumParameters. REQUIRED_SIGNALS: A tuple of experiment signal names that must be provided. OPTIONAL_SIGNALS: A tuple of optional signal names. Optional signals are used by the class but not required. SIGNAL_ALIASES: A mapping from alternative names for signals to their canonical names. Signal names are translated to canonical signal names when a quantum element is instantiated.
This attribute is provided as a means to provide backwards
compatibility with existing device configurations when signal naming
conventions change.
OPTIONAL_SIGNALS = ()
class-attribute
instance-attribute
¶
PARAMETERS_TYPE = QuantumParameters
class-attribute
instance-attribute
¶
REQUIRED_SIGNALS = ()
class-attribute
instance-attribute
¶
SIGNAL_ALIASES = {}
class-attribute
instance-attribute
¶
parameters: QuantumParameters = attrs.field(converter=attrs.Converter(_parameters_converter, takes_self=True), default=None)
class-attribute
instance-attribute
¶
signals: Dict[str, str] = attrs.field(converter=attrs.Converter(_signals_converter, takes_self=True), default=None)
class-attribute
instance-attribute
¶
uid: str = attrs.field()
class-attribute
instance-attribute
¶
calibration()
¶
Return the calibration for this quantum element.
Calibration for each experiment signal is generated from the quantum element parameters.
Returns:
Type | Description |
---|---|
Calibration
|
The experiment calibration. |
create_parameters(**parameters)
classmethod
¶
Create a new instance of parameters for this qubit class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parameters
|
dict[str, object]
|
Parameter values for the new parameter instance. |
{}
|
Returns:
Type | Description |
---|---|
QuantumParameters
|
A new parameter instance. |
experiment_signals()
¶
Return the list of the experiment signals for this quantum element.
Returns:
Type | Description |
---|---|
List[ExperimentSignal]
|
A list of experiment signals. |
from_device_setup(device_setup, qubit_uids=None)
classmethod
¶
Create a list of quantum elements from a device setup.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
device_setup
|
DeviceSetup
|
The device setup to create the quantum elements from. |
required |
qubit_uids
|
list[str] | None
|
The set of logical signal group uids to create qubits from, or
|
None
|
Returns:
Type | Description |
---|---|
list[QuantumElement]
|
A list of quantum elements. |
Note
The device setup does not contain the qubit parameters so they will need to be set separately.
from_logical_signal_group(uid, lsg, parameters=None)
classmethod
¶
Create a quantum element from a logical signal group.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uid
|
str
|
A unique identifier for the quantum element. E.g. |
required |
lsg
|
LogicalSignalGroup
|
The logical signal group containing the quantum elements signals. |
required |
parameters
|
QuantumParameters | dict[str, Any] | None
|
A dictionary of quantum element parameters. |
None
|
Returns:
Type | Description |
---|---|
QuantumElement
|
A quantum element. |
Note
The logical signal group prefix, /logical_signal_group/
,
will be removed from any signal paths if it is present.
load(filename)
classmethod
¶
replace(**parameter_changes)
¶
save(filename)
¶
update(**parameter_changes)
¶
QuantumParameters
¶
Calibration parameters for a QuantumElement.
replace(**changes)
¶
Return a new set of parameters with changes applied.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
changes
|
dict[str, object]
|
Parameter changes to apply passed as keyword arguments.
Dotted key names such as |
{}
|
Return
A new parameters instance.
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.
quantum_operation(f=None, *, broadcast=True, neartime=False)
¶
Decorator that marks an method as a quantum operation.
Methods marked as quantum operations are moved into the BASE_OPS
dictionary
of the QuantumOperations
class they are defined in at the end of class
creation.
Functions marked as quantum operations take the QuantumOperations
instance
they are registered on as their initial self
parameter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
f
|
Callable | None
|
The method to decorate. |
None
|
broadcast
|
bool
|
If true, the operation may be broadcast across multiple qubits
using |
True
|
neartime
|
bool
|
If true, the operation is marked as a near-time operation. Its section is set to near-time and no qubit signals are reserved. |
False
|
Returns:
Type | Description |
---|---|
Callable
|
If |
Callable
|
Otherwise returns a partial evaluation of |
Callable
|
the other arguments set. |
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
|
QuantumElements
|
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
|
QuantumElements
|
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
¶
laboneq.dsl.quantum.transmon
¶
Transmon
¶
Bases: QuantumElement
A class for a superconducting, flux-tuneable Transmon Qubit.
Deprecated in version 2.43.0.
This class is deprecated and was intended primarily for demonstration purposes. Instead of using it write a class that directly inherits from QuantumElement.
OPTIONAL_SIGNALS = ('drive_ef', 'drive_cr', 'flux')
class-attribute
instance-attribute
¶
PARAMETERS_TYPE = TransmonParameters
class-attribute
instance-attribute
¶
REQUIRED_SIGNALS = ('acquire', 'drive', 'measure')
class-attribute
instance-attribute
¶
SIGNAL_ALIASES = {'acquire_line': 'acquire', 'drive_line': 'drive', 'measure_line': 'measure', 'drive_ef_line': 'drive_ef', 'drive_line_ef': 'drive_ef', 'drive_cr_line': 'drive_cr', 'flux_line': 'flux'}
class-attribute
instance-attribute
¶
calibration()
¶
Return the experiment calibration for this transmon.
Calibration for each experiment signal is generated from the transmon parameters.
Returns:
Type | Description |
---|---|
Calibration
|
The experiment calibration. |
TransmonParameters
¶
Bases: QuantumParameters
A class for the parameters of a superconducting, flux-tuneable transmon qubit.
Deprecated in version 2.43.0.
This class is deprecated and was intended primarily for demonstration purposes. Instead of using it write a class that directly inherits from QuantumParameters.
drive_frequency_ef: float | None
property
¶
Qubit drive frequency.
drive_frequency_ge: float | None
property
¶
Qubit drive frequency.
drive_lo_frequency: Optional[float] = None
class-attribute
instance-attribute
¶
drive_range: Optional[float] = 10
class-attribute
instance-attribute
¶
flux_offset_voltage: Optional[float] = 0
class-attribute
instance-attribute
¶
readout_frequency: float | None
property
¶
Readout baseband frequency.