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).”

IEEE488.2 layer

class ieee488_2.ieee488_2.ieee488_2(transport_inst: <module 'ieee488_2.transport' from '/home/docs/checkouts/readthedocs.org/user_builds/qblox-qblox-instruments/checkouts/v0.5.3/ieee488_2/transport.py'>)[source]

Bases: object

Class that implements the IEEE488.2 interface.

__init__(transport_inst: <module 'ieee488_2.transport' from '/home/docs/checkouts/readthedocs.org/user_builds/qblox-qblox-instruments/checkouts/v0.5.3/ieee488_2/transport.py'>)None[source]

Creates IEEE488.2 interface object.

Parameters

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

Transport layer

class ieee488_2.transport.transport[source]

Bases: object

Abstract base class for data transport to instruments.

close()None[source]

Abstract method to close instrument.

write(cmd_str: str)None[source]

Abstract method to write command to instrument.

Parameters

cmd_str (str) – Command

write_binary(data: bytes)None[source]

Abstract method to write binary data to instrument.

Parameters

data (bytes) – Binary data

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

readline()str[source]

Abstract method to read data from instrument.

Returns

String with data.

Return type

str

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

Bases: 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)None[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 ieee488_2.transport.file_transport(out_file_name: str, in_file_name: str = '')[source]

Bases: ieee488_2.transport.transport

Class implementing file I/O to support driver testing.

__init__(out_file_name: str, in_file_name: str = '')None[source]

Create file transport class.

Parameters
  • out_file_name (str) – Output file name/path to write all commands to.

  • in_file_name (str) – Input file name/path to read all command responses from.

close()None[source]

Close file descriptors.

write(cmd_str: str)None[source]

Write command to file.

Parameters

cmd_str (str) – Command

write_binary(data: bytes)None[source]

Write binary data to file.

Parameters

data (bytes) – Binary data

read_binary(size: int)bytes[source]

Read binary data from file.

Parameters

size (int) – Number of bytes

Returns

Binary data array of length “size”.

Return type

bytes

readline()str[source]

Read data from file.

Returns

String with data.

Return type

str

class ieee488_2.transport.base_dummy_transport[source]

Bases: 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__()None[source]

Create base dummy transport class.

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 (see ieee488_2.transport.base_dummy_transport.get_cmd_hist()).

Parameters

cmd_str (str) – Command

write_binary(data: bytes)None[source]

Write binary data to dummy. Stores command in command history (see ieee488_2.transport.base_dummy_transport.get_cmd_hist()).

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 ieee488_2.transport.pulsar_dummy_transport(acq_scope_cfg_format: str, sequencer_cfg_format: str, is_rf_type: bool = False)[source]

Bases: ieee488_2.transport.base_dummy_transport

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.

__init__(acq_scope_cfg_format: str, sequencer_cfg_format: str, is_rf_type: bool = False)None[source]

Create Pulsar dummy transport class.

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

  • sequencer_cfg_format (str) –

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

  • is_rf_type (bool) – Dummy module type (False = RF, True = baseband)

class ieee488_2.transport.cluster_dummy_transport[source]

Bases: ieee488_2.transport.base_dummy_transport

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__()None[source]

Create Cluster dummy transport class.