inspy.instrument
Top level module for instruments.
- class inspy.instrument.InstrumentBase(transport)[source]
Bases:
objectInstrument Base class.
This class should be subclassed by all instrument classes. It provides basic functionality for connecting and disconnecting from the instrument.
-
auto_log_level:
int= 20 The log level used for automatic logging of method calls.
To disable logging set to logging.NOTSET.
-
auto_log_level:
- exception inspy.instrument.InstrumentError(errors)[source]
Bases:
ExceptionError class raised when errors are reported by the instrument.
- args
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- class inspy.instrument.SerialInstrumentMixin(visa_address=None, transport=None)[source]
Bases:
InstrumentBaseMixin adding serial-address construction to an instrument.
Mix into an
InstrumentBasesubclass. Builds aSerialTransportfrom a VISA resource name, or accepts a ready-madetransport. Subclasses can override this to configure serial settings (e.g. baudrate, parity).-
auto_log_level:
int= 20 The log level used for automatic logging of method calls.
To disable logging set to logging.NOTSET.
- abstract await_completion()
Configure the instrument to wait for all pending operations.
- Return type:
None
- Example implementation:
>>> self.transport.query("*OPC?")
- Or if supported:
>>> self.transport.command("*WAI")
- connect()
Connect to instrument using the transport layer.
- Return type:
None
- disconnect()
- Return type:
None
- get_id()
Identification Query.
- Return type:
str- Returns:
Instrument Identification String.
-
is_connected:
bool
-
logger:
Logger
- abstract reset()
Reset instrument to factory default state, including clearing status.
- Return type:
None
- Example implementation:
>>> self.transport.clear() >>> self.transport.command("*CLS") >>> self.transport.command("*RST")
-
transport:
SerialTransport
-
auto_log_level:
- class inspy.instrument.VisaInstrumentMixin(visa_address=None, transport=None)[source]
Bases:
InstrumentBaseMixin adding VISA-address construction to an instrument.
Mix into an
InstrumentBasesubclass. Builds aPyVisaTransportfrom a VISA address, or accepts a ready-madetransport.-
auto_log_level:
int= 20 The log level used for automatic logging of method calls.
To disable logging set to logging.NOTSET.
- abstract await_completion()
Configure the instrument to wait for all pending operations.
- Return type:
None
- Example implementation:
>>> self.transport.query("*OPC?")
- Or if supported:
>>> self.transport.command("*WAI")
- connect()
Connect to instrument using the transport layer.
- Return type:
None
- disconnect()
- Return type:
None
- get_id()
Identification Query.
- Return type:
str- Returns:
Instrument Identification String.
-
is_connected:
bool
-
logger:
Logger
- abstract reset()
Reset instrument to factory default state, including clearing status.
- Return type:
None
- Example implementation:
>>> self.transport.clear() >>> self.transport.command("*CLS") >>> self.transport.command("*RST")
-
transport:
PyVisaTransport
-
auto_log_level: