laboneq.dsl.device
¶
laboneq.dsl.device.device_setup
¶
DeviceSetup()
dataclass
¶
Data object describing the device setup of a QCCS system.
Attributes:
Name | Type | Description |
---|---|---|
uid |
Optional[str]
|
Unique identifier of the setup. |
servers |
Optional[dict[str, DataServer]]
|
Servers of the device setup. |
instruments |
Optional[list[Instrument]]
|
Instruments of the device setup. Instruments must have unique UIDs. |
physical_channel_groups |
Optional[dict[str, PhysicalChannelGroup]]
|
Physical channels of this device setup, by name of the device. |
logical_signal_groups |
Optional[dict[str, LogicalSignalGroup]]
|
Logical signal groups of this device setup, by name of the group. |
qubits |
Optional[dict[str, QuantumElement]]
|
Experimental: Qubits of this device setup, by the name of the qubit.
Qubits are generated from the descriptor |
Changed in version 2.19.0
DeviceSetup
can now be created by using the following methods:
- `DeviceSetup.add_dataserver()`
- `DeviceSetup.add_instruments()`
- `DeviceSetup.add_connections()`
add_connections(instrument, *connections)
¶
Add connections to the instrument.
Instrument ports cannot have two different type of signals. Signal names must be unique.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
instrument |
str
|
UID of the instrument to add the connections to. |
required |
connections |
SignalConnection | InternalConnection
|
Connections to add. |
()
|
Raises:
Type | Description |
---|---|
LabOneQException
|
Connection information is wrong or the given instrument does not support the connection. |
Added in version 2.19.0
add_dataserver(host, port, uid='zi_server', api_level=6)
¶
Add a dataserver to the DeviceSetup.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
host |
str
|
Hostname of the dataserver. |
required |
port |
int | str
|
Port of the dataserver. |
required |
uid |
str
|
UID of the dataserver. |
'zi_server'
|
api_level |
int
|
API level of the dataserver. |
6
|
Raises:
Type | Description |
---|---|
LabOneQException
|
Dataserver already exists. |
Added in version 2.19.0
add_instruments(*instruments)
¶
Add instruments to the device setup.
Instruments must have an unique UID and Zurich Instruments instruments must have an address.
At least one dataserver must be defined and if only one dataserver exists, instruments are automatically connected to it, otherwise the respective dataserver UID must be defined in the instrument class itself.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
instruments |
Instrument
|
Instruments to add to the setup. |
()
|
Raises:
Type | Description |
---|---|
LabOneQException
|
|
Added in version 2.19.0
check_no_rf_multiplexing()
¶
Checks each instrument in DeviceSetup for RF signal multiplexing. Raises RFMultiplexingError if multiplexing is detected.
dumps()
¶
Serialize object into a JSON string.
from_descriptor(yaml_text, server_host=None, server_port=None, setup_name=None)
classmethod
¶
Construct the device setup from a YAML descriptor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
yaml_text |
str
|
YAML file containing the device description. |
required |
server_host |
str
|
Server host of the setup that should be created. |
None
|
server_port |
str
|
Port of the server that should be created. |
None
|
setup_name |
str
|
Name of the setup that should be created. |
None
|
from_dict(data, server_host=None, server_port=None, setup_name=None)
classmethod
¶
Construct the device setup from a Python dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
Dict[str, Any]
|
Device setup data. |
required |
server_host |
str | None
|
Server host of the setup that should be created. |
None
|
server_port |
Union[str, int] | None
|
Port of the server that should be created. |
None
|
setup_name |
str | None
|
Name of the setup that should be created. |
None
|
Added in version 2.5.0
from_dicts(*, instrument_list=None, instruments=None, connections=None, dataservers=None, server_host=None, server_port=None, setup_name=None)
classmethod
¶
Construct the device setup from Python dicts, same structure as yaml
Parameters:
Name | Type | Description | Default |
---|---|---|---|
instrument_list |
dict
|
List of instruments in the setup (deprecated; for backwards compatibility) |
None
|
instruments |
dict
|
List of instruments in the setup |
None
|
connections |
dict
|
Connections between devices |
None
|
server_host |
str | None
|
Server host of the setup that should be created. |
None
|
server_port |
str | None
|
Port of the server that should be created. |
None
|
setup_name |
str | None
|
Name of the setup that should be created. |
None
|
from_yaml(filepath, server_host=None, server_port=None, setup_name=None)
classmethod
¶
Construct the device setup from a YAML file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filepath |
str
|
Path to the YAML file containing the device description. |
required |
server_host |
str
|
Server host of the setup that should be created. |
None
|
server_port |
str
|
Port of the server that should be created. |
None
|
setup_name |
str
|
Name of the setup that should be created. |
None
|
get_calibration(path=None)
¶
Retrieve the calibration of a specific path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
Path of the calibration information.
If |
None
|
Returns:
Name | Type | Description |
---|---|---|
calibration |
Calibration
|
Calibration object of the device setup. |
instrument_by_uid(uid)
¶
Get an instrument by its uid.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uid |
str
|
UID of the instrument. |
required |
Returns:
Instrument with the given UID, or None
if no such instrument was found.
list_calibratables()
¶
Load the device setup from a specified file.
Returns:
Name | Type | Description |
---|---|---|
calibratables |
dict
|
Dictionary of calibratable objects within the device setup. The dictionary keys are the path string of the calibratable, and the values are again a dictionary with type of the calibratable and whether it is already set or not. |
load(filename)
classmethod
¶
Load the device setup from a specified file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename |
str
|
Filename. |
required |
logical_signal_by_uid(uid)
¶
Get logical signal by uid.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uid |
str
|
UID of the signal. |
required |
Returns: Logical signal with the UID. Raises: KeyError: Logical signal UID was not found.
Added in version 2.5.0
reset_calibration(calibration=None)
¶
Reset the calibration of all logical signals and instruments.
save(filename)
¶
Save the device setup to a specified file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename |
str
|
Filename. |
required |
set_calibration(calibration)
¶
Set the calibration of the device setup.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
calibration |
Calibration
|
Calibration object containing the keys of the individual settings. |
required |
laboneq.dsl.device.device_setup_helper
¶
DeviceSetupHelper
¶
delete_wiring(api_url)
staticmethod
¶
download_wiring(api_url)
staticmethod
¶
upload_wiring(api_url, wiring_text)
staticmethod
¶
Upload wiring information to the LabOne Q monitoring server.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api_url |
str
|
URL of the monitoring server. http://localhost:9005/slugname/wiring |
required |
wiring_text |
str
|
Json-like string contains wiring information. |
required |
Returns:
Name | Type | Description |
---|---|---|
status_code |
int
|
200 if succeeded. |
upload_wiring_from_descriptor(api_url, descriptor)
staticmethod
¶
Upload wiring information to the LabOne Q monitoring server using yaml descriptor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api_url |
str
|
URL of the monitoring server. http://localhost:9005/slugname/wiring |
required |
descriptor |
str
|
yaml-like text contains wiring information. |
required |
Returns:
Name | Type | Description |
---|---|---|
status_code |
int
|
200 if succeeded. |
laboneq.dsl.device.io_units
¶
laboneq.dsl.device.io_units.logical_signal
¶
LogicalSignal(uid, direction=None, name=None, calibration=None, path=None, physical_channel=None)
dataclass
¶
Bases: Calibratable