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¶
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.PulsarDummyTransport(dummy_type: Union[PulsarType, ClusterType], scope_acq_cfg_format: str, qcm_seq_cfg_format: str, qrm_seq_cfg_format: str)[source]¶
Bases:
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[Union[str, int], ClusterType], scope_acq_cfg_format: str, qcm_seq_cfg_format: str, qrm_seq_cfg_format: str)[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[Union[str, int], ClusterType], 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.
- set_dummy_binned_acquisition_data(slot_idx: int, sequencer: int, acq_index_name: str, data: Iterable[Optional[DummyBinnedAcquisitionData]])[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.
- 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: Union[PulsarType, ClusterType], scope_acq_cfg_format: str, qcm_seq_cfg_format: str, qrm_seq_cfg_format: str)[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: Union[PulsarType, 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
- 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
- set_dummy_binned_acquisition_data(sequencer: int, acq_index_name: str, data: Iterable[Optional[DummyBinnedAcquisitionData]])[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: Union[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: Union[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 set_dummy_binned_acquisition_data(sequencer: int, acq_index_name: str, data: Iterable[Optional[DummyBinnedAcquisitionData]])[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 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.