scpi_instrument
SCPI Instrument interface and associated decorator tools.
This module contains the SCPIInstrument interface, and several function factories for creating input verifiers for SCPI set commands.
Verifiers include: verifier_or, truthy, is_numeric, is_integer.
Classes
|
Implementation of a VisaInstrument to communicate with devices accepting SCPI- like (query-set) command structures. |
SCPIInstrument
- class icicle.scpi_instrument.SCPIInstrument(*args, **kwargs)
Bases:
VisaInstrument
Implementation of a VisaInstrument to communicate with devices accepting SCPI- like (query-set) command structures.
- __init__(resource='ASRL/dev/ttyUSB1::INSTR', sim=False)
- Parameters:
resource – VISA Resource address. See VISA docs for more info.
- COM_RESET = '*RST; STATUS:PRESET; *CLS'
- READ_TERMINATION = '\n'
Read termination characters.
- SETTINGS = {'IDENTIFIER': {'QUERY': '*IDN?'}}
- SET_REQUIRES_READBACK = False
Either False, or True, or a callable to be executed after a readback with signature set_requires_feedback(instrument, command, value, readback_value).
If True or callable, a readback is performed directly after a call to set(), before any query(). If False, it is assumed the device does not respond to set().
- SMALL_DELAY = 0.05
Small delay between subsequent commands (s).
- TIMEOUT = 10000
Link timeout (ms).
- WRITE_TERMINATION = '\n'
Write termination characters.
- identify(**kwargs)
Query *IDN for device identifier.
- Parameters:
no_lock – override acquire_lock (e.g. if lock already taken by function that reset-call is nested within).
attempts – how many retries to give query command.
- query(setting, *params)
Query setting on instrument.
- Parameters:
setting – key in class dictionary SETTINGS.
no_lock – override acquire_lock (e.g. if lock already taken by function that query-call is nested within).
attempts – how many retries to give query command.
- Returns:
Data returned by device for given query.
- reset()
Reset device using the provided COM_RESET command within the class implementation.
- set(setting, *value, check_readback_only=False)
Set setting on instrument to value, and read-back using equivalent query().
- Parameters:
setting – key in class dictionary SETTINGS.
value – target value for setting.
check_readback_only – how to only check readback value if SET_REQUIRES_READBACK is set, and not perform back-query. If ‘same’, checks that readback gives same command as was sent.
no_lock – override acquire_lock (e.g. if lock already taken by function that set-call is nested within).
attempts – how many retries to give set command.
- Returns:
Read-back value if query() available, else whether number of bytes written during set() meets expectation