Defining Parameters in Python
Define parameters in Python by assigning values to top-level variables—these become accessible throughout your CalcTree page.
Last updated
Define parameters in Python by assigning values to top-level variables—these become accessible throughout your CalcTree page.
Last updated
In CalcTree, parameters are the core building blocks of a calculation. For Python sources, parameters are defined as top-level variables—any variable assigned at the root level of the script (i.e. not inside a function or class).
These variables are automatically extracted and added to the page's parameter list on the right-hand panel, and can be added to the page as parameters that reference the Python parameter
Defining the following in a Python source will create a parameter.
After a short moment, a
will appear as a parameter under the Python source. Its value can be referenced by other sources or reused across the page.
Only variables defined at the top level of the script are treated as parameters
Variables inside functions or conditional blocks will not be extracted
Parameters can be scalar values, arrays, quantities with units, or tables (nested lists)