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#
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.
- 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
- 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.
- 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: PulsarType | 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: PulsarType | ClusterType)[source]#
Create QCM/QRM dummy transport class.
- Parameters:
dummy_type (Union[PulsarType, ClusterType]) – Dummy module type (e.g. Pulsar QCM, Pulsar QRM)
- property is_qcm_type: bool#
Return if module is of type QCM.
- Returns:
True if module is of type QCM.
- Return type:
- property is_qrm_type: bool#
Return if module is of type QRM.
- Returns:
True if module is of type QRM.
- Return type:
- 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:
- delete_dummy_binned_acquisition_data(sequencer: int | None = None, acq_index_name: str | None = None)[source]#
Set dummy binned acquisition data for the dummy.
- 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.
- 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: PulsarType | ClusterType)[source]#
-
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: PulsarType | 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:
- property instrument_type: str#
Get instrument type (e.g. MM, QRM, QCM).
- Returns:
Instrument type
- Return type:
- 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
- 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:
- 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.
- class qblox_instruments.ieee488_2.Transport[source]#
Bases:
object
Abstract base class for data transport to instruments.
- 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
- 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.
- 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.