pylab_ml.scope.natinst.pxie51xx.PXIe51xx
- class PXIe51xx(addr=None, identify=False, instName=None)[source]
Bases:
NatInstInterface to the Oscilloscopes NI PXIe-51xx (e.q. 5122)
Until now only initialisation on poor basic functions For more function see: https://nimi-python.readthedocs.io/en/master/niscope.html
call with: scope.inst.thefunctionname
- Initialization arguments:
- addr
Name from the PXI-Slot e.q. PXI1Slot4
- instName
Instance Name from top
- Example: Initialization
>>> scope = PXIe4138('PXI1Slot4',instName='scope') # connect and initialize instrument
>>> scope.trig_channel = 1 >>> scope.trig_level = 1.5 >>> scope.trig_slope = "POS" >>> scope.trig_mode = "norm"
>>> scope.tdiv = 1e-3 >>> scope.tdelay = -3e-3
>>> scope.channel = 1 >>> scope.trace = True >>> scope.vdiv = 1.0 >>> scope.offs = 0
- reset() reset
- identify() instrument message, reflect address & interfade
- message("") instrument message ("string") or ()
- close() terminate interface
- missing()
get_waveform(n) get waveform data from channel n
- missing()
trig_oneshot(t) single measurement trigger to waveform or timeout after t s
- Properties:
missing: memsize
missing: tdiv missing: tdelay missing: trig_mode missing: trig_channel
missing: channel missing: trace missing: vdiv missing: offs missing: waveform
- For more properties or functios see: https://nimi-python.readthedocs.io/en/master/niscope.html
scope.inst.functionname
- __init__(addr=None, identify=False, instName=None)[source]
Initialize the instrument and connect to it.
- Parameters:
addr (str) – Name from the PXI-Slot e.q. PXI1Slot4
identify (bool) – If True, the instrument will be identified during initialization. Default is False.
instName (str) – Instance Name from top
Methods
__init__([addr, identify, instName])Initialize the instrument and connect to it.
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()Print the docstring of the instrument class.
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.
measure([channel, num_of_record, ...])Start to fetch data from the Scope.
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.
plot_scope_data(time, voltage)Plot graph between Time and Voltage.
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.
reopen_session(channels)Reopen last session with channels.
reset()Reset the instrument to its default state.
self_cal([force])Perform self calibration if last self calibration is older than 1 day.
Setup instrument settings
Attributes
Set/get channel number if the instrument have more than one channel.
commandhas_scopeGet the id from the device.
Return with instname or instname[ch] if it has channels.
interchoicesSet/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)
Bases:
EnumPossible Modes for state handling.
- auto = 0
handle commit, uncommit, running automatically
- man = 1
do it by yourselve
- class State(value)
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()
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.
- One 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
- clear()
Clear error status.
- close(force=False)
Close connection to instrument.
- close_session()
Close the session (=inst).
- commit()
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) – The dictionary with the syntax: {attribute/methode name : (Device command for read/write) , range, call functions}.
parent (create_attributes, optional) – If you want to create a child, than you have to set the parent, otherwise None, by default None.
child (str, optional) – The name of the child, by default None.
childname (str, optional) – The name of the child, by default ‘’.
- Return type:
None.
- disable()
Set state from Instrument to uncommitted.
usually handle automtically, if runningmode==’auto’.
- error_list()
List of outstanding errors.
- 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
Get the id from the device.
- identify(showInstName=False)
Identify message.
- init(identify=False)
Optional init for interlock startup after identification.
- initiate()
Set state from Instrument to running.
usually handle automatically, if runningmode==’auto’.
- property instName
Return with instname or instname[ch] if it has channels.
- json = <module 'json' from '/home/runner/miniconda3/envs/test/lib/python3.9/json/__init__.py'>
- local()
Not possible, always remote control.
- measure(channel=[0, 1], num_of_record=1, start_record=0, num_of_samples=None, offset=0)[source]
Start to fetch data from the Scope.
- Parameters:
channel (TYPE, (list or int)) – DESCRIPTION. The default is [0, 1] to measure from both the channels. Can also give ‘0’ or ‘1’ to measure from separate channel.
num_of_record (TYPE, int) – DESCRIPTION. The default is 1. Number of records to fetch. Use -1 to fetch all configured records.
start_record (TYPE, int) – DESCRIPTION. The default is 0. Zero-based index of the first record to fetch.
num_of_samples (TYPE, int) – DESCRIPTION. The default is None. The maximum number of samples to fetch for each waveform. If the acquisition finishes with fewer points than requested, some devices return partial data if the acquisition finished, was aborted. If it fails to complete within the timeout period, the method raises.
offset (TYPE, int) – DESCRIPTION. The default is 0. Offset in samples to start fetching data within each record. The offset can be positive or negative.
- Returns:
x (list) – Contains list of Time values.
y (list) – Contains list of Voltage values.
- 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.
- message(message=None)
Device has no display, message display to logger.info.
- 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.
- plot_scope_data(time, voltage)[source]
Plot graph between Time and Voltage.
- Parameters:
time (list) – Input a list of Time values for x-axis.
voltage (list) – Input a list of Voltage values for y-axis.
- Return type:
None.
- 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
- reopen_session(channels)
Reopen last session with channels.
- reset()[source]
Reset the instrument to its default state. This method will clear all settings and configurations, returning the instrument to its factory defaults.
- property runningmode
Set/get runningmode.
- self_cal(force=True)
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