pylab_ml.example.eg.eg_generic.EG_Generic
- class EG_Generic(**kwargs)[source]
Bases:
ExampleInterface to the Keithley SMU Instruments.
The Keithley baseclass can connect to Keithley SMU instruments
- Initialization arguments:
- Example: Initialization
>>> instrument = Keithley(addr=24) # GPIB or USB address >>> instrument.init() # connect and initialize instrument
- identify()
instrument message, reflect address & interface
- close()
terminate interface
- com_recover(bool)[source]
detect & attempt to recover out of step communication (maybe after timeout)
- inst.write('*RST')
write direct to instrument
- ask=inst.query('
READ?’) write and read the answer
- Properties:
id get IDN string
Methods
__init__(**kwargs)clear()Clear error status
close([force])Close connection to instrument.
com_recover([fix])Can lose coherency between read request and data, usually because of Timeout.
Create an Instrument Session for Instrument.inst, example Keithley2000 or Keithley2400 on Linux usbserial.
list of outstanding errors
find_names() returns list of identifiers strings, lhs of = assignments
help()Print the docstring of the instrument class.
identify([showInstName])Identify message.
init([identify])Connect to Keithley instrument and initialize.
local()Switch back to local instrument control
message([message])Message display.
mqtt_add(client, instrument[, liste, qos])Add the instrument to mqtt.
Remove the instrument from mqtt.
publish(topic, value)Publish topic as type='cmd' with payload=value.
publish_get(function_name, value)Publish function_name as type='get' with paylad=value.
publish_set(function_name, value)Publish function_name as type='set' with paylad=value.
reset()Reset and switch beep off
Setup the instrument settings.
Attributes
commandQuery IDN.
interchoicesmqtt_enablemqtt_listGetter for the mqtt_status.
- close(force=False)
Close connection to instrument.
- com_recover(fix=False)[source]
Can lose coherency between read request and data, usually because of Timeout. This routine can diagnose such loss of coherency and attempt to fix it, when fix=True
- Parameters:
(bool) (fix) – If True, attempt to fix the loss of coherency by consuming extra data from the instrument until it is back in sync. If False, only diagnose the loss of coherency without attempting to fix it.
- Returns:
True if the instrument is back in sync, False otherwise.
- Return type:
bool
- create_session()[source]
Create an Instrument Session for Instrument.inst, example Keithley2000 or Keithley2400 on Linux usbserial.
- find_names()
find_names() returns list of identifiers strings, lhs of = assignments
- Returns:
obj_names – List of identifier strings
- Return type:
list of str
- help()
Print the docstring of the instrument class.
- property id
Query IDN.
- identify(showInstName=False)
Identify message.
- json = <module 'json' from '/home/runner/miniconda3/envs/test/lib/python3.9/json/__init__.py'>
- mqtt_add(client, instrument, liste='#', qos=0)
Add the instrument to mqtt. Calling from base_instrument, after the instrument (device) has been create. Normally you have not to use this function, only base_instrument use it.
- Parameters:
client (mqtt_init) – The MQTT client instance to which the instrument should be added.
instrument (object) – The instrument to be added to the MQTT client.
liste (list or str) – A list of attributes for which MQTT messages should be sent. If set to “#”, all attributes will be included (default: “#”).
qos (int) – The Quality of Service level for MQTT messages (default: 0).
- Return type:
None
- mqtt_disconnect()
Remove the instrument from mqtt. Calling from base_instrument, if the instrument are closing. Normally you have not to use this function, only base_instrument use it.
- property mqtt_status
Getter for the mqtt_status.
- publish(topic, value)
Publish topic as type=’cmd’ with payload=value.
- Parameters:
topic (str) – The name of the topic to publish.
value (any) – The value to be published.
- Return type:
None
- publish_get(function_name, value)
Publish function_name as type=’get’ with paylad=value.
- Parameters:
function_name (str) – The name of the function to be published as a ‘get’ command.
value (any) – The value to be published as the payload of the ‘get’ command.
- Return type:
None
- publish_set(function_name, value)
Publish function_name as type=’set’ with paylad=value.
- Parameters:
function_name (str) – The name of the function to be published as a ‘set’ command.
value (any) – The value to be published as the payload of the ‘set’ command.
- Return type:
None
- setup_inst()
Setup the instrument settings.