qtics.transport package#
Transports: channels used to exchange messages with instruments.
Submodules#
qtics.transport.base module#
Base transport: the channel used to exchange messages with an instrument.
qtics.transport.fake module#
Fake transport for tests: records commands and replies with scripted answers.
- class qtics.transport.fake.FakeTransport(answers: Dict[str, str | bytes | Callable[[str], str | bytes]] | None = None, default: str | bytes | Callable[[str], str | bytes] | None = None, address: str = 'fake', terminator: str = '\n')[source]#
Bases:
TransportIn-memory transport.
Every written command is appended to
written. If the command is a key ofanswersits answer is queued for reading: strings are returned byread(), bytes byread_raw(), callables are called with the command. Queries (commands containing “?”) without a scripted answer getdefault(if not None); other commands get no answer.
qtics.transport.gpib module#
GPIB (IEEE-488) transport.
Calls the IEEE 488.2 C library of the GPIB driver through ctypes: linux-gpib
(libgpib.so) on Linux, NI-488.2 (ni4882.dll) on Windows. Only the driver
is needed, no Python package.
- class qtics.transport.gpib.GPIBTransport(address: int | str, board: int = 0, timeout: float = 10, terminator: str = '\n', delay: float = 0.1, library: str = '')[source]#
Bases:
TransportGPIB transport.
addressis the primary address (e.g. 20, combined withboard) or a VISA-like resource string (e.g. “GPIB0::20::INSTR”). Reads end when the instrument asserts EOI, as IEEE 488.2 requires, so binary data is never cut at the terminator.
qtics.transport.serial module#
Serial port transport.
- class qtics.transport.serial.SerialTransport(address: str, baudrate: int = 9600, bytesize: int = 8, parity: Literal['N', 'E', 'O', 'M', 'S'] = 'N', stopbits: float = 1, timeout: float = 10, terminator: str = '\n', delay: float = 0.1, flush_before_write: bool = True)[source]#
Bases:
TransportSerial port transport.
Answers are read from what is waiting in the input buffer, so a query relies on
delayto give the instrument time to answer.
qtics.transport.socket module#
TCP socket transport, e.g. for raw SCPI over LAN.
The code was partially taken from https://github.com/morgan-at-keysight/socketscpi