Python Node

Owning Palette: Python Functions

Requires: Base Development System

Calls a Python function directly.

The Python Node is expandable and shows data types for the wired inputs and outputs. You can configure the Python Node to specify the Python session, module path, and function name.

The Python Node is not supported on real-time or FPGA targets.

Details  

 Add to the block diagram  Find on the palette
session in specifies a reference to the Python session. One or more Python Nodes can run in a single Python session.
module path specifies the path to the Python module. The module contains the Python function to call.
function name specifies the name of the Python function to call.
error in describes error conditions that occur before this node runs. This input provides standard error in functionality.
return type specifies the data type of return value. You must wire the data type to return type to indicate the expected data type of return value. If the Python function does not return any value, leave return type unwired.
input parameter specifies the input parameters of the Python function. You can resize the Python Node to add more terminals. You pass a value to the Python function by wiring to the left terminal of a terminal pair. You read the value of a parameter after the function call by wiring from the right terminal of a terminal pair.
session out returns a reference to the Python session.
error out contains error information. This output provides standard error out functionality.
return value is the return value of the Python function.

Python Node Details

Supported Data Types

The Python Node supports a large number of data types. You can use this node to call the following data types:

Calling Conventions

This node converts integers, strings, and Booleans to the corresponding data types in Python, converts arrays to lists or NumPy arrays, and converts clusters to tuples.

Marshaling Arrays to Lists or NumPy Arrays

By default, the Python Node marshals arrays to lists. To marshal an array wired to input parameter to a NumPy array, right-click input parameter and select Marshal to NumPy Array from the shortcut menu.

Note  You can marshal only numeric arrays to NumPy arrays.