pylab_ml.scope.natinst.pxie51xx.PXIe5172

class PXIe5172(addr=None, identify=False, instName=None)[source]

Bases: PXIe51xx

Interface to the Oscilloscopes NI PXIe-5172

__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_session()

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.

error_list()

List of outstanding errors.

find_names()

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.

mqtt_disconnect()

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_inst()

Setup instrument settings

Attributes

channel

Set/get channel number if the instrument have more than one channel.

command

has_scope

id

Get the id from the device.

instName

Return with instname or instname[ch] if it has channels.

interchoices

measurecnt

Set/get the number of measurement to be carried out in a loop.

mqtt_enable

mqtt_list

mqtt_status

Getter for the mqtt_status.

runningmode

Set/get runningmode.

selftest

Perform the device self-test routine and return pass, otherwise raise an exception.

state

Set/get state, only set state if necessary.

ATTR_ERROR

if something wrong with your called methode, than set the result to self.ATTR_ERROR

attrLast

last set/get attribute name.

attrLastvalue

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: Enum

Possible Modes for state handling.

auto = 0

handle commit, uncommit, running automatically

man = 1

do it by yourselve

class State(value)

Bases: Enum

Possible 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)

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)

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()

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

setup_inst()

Setup instrument settings

property state

Set/get state, only set state if necessary.

Parameters:

newstate: str or State

state to be set, must be in self.State list.

Returns:

state: State

current state of the instrument.