KeithleyMp5000#
Controls a Keithley (Tektronix) MP5000 series SMU device (all channels, TSP link and scripting) from Python. This class inherits from MeasmaticDevice.
property channels#
The measurement channels (SMU channels) of the device.
Returns#
| Type | Description |
|---|---|
| Any | The channels as a .NET IEnumerable<IDeviceChannel> . |
Example#
smu = measmatic.get_device('device-keithley-mp5000')
for channel in smu.channels:
print(channel.name)
property configuration#
The configuration of the device, including its TSP node number and the configured TSP nodes.
Returns#
| Type | Description |
|---|---|
| Any | The .NET KeithleyTspDeviceConfigurationBase object of the device. |
Example#
smu = measmatic.get_device('device-keithley-mp5000')
config = smu.configuration
property is_tsp_master#
Indicates whether this device is the TSP master. The master communicates over its own connection; TSP nodes communicate through the connection of their master.
Returns#
| Type | Description |
|---|---|
| bool | True if the device is the TSP master, otherwise False . |
Example#
smu = measmatic.get_device('device-keithley-mp5000')
is_master = smu.is_tsp_master
property lua_syntax#
The Lua syntax flavor used when scripts are generated for this device.
Returns#
| Type | Description |
|---|---|
| Any | The .NET enumeration value Atv.Framework.Devices.Enumerations.KeithleyTspLuaSyntax . |
Example#
smu = measmatic.get_device('device-keithley-mp5000')
syntax = smu.lua_syntax
property master_node#
The TSP master of this device, or the device itself if it is the master.
Returns#
| Type | Description |
|---|---|
| Any | The master as a .NET IKeithleyTspDevice . |
Example#
smu = measmatic.get_device('device-keithley-mp5000')
master = smu.master_node
property model#
The model of the connected instrument.
Returns#
| Type | Description |
|---|---|
| Any | The .NET enumeration value Atv.Framework.Devices.Enumerations.KeithleyModel . |
Example#
smu = measmatic.get_device('device-keithley-mp5000')
model = smu.model
property number_of_channels#
The number of SMU channels of the device.
Returns#
| Type | Description |
|---|---|
| int | The number of channels. |
Example#
smu = measmatic.get_device('device-keithley-mp5000')
count = smu.number_of_channels
property revision#
The firmware version installed on the device.
Returns#
| Type | Description |
|---|---|
| str | The firmware version string. |
Example#
smu = measmatic.get_device('device-keithley-mp5000')
firmware = smu.revision
property serial_number#
The serial number of the device.
Returns#
| Type | Description |
|---|---|
| str | The serial number. |
Example#
smu = measmatic.get_device('device-keithley-mp5000')
serial = smu.serial_number
property tsp_node_number#
The TSP node number of the device.
Returns#
| Type | Description |
|---|---|
| int | The TSP node number. |
Example#
smu = measmatic.get_device('device-keithley-mp5000')
node = smu.tsp_node_number
property tsp_nodes#
The devices that are connected as TSP nodes to this device.
Returns#
| Type | Description |
|---|---|
| Any | The nodes as a .NET IEnumerable<IKeithleyTspDevice> . |
Example#
smu = measmatic.get_device('device-keithley-mp5000')
for node in smu.tsp_nodes:
print(node.TspNodeNumber)
method add_node(nodeDevice: Any)#
Adds a device as TSP node to this device (the TSP master). The node uses the communication connection of the master afterwards. Fails if the node is the master itself, already has nodes of its own or its node number is already populated.
Parameters#
| Name | Description |
|---|---|
| nodeDevice | The TSP device (.NET IKeithleyTspDevice ) that is added as node. |
Example#
smu = measmatic.get_device('device-keithley-mp5000')
smu.add_node(node_device)
method change_tsp_node_number(newTspNodeNumber: int)#
Changes the TSP node number of the device and verifies the new number by reading it back. Fails if the number is already used on the TSP link.
Parameters#
| Name | Description |
|---|---|
| newTspNodeNumber | The new TSP node number. |
Example#
smu = measmatic.get_device('device-keithley-mp5000')
smu.change_tsp_node_number(2)
method check_errors()#
Checks the error queue of the device and raises an exception with the error information if it contains an entry.
Example#
smu = measmatic.get_device('device-keithley-mp5000')
smu.check_errors()
method check_ok(response: str, funcName: str)#
Checks that a response contains the string OK and raises an exception otherwise.
Parameters#
| Name | Description |
|---|---|
| response | The response text that is checked. |
| funcName | The name of the function that is reported in the error message. |
Example#
smu = measmatic.get_device('device-keithley-mp5000')
smu.check_ok(response, 'my_function')
method clear_stop()#
Resets the stop flag of the device that was set by request_stop .
Example#
smu = measmatic.get_device('device-keithley-mp5000')
smu.clear_stop()
method execute_lua_function(functionName: str, response: Any, responseCount: int = 1, *args: Any)#
Calls a Lua function on the device and reads the requested number of response lines. The arguments are converted to text and passed unchanged, so string arguments need their own Lua quotes.
Parameters#
| Name | Description |
|---|---|
| functionName | The name of the Lua function. |
| response | Out parameter, returned as part of the result tuple. The response lines received from the |
| responseCount | The number of response lines to read. Default: 1 |
| args | The arguments of the Lua function. |
Returns#
| Type | Description |
|---|---|
| str | The first response line, or an empty string if no response was requested. |
| str | All response lines that were read. |
Example#
smu = measmatic.get_device('device-keithley-mp5000')
first, responses = smu.execute_lua_function('my_function', 1, 5.0)
method execute_script(scriptName: str, reader: Any, checkErrors: bool = False)#
Loads a script from a reader onto the device and runs it.
Parameters#
| Name | Description |
|---|---|
| scriptName | The name under which the script is stored on the device. |
| reader | A .NET System.IO.TextReader that provides the script lines. |
| checkErrors | If True , the error queue of the device is checked after the script ran. Default: false |
Example#
smu = measmatic.get_device('device-keithley-mp5000')
from System.IO import StringReader
smu.execute_script('my_script', StringReader(script_text))
method execute_script_file(scriptName: str, fileName: str, checkErrors: bool = False)#
Loads a script from a file onto the device and runs it.
Parameters#
| Name | Description |
|---|---|
| scriptName | The name under which the script is stored on the device. |
| fileName | The path of the script file. |
| checkErrors | If True , the error queue of the device is checked after the script ran. Default: false |
Example#
smu = measmatic.get_device('device-keithley-mp5000')
smu.execute_script_file('my_script', 'C:/scripts/my_script.lua')
method execute_script_string(scriptName: str, script: str, checkErrors: bool = False)#
Loads a script from a string onto the device and runs it.
Parameters#
| Name | Description |
|---|---|
| scriptName | The name under which the script is stored on the device. |
| script | The script text. |
| checkErrors | If True , the error queue of the device is checked after the script ran. Default: false |
Example#
smu = measmatic.get_device('device-keithley-mp5000')
smu.execute_script_string('my_script', 'print(1)', True)
method is_tsp_node_number_occupied(tspNodeNumber: int)#
Checks on the TSP link whether a device is present with the given node number. The check is independent of the configuration.
Parameters#
| Name | Description |
|---|---|
| tspNodeNumber | The TSP node number to check. |
Returns#
| Type | Description |
|---|---|
| bool | True if the node number is used, otherwise False . |
Example#
smu = measmatic.get_device('device-keithley-mp5000')
occupied = smu.is_tsp_node_number_occupied(2)
method load_script(scriptName: str, reader: Any)#
Stores a script from a reader on the device without running it.
Parameters#
| Name | Description |
|---|---|
| scriptName | The name under which the script is stored on the device. |
| reader | A .NET System.IO.TextReader that provides the script lines. |
Example#
smu = measmatic.get_device('device-keithley-mp5000')
from System.IO import StringReader
smu.load_script('my_script', StringReader(script_text))
method load_script_file(scriptName: str, fileName: str)#
Stores a script from a file on the device without running it.
Parameters#
| Name | Description |
|---|---|
| scriptName | The name under which the script is stored on the device. |
| fileName | The path of the script file. |
Example#
smu = measmatic.get_device('device-keithley-mp5000')
smu.load_script_file('my_script', 'C:/scripts/my_script.lua')
method load_script_string(scriptName: str, script: str)#
Stores a script from a string on the device without running it.
Parameters#
| Name | Description |
|---|---|
| scriptName | The name under which the script is stored on the device. |
| script | The script text. |
Example#
smu = measmatic.get_device('device-keithley-mp5000')
smu.load_script_string('my_script', 'print(1)')
method node_exists(tspNodeNumber: int)#
Checks on the TSP link whether a node with the given number exists.
Parameters#
| Name | Description |
|---|---|
| tspNodeNumber | The TSP node number to check. |
Returns#
| Type | Description |
|---|---|
| bool | True if the node exists, otherwise False . |
Example#
smu = measmatic.get_device('device-keithley-mp5000')
exists = smu.node_exists(2)
method node_prefix()#
Returns the prefix that has to be put in front of a command to execute it on this device instead of on the master.
Returns#
| Type | Description |
|---|---|
| str | An empty string for the TSP master, otherwise node[n]. with the TSP node number n. |
Example#
smu = measmatic.get_device('device-keithley-mp5000')
prefix = smu.node_prefix()
method request_stop()#
Requests the abort of the currently running script by setting the stop flag in the device. The abort is cooperative: the running script has to check the flag.
Example#
smu = measmatic.get_device('device-keithley-mp5000')
smu.request_stop()
method run_script(scriptName: str)#
Runs a script that is stored on the device.
Parameters#
| Name | Description |
|---|---|
| scriptName | The name of the stored script. |
Example#
smu = measmatic.get_device('device-keithley-mp5000')
smu.run_script('my_script')
method scan_tsp_bus()#
Scans the TSP link for devices (node numbers 1 to 64).
Returns#
| Type | Description |
|---|---|
| Any | The node numbers of all devices found, as a .NET IEnumerable<int> . |
Example#
smu = measmatic.get_device('device-keithley-mp5000')
nodes = list(smu.scan_tsp_bus())
method to_log_string()#
Returns a text with information about the device (name, model, TSP node, serial number and firmware) for logging.
Returns#
| Type | Description |
|---|---|
| str | The information text. |
Example#
smu = measmatic.get_device('device-keithley-mp5000')
info = smu.to_log_string()