pylab_ml.baseclass.base_natinst.NatInst
- class NatInst(**kwargs)[source]
Bases:
create_attributes,MeasureIntialize Basic Interface to the National Instruments PXIe.
- Date:
May 05, 2026
- Author:
Semi-ATE <info@Semi-ATE.org>
The NatInst baseclass can connect to National Instruments
- __init__(**kwargs)[source]
Initialize.
- Parameters:
**kwargs
- Example Initialization:
>>> kwargs = {"addr": 3, "backend": backend, "identify": False, "instName": 'smu'} >>> instrument = NatInst(**kwargs)
Methods
__init__(**kwargs)Initialize.
abort()Set state from Instrument to uncommitted.
clear()Clear error status.
close([force])Close connection to instrument.
Close the session (=inst).
commit()Set state from Instrument to commit.
createattributes(dictionary[, parent, ...])Create attributes or methods from a dictionary.
disable()Set state from Instrument to uncommitted.
List of outstanding errors.
find_names() returns list of identifiers strings, lhs of = assignments
help()identify([showInstName])Identify message.
init([identify])Optional init for interlock startup after identification.
initiate()Set state from Instrument to running.
local()Not possible, always remote control.
message([message])Device has no display, message display to logger.info.
mfilter(input)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 paylad=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.
reopen_session(channels)Reopen last session with channels.
reset()Do nothing.
self_cal([force])Perform self calibration if last self calibration is older than 1 day.
Will call from class base_instrument.
Attributes
Set/get channel number if the instrument have more than one channel.
commandGet the id from the device.
Return with instname or instname[ch] if it has channels.
Abstract for static class variable interchoices, to list interfaces statically.
Set/get the number of measurement to be carried out in a loop.
mqtt_enablemqtt_listGetter for the mqtt_status.
Set/get runningmode.
Perform the device self-test routine and return pass, otherwise raise an exception.
Set/get state, only set state if necessary.
if something wrong with your called methode, than set the result to self.ATTR_ERROR
last set/get attribute name.
last set attribute value.
- ATTR_ERROR
if something wrong with your called methode, than set the result to self.ATTR_ERROR
- class Runningmode(value)[source]
Bases:
EnumPossible Modes for state handling.
- auto = 0
handle commit, uncommit, running automatically
- man = 1
do it by yourselve
- class State(value)[source]
Bases:
EnumPossible states for the instrument.
actual state
send command
new state
Comment
uncommitted state
commit
committed state
uncommitted state
initiate
running state
committed state
modify any property
uncommitted state
laut Beschreibung, ist das wirklich so?? es wird normalerweise immer eine exception ausglöst
running state
abort
uncommitted state
running state
commit
running state
- committed = 1
committed state
- disabled = -1
reset instrument, output switched off
- running = 2
running state
- uncommitted = 0
uncommitted state
- abort()[source]
Set state from Instrument to uncommitted.
usually handle automatically, if runningmode==’auto’.
- attrLast
last set/get attribute name.
- attrLastvalue
last set attribute value.
- property channel
Set/get channel number if the instrument have more than one channel.
- you can also use:
>>> vdd[0].voltage = 5 # set voltage from channel 0 >>> vdd[1].current = 0.1 # set current from channel 1 >>> v = vdd[1].voltage # measure voltage from channel 1
- close(force=False)
Close connection to instrument.
- commit()[source]
Set state from Instrument to commit.
usually handle automatically, if runningmode==’auto’.
- createattributes(dictionary, parent=None, child=None, childname='')
Create attributes or methods from a dictionary.
syntax from the dictionary see example in the class documentation.
- Parameters:
dictionary (dict) – {attribute/methode name : (Device command for read/write) , range, call functions}.
- Returns:
None.
- disable()[source]
Set state from Instrument to uncommitted.
usually handle automtically, if runningmode==’auto’.
- find_names()
find_names() returns list of identifiers strings, lhs of = assignments
- property id
Get the id from the device.
- identify(showInstName=False)
Identify message.
- init(identify=False)
Optional init for interlock startup after identification.
- initiate()[source]
Set state from Instrument to running.
usually handle automatically, if runningmode==’auto’.
- property instName
Return with instname or instname[ch] if it has channels.
- abstract property interchoices
Abstract for static class variable interchoices, to list interfaces statically.
- json = <module 'json' from '/home/runner/miniconda3/envs/test/lib/python3.9/json/__init__.py'>
- property measurecnt
Set/get the number of measurement to be carried out in a loop.
TODO: this function is not running yet, it is only a dummy
if the result == None than this function not implemented. The return value for the measurement is calculated togetheer with the mfilter setting.
- 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.
- Returns:
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.
- Returns:
None.
- property mqtt_status
Getter for the mqtt_status.
- publish(topic, value)
Publish topic as type=’cmd’ with paylad=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.
- property runningmode
Set/get runningmode.
- self_cal(force=True)[source]
Perform self calibration if last self calibration is older than 1 day.
- Parameters:
force (TYPE, optional) – if force==True -> perform self calibration independent from last calibration. The default is True.
- Returns:
None.
gives information about the calibration
- property selftest
Perform the device self-test routine and return pass, otherwise raise an exception.
After selftest the device is in reset state.
- Returns:
result – state from selftest.
- Return type:
bool