qtics.instruments package#

Instruments submodule: collection of drivers.

Submodules#

qtics.instruments.instrument module#

Base Instrument.

class qtics.instruments.instrument.Instrument(name: str, address: str)[source]#

Bases: ABC

Base instrument class.

clear_defaults()[source]#

Clear the defaults dictionary.

abstract connect()[source]#

Connect to the instrument.

property defaults: dict#

Default values for the instrument attributes.

abstract disconnect()[source]#

Disconnect from the instrument.

get(*args) dict[source]#

Get multiple attributes and/or properties.

get_id()[source]#

Return name of the device from SCPI standard query.

abstract query(cmd) str[source]#

Send a command and read from the instrument.

abstract read()[source]#

Read from the instrument.

reset(defaults=True)[source]#

Reset device with SCPI standard command.

set(**kwargs)[source]#

Set multiple attributes and/or properties.

set_defaults(**kwargs)[source]#

Set the specified default values.

update_defaults(**kwargs)[source]#

Validate and update the defaults dictionary.

static validate_opt(opt: str | int, allowed: tuple)[source]#

Check if provided option is between allowed ones.

static validate_range(n, n_min, n_max)[source]#

Check if provided number is in allowed range.

abstract write(cmd, sleep=False)[source]#

Send a command to the instrument.

qtics.instruments.network_inst module#

Base class for instruments communicating via network connection.

The code was partially taken from https://github.com/morgan-at-keysight/socketscpi

class qtics.instruments.network_inst.NetworkInst(name: str, address: str, port: int = 5025, timeout: int = 10, sleep: float = 0.1, no_delay: bool = True)[source]#

Bases: Instrument

Base class for instruments communicating via network connection.

connect()[source]#

Connect to the device.

disconnect()[source]#

Disconnect from the device.

query(cmd: str) str[source]#

Send a message, then read from the serial port.

read() str[source]#

Read the output buffer of the instrument.

write(cmd: str, sleep=False)[source]#

Write a message to the serial port.

qtics.instruments.serial_inst module#

Base instrument for serial connections.

class qtics.instruments.serial_inst.SerialInst(name: str, address: str, baudrate: int = 9600, bytesize: int = 8, parity: Literal['N'] = 'N', stopbits: int = 1, timeout: int = 10, sleep: float = 0.1)[source]#

Bases: Instrument

Base class for instrument controlled via serial connection.

connect()[source]#

Connect to the device.

disconnect()[source]#

Disconnect from the device.

query(cmd) str[source]#

Send a message, then read from the serial port.

read() str[source]#

Read a message from the serial port.

write(cmd, sleep=False)[source]#

Write a message to the serial port.