> import "Simantics/Python" > import "Vector" > > runPython do > executePythonStatement "foo = 'bar'\nd = dir()" > getPythonStringArrayVariable "d" vector ["__builtins__", "__doc__", "__loader__", "__name__", "__package__", "__spec__", "foo"] > runPython do > setPythonDoubleVariable "foo" 1 > executePythonStatement "foo = foo + 1" > getPythonDoubleVariable "foo" 2.0 > runPython do > setPythonDoubleArrayVariable "foo" (vector [1.0, 2.0, 3.0]) > executePythonStatement "foo = foo + [4.0]" > getPythonDoubleArrayVariable "foo" vector [1.0, 2.0, 3.0, 4.0] > runPython do > setPythonIntegerVariable "foo" 5 > executePythonStatement "import math" > executePythonStatement "bar = math.factorial(foo)" > getPythonIntegerVariable "bar" 120 > runPython do > setPythonIntegerArrayVariable "foo" (vector [1, 2, 3, 4]) > executePythonStatement "foo.append(sum(foo))" > getPythonIntegerArrayVariable "foo" vector [1, 2, 3, 4, 10] > ndarray (vector [1, 2, 3]) ndarray(3) [1.0, 2.0, 3.0] > ndarrayM 2 2 (vector [1, 2, 3, 4]) ndarray(2x2) [[1.0, 2.0], [3.0, 4.0]] > a = ndarrayN (vector [2, 2, 3]) (vector [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) > a ndarray(2x2x3) [[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]], [[7.0, 8.0, 9.0], [10.0, 11.0, 12.0]]] > ndarrayDims a vector [2, 2, 3] > ndarrayValues a vector [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0] > ndarrayElement a 5 6.0 > ndarrayElementN a (vector [0, 1, 2]) 6.0 > runPython do > setPythonNDArrayVariable "foo" (ndarrayM 2 3 (vector [1, 2, 3, 4, 5, 6])) > executePythonStatement "bar = foo.cumsum(1)" > getPythonNDArrayVariable "bar" ndarray(2x3) [[1.0, 3.0, 6.0], [4.0, 9.0, 15.0]]