IEEE488.2#

Every SCPI interface is based on the IEEE488.2 protocol. This Python implementation separates the protocol into two layers:

  • IEEE488.2 layer: IEEE488.2 layer that implements the protocol based on the transport layer.

  • Transport layer: Transport layers responsible for lowest level of communication (e.g. Ethernet or dummy).”

IEEE488.2 layer#

class qblox_instruments.ieee488_2.Ieee488_2(transport: Transport)[source]#

Bases: object

Class that implements the IEEE488.2 interface.

__init__(transport: Transport)[source]#

Creates IEEE488.2 interface object.

Parameters:

transport (Transport) – Transport class responsible for the lowest level of communication (e.g. ethernet).

Transport layer#

class qblox_instruments.ieee488_2.IpTransport(host: str, port: int = 5025, timeout: float = 60.0, snd_buf_size: int = 524288)[source]#

Bases: Transport

Class for data transport of IP socket.

__init__(host: str, port: int = 5025, timeout: float = 60.0, snd_buf_size: int = 524288)[source]#

Create IP socket transport class.

Parameters:
  • host (str) – Instrument IP address.

  • port (int) – Instrument port.

  • timeout (float) – Instrument call timeout in seconds.

  • snd_buf_size (int) – Instrument buffer size for transmissions to instrument.

close() None[source]#

Close IP socket.

write(cmd_str: str) None[source]#

Write command to instrument over IP socket.

Parameters:

cmd_str (str) – Command

write_binary(data: bytes) None[source]#

Write binary data to instrument over IP socket.

Parameters:

data (bytes) – Binary data

read_binary(size: int) bytes[source]#

Read binary data from instrument over IP socket.

Parameters:

size (int) – Number of bytes

Returns:

Binary data array of length “size”.

Return type:

bytes

readline() str[source]#

Read data from instrument over IP socket.

Returns:

String with data.

Return type:

str

class qblox_instruments.ieee488_2.ClusterDummyTransport(dummy_cfg: Dict[str | int, ClusterType])[source]#

Bases: DummyTransport

Class to replace Cluster device with dummy device to support software stack testing without hardware. The class implements all mandatory, required and Cluster specific SCPI calls. Call reponses are largely artifically constructed to be inline with the call’s functionality (e.g. *IDN? returns valid, but artificial IDN data.) To assist development, the Q1ASM assembler has been completely implemented. Please have a look at the call’s implentation to know what to expect from its response.

__init__(dummy_cfg: Dict[str | int, ClusterType])[source]#

Create Cluster dummy transport class.

Parameters:

dummy_cfg (Dict) – Dictionary of dummy module types (e.g. Cluster QCM, Cluster QRM). Each key of the dictionary is a slot index with a dummy type specification of type ClusterType.

delete_dummy_binned_acquisition_data(slot_idx: int, sequencer: int | None = None, acq_index_name: str | None = None)[source]#

Delete all dummy binned acquisition data for the dummy.

Parameters:
  • slot_idx (int) – Slot of the hardware you want to set the data to on a cluster.

  • sequencer (Optional[int]) – Sequencer.

  • acq_index_name (Optional[str]) – Acquisition index name.

set_dummy_binned_acquisition_data(slot_idx: int, sequencer: int, acq_index_name: str, data: Iterable[DummyBinnedAcquisitionData | None])[source]#

Set dummy binned acquisition data for the dummy.

Parameters:
  • slot_idx (int) – Slot of the hardware you want to set the data to on a cluster.

  • sequencer (int) – Sequencer.

  • acq_index_name (str) – Acquisition index name.

  • data (Iterable[Union[DummyBinnedAcquisitionData, None]]) – Dummy data for the binned acquisition. An iterable of all the bin values.

delete_dummy_scope_acquisition_data(slot_idx: int)[source]#

Delete dummy scope acquisition data for the dummy.

Parameters:

slot_idx (int) – Slot of the hardware you want to set the data to on a cluster.

set_dummy_scope_acquisition_data(slot_idx: int, data: DummyScopeAcquisitionData)[source]#

Set dummy scope acquisition data for the dummy.

Parameters:
  • slot_idx (int) – Slot of the hardware you want to set the data to on a cluster.

  • data (DummyScopeAcquisitionData) – Dummy data for the scope acquisition.

Supporting classes and functions#

class qblox_instruments.ieee488_2.QcmQrmDummyTransport(dummy_type: ClusterType)[source]#

Bases: DummyTransport

Class to replace a QCM/QRM module with a dummy device to support software stack testing without hardware. The class implements all mandatory, required and QCM/QRM specific SCPI calls. Call reponses are largely artifically constructed to be inline with the call’s functionality (e.g. *IDN? returns valid, but artificial IDN data.) To assist development, the Q1ASM assembler has been completely implemented. Please have a look at the call’s implentation to know what to expect from its response.

__init__(dummy_type: ClusterType)[source]#

Create QCM/QRM dummy transport class.

Parameters:

dummy_type (ClusterType) – Dummy module type

property is_qcm_type: bool#

Return if module is of type QCM.

Returns:

True if module is of type QCM.

Return type:

bool

property is_qrm_type: bool#

Return if module is of type QRM.

Returns:

True if module is of type QRM.

Return type:

bool

property is_rf_type: bool#

Return if module is of type QCM-RF or QRM-RF.

Returns:

True if module is of type QCM-RF or QRM-RF.

Return type:

bool

delete_dummy_binned_acquisition_data(sequencer: int | None = None, acq_index_name: str | None = None)[source]#

Set dummy binned acquisition data for the dummy.

Parameters:
  • sequencer (Optional[int]) – Sequencer.

  • acq_index_name (Optional[str]) – Acquisition index name.

set_dummy_binned_acquisition_data(sequencer: int, acq_index_name: str, data: Iterable[DummyBinnedAcquisitionData | None])[source]#

Set dummy binned acquisition data for the dummy.

Parameters:
  • sequencer (int) – Sequencer.

  • acq_index_name (str) – Acquisition index name.

  • data (Iterable[Union[DummyBinnedAcquisitionData, None]]) – Dummy data for the binned acquisition. An iterable of all the bin values.

delete_dummy_scope_acquisition_data()[source]#

Delete dummy scope acquisition data for the dummy.

set_dummy_scope_acquisition_data(data: DummyScopeAcquisitionData)[source]#

Set dummy scope acquisition data for the dummy.

Parameters:

data (DummyScopeAcquisitionData) – Dummy data for the scope acquisition.

class qblox_instruments.ieee488_2.DummyTransport(dummy_type: ClusterType)[source]#

Bases: ABC, Transport

Class to replace device with dummy device to support software stack testing without hardware. The class implements all mandatory and required SCPI calls. Call reponses are largely artifically constructed to be inline with the call’s functionality (e.g. *IDN? returns valid, but artificial IDN data.)

__init__(dummy_type: ClusterType)[source]#

Create dummy transport class.

Parameters:

dummy_type (ClusterType) – Dummy instrument type

property instrument_class: str#

Get instrument class (e.g. Cluster).

Returns:

Instrument class

Return type:

str

property instrument_type: str#

Get instrument type (e.g. MM, QRM, QCM).

Returns:

Instrument type

Return type:

str

close() None[source]#

Close and resets base dummy transport class.

write(cmd_str: str) None[source]#

Write command to dummy. Stores command in command history.

Parameters:

cmd_str (str) – Command

write_binary(data: bytes) None[source]#

Write binary data to dummy. Stores command in command history.

Parameters:

data (bytes) – Binary data

read_binary(size: int) bytes[source]#

Read binary data from dummy.

Parameters:

size (int) – Number of bytes

Returns:

Binary data array of length “size”.

Return type:

bytes

readline() str[source]#

Read data from dummy.

Returns:

String with data.

Return type:

str

abstract delete_dummy_binned_acquisition_data(sequencer: int | None = None, acq_index_name: str | None = None)[source]#

Delete all dummy binned acquisition data for the dummy.

Parameters:
  • sequencer (Optional[int]) – Sequencer.

  • acq_index_name (Optional[str]) – Acquisition index name.

Raises:

ValueError – If the slot_idx doesn’t make sense for the transport.

abstract set_dummy_binned_acquisition_data(sequencer: int, acq_index_name: str, data: Iterable[DummyBinnedAcquisitionData | None])[source]#

Set dummy binned acquisition data for the dummy.

Parameters:
  • sequencer (int) – Sequencer.

  • acq_index_name (str) – Acquisition index name.

  • data (Iterable[Union[DummyBinnedAcquisitionData, None]]) – Dummy data for the binned acquisition. An iterable of all the bin values.

Raises:

ValueError – If the slot_idx doesn’t make sense for the transport.

abstract delete_dummy_scope_acquisition_data()[source]#

Set dummy scope acquisition data for the dummy.

Raises:

ValueError – If the slot_idx doesn’t make sense for the transport.

abstract set_dummy_scope_acquisition_data(data: DummyScopeAcquisitionData)[source]#

Set dummy scope acquisition data for the dummy.

Parameters:

data (DummyScopeAcquisitionData) – Dummy data for the scope acquisition.

Raises:

ValueError – If the slot_idx doesn’t make sense for the transport.

get_cmd_hist() list[source]#

Get list of every executed command since the initialization or reset of the class.

Returns:

List of executed command strings including arguments (does not include binary data argument).

Return type:

list

class qblox_instruments.ieee488_2.Transport[source]#

Bases: object

Abstract base class for data transport to instruments.

abstract close() None[source]#

Abstract method to close instrument.

abstract write(cmd_str: str) None[source]#

Abstract method to write command to instrument.

Parameters:

cmd_str (str) – Command

abstract write_binary(data: bytes) None[source]#

Abstract method to write binary data to instrument.

Parameters:

data (bytes) – Binary data

abstract read_binary(size: int) bytes[source]#

Abstract method to read binary data from instrument.

Parameters:

size (int) – Number of bytes

Returns:

Binary data array of length “size”.

Return type:

bytes

abstract readline() str[source]#

Abstract method to read data from instrument.

Returns:

String with data.

Return type:

str

class qblox_instruments.ieee488_2.DummyBinnedAcquisitionData(data: Tuple[float, float], thres: int, avg_cnt: int)[source]#

Bases: object

Class to hold data for the dummy hardware for the binned acquisition. This class contains all values for one bin.

data: Tuple[float, float]#
thres: int#
avg_cnt: int#
__init__(data: Tuple[float, float], thres: int, avg_cnt: int) None#
class qblox_instruments.ieee488_2.DummyScopeAcquisitionData(data: Iterable[Tuple[float, float]], out_of_range: Tuple[bool, bool], avg_cnt: Tuple[int, int])[source]#

Bases: object

Class to hold data for the dummy hardware for the scope acquisition. This class contains all values for the scope acquisition on one module.

data: Iterable[Tuple[float, float]]#
out_of_range: Tuple[bool, bool]#
avg_cnt: Tuple[int, int]#
__init__(data: Iterable[Tuple[float, float]], out_of_range: Tuple[bool, bool], avg_cnt: Tuple[int, int]) None#