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 communcation (e.g. Ethernet or dummy).”

IEEE488.2 layer

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

Bases: object

Class that implements the IEEE488.2 interface.

__init__(transport: qblox_instruments.ieee488_2.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: qblox_instruments.ieee488_2.transport.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.PulsarDummyTransport(dummy_type: Union[qblox_instruments.types.PulsarType, qblox_instruments.types.ClusterType], scope_acq_cfg_format: str, qcm_seq_cfg_format: str, qrm_seq_cfg_format: str)[source]

Bases: qblox_instruments.ieee488_2.qcm_qrm_dummy_transport.QcmQrmDummyTransport

Class to replace Pulsar device with dummy device to support software stack testing without hardware. The class implements all mandatory, required and Pulsar 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.

class qblox_instruments.ieee488_2.ClusterDummyTransport(dummy_cfg: Dict, scope_acq_cfg_format: str, qcm_seq_cfg_format: str, qrm_seq_cfg_format: str)[source]

Bases: qblox_instruments.ieee488_2.dummy_transport.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, scope_acq_cfg_format: str, qcm_seq_cfg_format: str, qrm_seq_cfg_format: str)[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.

  • scope_acq_cfg_format (str) – Configuration format based on struct.pack format used to calculate scope acquisition configuration transaction size.

  • qcm_seq_cfg_format (str) –

    QCM sequencer configuration format based on struct.pack format used to calculate scope acquisition configuration transaction size.

  • qrm_seq_cfg_format (str) –

    QRM sequencer configuration format based on struct.pack format used to calculate scope acquisition configuration transaction size.

Supporting classes and functions

class qblox_instruments.ieee488_2.QcmQrmDummyTransport(dummy_type: Union[qblox_instruments.types.PulsarType, qblox_instruments.types.ClusterType], scope_acq_cfg_format: str, qcm_seq_cfg_format: str, qrm_seq_cfg_format: str)[source]

Bases: qblox_instruments.ieee488_2.dummy_transport.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: Union[qblox_instruments.types.PulsarType, qblox_instruments.types.ClusterType], scope_acq_cfg_format: str, qcm_seq_cfg_format: str, qrm_seq_cfg_format: str)[source]

Create QCM/QRM dummy transport class.

Parameters
  • dummy_type (Union[PulsarType, ClusterType]) – Dummy module type (e.g. Pulsar QCM, Pulsar QRM)

  • scope_acq_cfg_format (str) –

    Configuration format based on struct.pack format used to calculate scope acquisition configuration transaction size.

  • qcm_seq_cfg_format (str) –

    QCM sequencer configuration format based on struct.pack format used to calculate scope acquisition configuration transaction size.

  • qrm_seq_cfg_format (str) –

    QRM sequencer configuration format based on struct.pack format used to calculate scope acquisition configuration transaction size.

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

class qblox_instruments.ieee488_2.DummyTransport(dummy_type: Union[qblox_instruments.types.PulsarType, qblox_instruments.types.ClusterType])[source]

Bases: qblox_instruments.ieee488_2.transport.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: Union[qblox_instruments.types.PulsarType, qblox_instruments.types.ClusterType])[source]

Create dummy transport class.

Parameters

dummy_type (Union[PulsarType, ClusterType]) – Dummy instrument type (e.g. Pulsar QCM, Pulsar QRM)

property instrument_class: str

Get instrument class (e.g. Pulsar, 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

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