Python node
Create Python node
To create a Python node:
- Hover the mouse pointer above the blank node placeholder. “+ New node” title will appear.
- Click on this title. Pop-up menu with node details will appear.
- Type in the node name. The counter at the right end of the line shows how many symbols out of allowed 128 symbols are already used.
- Select the node type by clicking on the blue Python pictogram.
- Click anywhere outside of the node.
AIMES does not allow any two nodes to have the same names. If your project contains several hundreds of nodes please be creative giving nodes their names. As well as Project and Sheet names are limited to 128 symbols Node name could also be no longer than 128 symbols.
Create input connections
The content of the Python node is a more or less complex Python code which receives data from other (Data, Formula or Python) nodes. We will call connections from those nodes “Input connections”.
To create input connection go to the Sheet - Model design view.
- Hover the mouse pointer over the node you want to connect to your Python node. Below the node a Connect to.. tab will appear.
- Click on this Connect to.. tab. Near the mouse pointer a pictogram with this data node name will appear.
- Hover the mouse pointer over the Python node you want to connect to. A pictogram of incoming connection will appear on the Python node.
- Click on the Python node. An arrow representing connection from data node to formula node will appear.
Any type of node could be an input connection for a Python node. Python node could be an input as well as output connection for another formula or Python node. Hence while creating connection between two calculation nodes (Formula node or Python node) when you hover the mouse pointer over the second node it will be divided in halves giving you an option to use this node as input or output.
Set up Python node
To set up Python node either:
- double click on it
- or right-click on it and choose “Details” from the pop-up menu.
Write your code in the Python code editor window. To see some code templates click on ”more” under the ”Learn the basics with examples”. There you can learn how to:
- get values from other nodes;
- use TIME variable;
- perform operations between nodes;
- calculate cumulative sum and sum by period, etc.
After completion of the code click on the Calculate pictogram (triangle ) at the upper right.
In case of errors some short explanations will appear in the pop-up menu. In case of successful calculation results will appear below the code editor window.
For fast navigation to the input and output nodes double-click on them in the left Input and output connections menu.
Edit node
To edit node either:
- Double click on the node or
- Right-click on the node and then click on Details in the summoned menu
Delete node
To delete a node right click on it and select the Delete node pop-up menu item.
Another way to delete a node is to select it and then to press the “Delete” key. The same method could be used to delete a group of nodes.
If the nodes you are going to delete are new nodes where you have not changed anything, they will be deleted without prompting you for confirmation. If any of the nodes you're going to delete has any changes made by you, you will be asked to confirm the deletion.