brian_ast function¶
(Shortest import: from brian2.parsing.bast import brian_ast)
-
brian2.parsing.bast.brian_ast(expr, variables)[source]¶ Returns an AST tree representation with additional information
Each node will be a standard Python
astnode with the following additional attributes:dtypeOne of
'boolean','integer'or'float', referring to the data type of the value of this node.scalarEither
TrueorFalseif the node uses any vector-valued variables.complexityAn integer representation of the computational complexity of the node. This is a very rough representation used for things like
2*(x+y)is less complex than2*x+2*yandexp(x)is more complex than2*xbut shouldn’t be relied on for fine distinctions between expressions.
- Parameters
expr : str
The expression to convert into an AST representation
variables : dict
The dictionary of
Variableobjects used in the expression.