pynestml.meta_model package
Submodules
pynestml.meta_model.ast_arithmetic_operator module
- class pynestml.meta_model.ast_arithmetic_operator.ASTArithmeticOperator(is_times_op: bool, is_div_op: bool, is_modulo_op: bool, is_plus_op: bool, is_minus_op: bool, is_pow_op: bool, *args, **kwargs)
Bases:
ASTNode
This class is used to store a single arithmetic operator, e.g. +.
No grammar. This part is defined outside the grammar to make processing and storing of models easier and comprehensible.
- is_times_op = False # type
bool
- is_div_op = False # type
bool
- is_modulo_op = False # type
bool
- is_plus_op = False # type
bool
- is_minus_op = False # type
bool
- is_pow_op = False # type
bool
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
pynestml.meta_model.ast_assignment module
- class pynestml.meta_model.ast_assignment.ASTAssignment(lhs: ASTVariable | None = None, is_direct_assignment: bool = False, is_compound_sum: bool = False, is_compound_minus: bool = False, is_compound_product: bool = False, is_compound_quotient: bool = False, rhs: ASTExpression | None = None, *args, **kwargs)
Bases:
ASTNode
This class is used to store assignments. Grammar:
- assignmentlhs_variable=variable
(directAssignment=’=’ | compoundSum=’+=’ | compoundMinus=’-=’ | compoundProduct=’*=’ | compoundQuotient=’/=’) rhs;
- lhs = None
- is_direct_assignment = False
- is_compound_sum = False
- is_compound_minus = False
- is_compound_product = False
- is_compound_quotient = False
- rhs = None
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- construct_equivalent_direct_assignment_rhs(operator, lhs_variable, rhs_in_brackets)
- deconstruct_compound_assignment()
From lhs and rhs it constructs a new expression which corresponds to direct assignment. E.g.: a += b*c -> a = a + b*c :return: the rhs for an equivalent direct assignment. :rtype: ast_expression
- equals(other)
The equals operation. :param other: a different object. :type other: object :return: True if equal, otherwise False. :rtype: bool
- extract_operator_from_compound_assignment()
- get_bracketed_rhs_expression()
- get_expression()
Returns the right-hand side rhs. :return: rhs object. :rtype: ast_expression
- get_lhs_variable_as_expression()
- get_parent(ast)
Indicates whether a this node contains the handed over node. :param ast: an arbitrary meta_model node. :type ast: AST_ :return: AST if this or one of the child nodes contains the handed over element. :rtype: AST_ or None
- get_variable()
Returns the left-hand side variable. :return: left-hand side variable object. :rtype: ASTVariable
pynestml.meta_model.ast_bit_operator module
- class pynestml.meta_model.ast_bit_operator.ASTBitOperator(is_bit_and=False, is_bit_xor=False, is_bit_or=False, is_bit_shift_left=False, is_bit_shift_right=False, *args, **kwargs)
Bases:
ASTNode
This class is used to store a single bit operator. Grammar:
bitOperator : (bitAnd=’&’| bitXor=’^’ | bitOr=’|’ | bitShiftLeft=’<<’ | bitShiftRight=’>>’);
- is_bit_and = False
- is_bit_xor = False
- is_bit_or = False
- is_bit_shift_left = False
- is_bit_shift_right = False
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- equals(other)
The equals method. :param other: a different object. :type other: object :return: True if equal, otherwise False. :rtype: bool
pynestml.meta_model.ast_block module
- class pynestml.meta_model.ast_block.ASTBlock(stmts, *args, **kwargs)
Bases:
ASTNode
This class is used to store a single block of declarations, i.e., statements. Grammar:
block : ( smallStmt | compoundStmt | NEWLINE )*;
- Attribute:
stmts = None
- add_stmt(stmt)
Adds a single statement to the list of statements. :param stmt: a statement :type stmt: ASTSmallStmt,ASTCompoundStmt
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- delete_stmt(stmt)
Deletes the handed over statement. :param stmt: :type stmt: :return: True if deleted, otherwise False. :rtype: bool
- equals(other)
The equals method. :param other: a different object. :type other: object :return: True if equal, otherwise False. :rtype: bool
- get_parent(ast)
Indicates whether a this node contains the handed over node. :param ast: an arbitrary meta_model node. :type ast: AST_ :return: AST if this or one of the child nodes contains the handed over element. :rtype: AST_ or None
- get_stmts()
Returns the list of statements. :return: list of stmts. :rtype: list(ASTSmallStmt/ASTCompoundStmt)
pynestml.meta_model.ast_block_with_variables module
- class pynestml.meta_model.ast_block_with_variables.ASTBlockWithVariables(is_state=False, is_parameters=False, is_internals=False, declarations=None, *args, **kwargs)
Bases:
ASTNode
This class is used to store a block of variable declarations. ast_block_with_variables.py represent a block with variables, e.g.:
- state:
y0, y1, y2, y3 mV [y1 > 0; y2 > 0]
attribute state true: if the varblock is a state. attribute parameter: true if the varblock is a parameter. attribute internal: true if the varblock is a state internal. attribute AliasDecl: a list with variable declarations Grammar:
- blockWithVariables:
blockType=(‘state’|’parameters’|’internals’) BLOCK_OPEN
(declaration | NEWLINE)*
BLOCK_CLOSE;
- is_state = False
- is_parameters = False
- is_internals = False
- declarations = None
- clear()
Clears the list of declarations in this block.
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- equals(other=None)
The equals method. :param other: a different object. :type other: object :return: True if equal, otherwise False :rtype: bool
- get_declarations()
Returns the set of stored declarations. :return: set of declarations :rtype: set(ASTDeclaration)
pynestml.meta_model.ast_comparison_operator module
- class pynestml.meta_model.ast_comparison_operator.ASTComparisonOperator(is_lt=False, is_le=False, is_eq=False, is_ne=False, is_ne2=False, is_ge=False, is_gt=False, *args, **kwargs)
Bases:
ASTNode
This class is used to store a single comparison operator. Grammar:
comparisonOperator : (lt=’<’ | le=’<=’ | eq=’==’ | ne=’!=’ | ne2=’<>’ | ge=’>=’ | gt=’>’);
- is_lt = False
- is_le = False
- is_eq = False
- is_ne = False
- is_ne2 = False
- is_ge = False
- is_gt = False
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- equals(other)
The equals method. :param other: a different object. :type other: object :return: True if equal, otherwise False. :rtype: bool
pynestml.meta_model.ast_compound_stmt module
- class pynestml.meta_model.ast_compound_stmt.ASTCompoundStmt(if_stmt=None, while_stmt=None, for_stmt=None, *args, **kwargs)
Bases:
ASTNode
This class is used to store compound statements. Grammar:
- compoundStmtifStmt
- forStmtwhileStmt;
- if_stmt = None
- while_stmt = None
- for_stmt = None
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- equals(other)
The equals method. :param other: a different object. :type other: object :return: True if equal, otherwise False. :rtype: bool
- get_for_stmt()
Returns the for statement. :return: the for statement. :rtype: ASTForStmt
- get_if_stmt()
Returns the “if” statement. :return: the “if” statement. :rtype: ASTIfStmt
- get_parent(ast)
Indicates whether a this node contains the handed over node. :param ast: an arbitrary meta_model node. :type ast: AST_ :return: AST if this or one of the child nodes contains the handed over element. :rtype: AST_ or None
- get_while_stmt()
Returns the while statement. :return: the while statement. :rtype: ASTWhileStmt
- is_for_stmt()
Returns whether it is an “for” statement or not. :return: True if “for” stmt, False else. :rtype: bool
- is_if_stmt()
Returns whether it is an “if” statement or not. :return: True if if stmt, False else. :rtype: bool
- is_while_stmt()
Returns whether it is an “while” statement or not. :return: True if “while” stmt, False else. :rtype: bool
pynestml.meta_model.ast_data_type module
- class pynestml.meta_model.ast_data_type.ASTDataType(is_integer=False, is_real=False, is_string=False, is_boolean=False, is_void=False, unit_type: ASTUnitType | None = None, type_symbol=None, *args, **kwargs)
Bases:
ASTNode
A datatype class as used to store a datatype of an element. ASTDataType. Represents predefined datatypes and gives a possibility to use an unit datatype. @attribute boolean getters for integer, real, … @attribute unitType a SI datatype datatype : ‘integer’
‘real’‘string’‘boolean’‘void’unitType;- is_integer = False
- is_real = False
- is_string = False
- is_boolean = False
- is_void = False
- unit_type = None # a unit type is not a boolean, but a concrete object
- type_symbol = None # the corresponding type symbol
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- equals(other)
The equals method. :param other: a different object :type other: object :return: True if equal, otherwise False. :rtype: bool
- get_parent(ast)
Indicates whether a this node contains the handed over node. :param ast: an arbitrary meta_model node. :type ast: AST_ :return: AST if this or one of the child nodes contains the handed over element. :rtype: AST_ or None
- get_type_symbol()
Returns the corresponding type symbol. :return: a single type symbol element. :rtype: type_symbol
- get_unit_type()
Returns the unit type. :return: the unit type object. :rtype: ASTUnitType
- is_unit_type()
Returns whether this is a unit type or not. :return: True if unit type typed, otherwise False. :rtype: bool
- set_type_symbol(type_symbol)
Updates the current type symbol to the handed over one. :param type_symbol: a new type symbol element. :type type_symbol: TypeSymbol.
pynestml.meta_model.ast_declaration module
- class pynestml.meta_model.ast_declaration.ASTDeclaration(is_recordable: bool = False, is_inline_expression: bool = False, _variables: List[ASTVariable] | None = None, data_type: ASTDataType | None = None, size_parameter: str | None = None, expression: ASTExpression | None = None, invariant: ASTExpression | None = None, decorators=None, *args, **kwargs)
Bases:
ASTNode
This class is used to store declarations. ASTDeclaration A variable declaration. It can be a simple declaration defining one or multiple variables: ‘a,b,c real = 0’. @attribute hide is true iff. declaration is not traceable. @attribute function is true iff. declaration is an function. @attribute vars List with variables @attribute Datatype Obligatory data type, e.g. ‘real’ or ‘mV/s’ @attribute sizeParameter An optional array parameter. E.g. ‘tau_syn ms[n_receptors]’ @attribute expr An optional initial rhs, e.g. ‘a real = 10+10’ @attribute invariants List with optional invariants. Grammar:
- declaration :
(‘recordable’)? (‘function’)? variable (‘,’ variable)* datatype (‘[’ sizeParameter=NAME ‘]’)? ( ‘=’ rhs)? (‘[[’ invariant=rhs ‘]]’)?;
- is_recordable = False
- is_inline_expression = False
- variables = None
- data_type = None
- size_parameter = None
- expression = None
- invariant = None
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- equals(other)
The equals method. :param other: a different object. :type other: object :return: True if equal, otherwise False. :rtype: bool
- get_data_type()
Returns the data type. :return: a data type object. :rtype: ASTDataType
- get_decorators()
- get_expression()
Returns the right-hand side rhs. :return: the right-hand side rhs. :rtype: ASTExpression
- get_invariant()
Returns the invariant. :return: the invariant :rtype: ASTExpression
- get_parent(ast)
Indicates whether a this node contains the handed over node. :param ast: an arbitrary meta_model node. :type ast: AST_ :return: AST if this or one of the child nodes contains the handed over element. :rtype: AST_ or None
- get_size_parameter()
Returns the size parameter. :return: the size parameter. :rtype: str
- get_variables()
Returns the set of left-hand side variables. :return: a list of variables. :rtype: list(ASTVariables)
- has_expression()
Returns whether the declaration has a right-hand side rhs or not. :return: True if right-hand side rhs declared, else False. :rtype: bool
- has_invariant()
Returns whether the declaration has a invariant or not. :return: True if has invariant, otherwise False. :rtype: bool
- has_size_parameter()
Returns whether the declaration has a size parameter or not. :return: True if has size parameter, else False. :rtype: bool
- set_expression(expr: ASTExpression) None
- set_size_parameter(_parameter)
Updates the current size parameter to a new value. :param _parameter: the size parameter :type _parameter: str
pynestml.meta_model.ast_elif_clause module
- class pynestml.meta_model.ast_elif_clause.ASTElifClause(condition, block, *args, **kwargs)
Bases:
ASTNode
This class is used to store elif-clauses. Grammar:
elifClause : ‘elif’ rhs BLOCK_OPEN block;
- Attribute:
condition = None block = None
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- equals(other)
The equals method. :param other: a different object. :type other: object :return: True if equal, otherwise False. :rtype: bool
- get_block()
Returns the block of statements. :return: the block of statements. :rtype: ast_block
- get_condition()
Returns the condition of the block. :return: the condition. :rtype: ast_expression
pynestml.meta_model.ast_else_clause module
- class pynestml.meta_model.ast_else_clause.ASTElseClause(block, *args, **kwargs)
Bases:
ASTNode
This class is used to store a single else-clause. Grammar:
elseClause : ‘else’ BLOCK_OPEN block;
- block = None
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- equals(other)
The equals method. :param other: a different object. :type other: object :return: True if equal, otherwise False. :rtype: bool
- get_block()
Returns the block of statements. :return: the block of statements. :rtype: ast_block
pynestml.meta_model.ast_equations_block module
- class pynestml.meta_model.ast_equations_block.ASTEquationsBlock(declarations, *args, **kwargs)
Bases:
ASTNode
This class is used to store an equations block. ASTEquationsBlock a special function definition:
- equations:
G = (e/tau_syn) * t * exp(-1/tau_syn*t) V’ = -1/Tau * V + 1/C_m * (convolve(G, spikes) + I_e + I_stim)
@attribute odeDeclaration Block with equations and differential equations. Grammar:
- equationsBlock:
‘equations’ BLOCK_OPEN
(inlineExpression | odeEquation | kernel | NEWLINE)+
BLOCK_CLOSE;
- declarations = None
- clear()
Deletes all declarations as stored in this block.
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- equals(other: Any) bool
The equals method. :param other: a different object. :return: True if equal, otherwise False.
- get_declarations()
Returns the block of definitions. :return: the block :rtype: list(ASTInlineExpression|ASTOdeEquation|ASTKernel)
- get_inline_expressions() Sequence[ASTInlineExpression]
Returns a list of all inline expressions in this block. :return: a list of all inline expressions.
- get_kernels() Sequence[ASTKernel]
Returns a list of all kernels in this block. :return: a list of all kernels.
- get_ode_equations() Sequence[ASTOdeEquation]
Returns a list of all ode equations in this block. :return: a list of all ode equations.
pynestml.meta_model.ast_expression module
- class pynestml.meta_model.ast_expression.ASTExpression(is_encapsulated: bool = False, unary_operator: ASTUnaryOperator | None = None, is_logical_not: bool = False, expression: ASTExpression | None = None, lhs: ASTExpression | None = None, binary_operator: ASTLogicalOperator | ASTComparisonOperator | ASTBitOperator | ASTArithmeticOperator | None = None, rhs: ASTExpression | None = None, condition: ASTExpression | None = None, if_true: ASTExpression | None = None, if_not: ASTExpression | None = None, has_delay: bool = False, *args, **kwargs)
Bases:
ASTExpressionNode
ASTExpr, i.e., several subexpressions combined by one or more operators, e.g., 10mV + V_m - (V_reset * 2)/ms …. or a simple rhs, e.g. 10mV. Grammar:
- rhsleftParentheses=’(’ rhs rightParentheses=’)’
- <assoc=right> base=rhs powOp=’**’ exponent=rhsunaryOperator term=rhsleft=rhs (timesOp=’*’ | divOp=’/’ | moduloOp=’%’) right=rhsleft=rhs (plusOp=’+’ | minusOp=’-’) right=rhsleft=rhs bitOperator right=rhsleft=rhs comparisonOperator right=rhslogicalNot=’not’ rhsleft=rhs logicalOperator right=rhscondition=rhs ‘?’ ifTrue=rhs ‘:’ ifNot=rhssimpleExpression
;
- # encapsulated or with unary operator or with a logical not or just a simple rhs.
- is_encapsulated = False
- is_logical_not = False
- unary_operator = None
- expression = None
- # lhs and rhs combined by an operator
- lhs = None
- binary_operator = None
- rhs = None
- # ternary operator
- condition = None
- if_true = None
- if_not = None
- # simple rhs
- simple_expression = None
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- equals(other)
The equals method. :param other: a different object. :type other: object :return: True if equal, otherwise False. :rtype: bool
- get_binary_operator()
Returns the binary operator. :return: the binary operator. :rtype: one of ASTLogicalOperator,ASTComparisonOperator,ASTBitOperator,ASTArithmeticOperator
- get_condition()
Returns the condition rhs. :return: the condition rhs. :rtype: ASTExpression
- get_expression()
Returns the rhs. :return: the rhs. :rtype: ASTExpression
- get_function_calls()
Returns a list of all function calls as used in this rhs :return: a list of all function calls in this rhs. :rtype: list(ASTFunctionCall)
- get_has_delay()
Returns the has_delay parameter :return:
- get_if_not()
Returns the rhs used in the case that the condition does not hold. :return: the if-not condition. :rtype: ASTExpression
- get_if_true()
Returns the rhs used in the case that the condition holds. :return: the if-true condition. :rtype: ASTExpression
- get_lhs()
Returns the left-hand side rhs. :return: the left-hand side rhs. :rtype: ASTExpression
- get_parent(ast=None)
Indicates whether a this node contains the handed over node. :param ast: an arbitrary meta_model node. :type ast: AST_ :return: AST if this or one of the child nodes contains the handed over element. :rtype: AST_ or None
- get_rhs()
Returns the right-hand side rhs. :return: the right-hand side rhs. :rtype: ASTExpression
- get_unary_operator()
Returns the unary operator. :return: the unary operator. :rtype: ASTUnaryOperator.
- get_units()
Returns a list of all units as use in this rhs. :return: a list of all used units. :rtype: list(ASTVariable)
- get_variables()
Returns a list of all variables as used in this rhs. :return: a list of variables. :rtype: list(ASTVariable)
- is_compound_expression()
Returns whether it is a compound rhs, e.g., 10+10 :return: True if compound rhs, otherwise False. :rtype: bool
- is_ternary_operator()
Returns whether it is a ternary operator. :return: True if ternary operator, otherwise False. :rtype: bool
- is_unary_operator()
Returns whether the rhs uses an unary operator. :return: True if unary operator, otherwise False. :rtype: bool
pynestml.meta_model.ast_expression_node module
- class pynestml.meta_model.ast_expression_node.ASTExpressionNode(*args, **kwargs)
Bases:
ASTNode
This class is not a part of the grammar but is used to store commonalities of expression-type nodes.
This class is abstract, thus no instances can be created.
- equals(other)
The equals operation. :param other: a different object. :type other: object :return: True if equal, otherwise False. :rtype: bool
- get_parent(ast)
Indicates whether a this node contains the handed over node. :param ast: an arbitrary meta_model node. :type ast: AST_ :return: AST if this or one of the child nodes contains the handed over element. :rtype: AST_ or None
- property type
pynestml.meta_model.ast_external_variable module
- class pynestml.meta_model.ast_external_variable.ASTExternalVariable(name, altname=None, altscope=None, *args, **kwargs)
Bases:
ASTVariable
This class is used to store a single “external” variable: a variable the value of which is obtained during runtime from a neuron’s postsynaptic partner.
- clone()
Return a clone (“deep copy”) of this node.
- get_alternate_name()
- get_scope()
Returns the scope of this element. :return: a scope object. :rtype: Scope
- update_alt_scope(scope)
pynestml.meta_model.ast_for_stmt module
- class pynestml.meta_model.ast_for_stmt.ASTForStmt(variable, start_from, end_at, step, block, *args, **kwargs)
Bases:
ASTNode
This class is used to store a for-block. Grammar:
- forStmt‘for’ var=NAME ‘in’ vrom=rhs
‘…’ to=rhs ‘step’ step=signedNumericLiteral BLOCK_OPEN block BLOCK_CLOSE;
- variable = None
- start_from = None
- end_at = None
- step = None
- block = None
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- equals(other)
The equals method. :param other: a different object. :type other: object :return: True if equal, otherwise False. :rtype: bool
- get_block()
Returns the block of statements. :return: the block of statements. :rtype: ast_block
- get_end_at()
Returns the to-statement. :return: the rhs indicating the finish value. :rtype: ast_expression
- get_parent(ast)
Indicates whether a this node contains the handed over node. :param ast: an arbitrary meta_model node. :type ast: AST_ :return: AST if this or one of the child nodes contains the handed over element. :rtype: AST_ or None
- get_start_from()
Returns the from-statement. :return: the rhs indicating the start value. :rtype: ast_expression
- get_step()
Returns the length of a single step. :return: the length as a float. :rtype: float
- get_variable()
Returns the name of the step variable. :return: the name of the step variable. :rtype: str
pynestml.meta_model.ast_function module
- class pynestml.meta_model.ast_function.ASTFunction(name: str, parameters: List[ASTParameter], return_type: ASTDataType | None, block: ASTBlock, type_symbol=None, *args, **kwargs)
Bases:
ASTNode
This class is used to store a user-defined function. ASTFunction a function definition:
- function set_V_m(v mV):
y3 = v - E_L
@attribute name Functionname. @attribute parameter A single parameter. @attribute returnType Complex return type, e.g. String @attribute primitiveType Primitive return type, e.g. int @attribute block Implementation of the function. Grammar: function: ‘function’ NAME ‘(’ (parameter (‘,’ parameter)*)? ‘)’ (returnType=datatype)?
- BLOCK_OPEN
block
BLOCK_CLOSE;
- name = None
- parameters = None
- return_type = None
- block = None
- # the corresponding type symbol
- type_symbol = None
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- equals(other)
The equals method. :param other: a different object. :type other: object :return: True if equal, otherwise False. :rtype: bool
- get_block()
Returns the block containing the definitions. :return: the block of the definitions. :rtype: ast_block
- get_name()
Returns the name of the function. :return: the name of the function. :rtype: str
- get_parameters() List[ASTParameter]
Returns the list of parameters. :return: a parameters object containing the list.
- get_parent(ast)
Indicates whether a this node contains the handed over node. :param ast: an arbitrary meta_model node. :type ast: AST_ :return: AST if this or one of the child nodes contains the handed over element. :rtype: AST_ or None
- get_return_type()
Returns the return type of function. :return: the return type :rtype: ast_data_type
- get_type_symbol()
Returns the type symbol of this rhs. :return: a single type symbol. :rtype: type_symbol
- has_parameters() bool
Returns whether parameters have been defined. :return: True if parameters defined, otherwise False.
- has_return_type()
Returns whether return a type has been defined. :return: True if return type defined, otherwise False. :rtype: bool
- set_type_symbol(type_symbol)
Updates the current type symbol to the handed over one. :param type_symbol: a single type symbol object. :type type_symbol: type_symbol
pynestml.meta_model.ast_function_call module
- class pynestml.meta_model.ast_function_call.ASTFunctionCall(callee_name, function_call_args, *args, **kwargs)
Bases:
ASTNode
This class is used to store a single function call. ASTFunctionCall Represents a function call, e.g. myFun(“a”, “b”). @attribute name The (qualified) name of the function @attribute args Comma separated list of expressions representing parameters. Grammar:
functionCall : calleeName=NAME ‘(’ (rhs (‘,’ rhs)*)? ‘)’;
- callee_name = None
- args = None
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- equals(other)
The equals method. :param other: a different object. :type other: object :return: True if equal, otherwise False. :rtype: bool
- get_args()
Returns the list of arguments. :return: the list of arguments. :rtype: list(ASTExpression)
- get_name()
Returns the name of the called function. :return: the name of the function. :rtype: str.
- get_parent(ast)
Indicates whether a this node contains the handed over node. :param ast: an arbitrary meta_model node. :type ast: AST_ :return: AST if this or one of the child nodes contains the handed over element. :rtype: AST_ or None
- has_args()
Returns whether function call has arguments or not. :return: True if has arguments, otherwise False. :rtype: bool
pynestml.meta_model.ast_if_clause module
- class pynestml.meta_model.ast_if_clause.ASTIfClause(condition, block, *args, **kwargs)
Bases:
ASTNode
This class is used to store a single if-clause. Grammar:
ifClause : ‘if’ expr BLOCK_OPEN block;
- condition = None
- block = None
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- equals(other)
The equals method. :param other: a different object. :type other: object :return: True if equals, otherwise False. :rtype: bool
- get_block()
Returns the block of statements. :return: the block of statements. :rtype: ASTBlock
- get_condition()
Returns the condition of the block. :return: the condition. :rtype: ASTExpression
- get_parent(ast)
Indicates whether a this node contains the handed over node. :param ast: an arbitrary meta_model node. :type ast: ASTNode :return: AST if this or one of the child nodes contains the handed over element. :rtype: Optional[ASTNode]
pynestml.meta_model.ast_if_stmt module
- class pynestml.meta_model.ast_if_stmt.ASTIfStmt(if_clause, elif_clauses=None, else_clause=None, *args, **kwargs)
Bases:
ASTNode
This class is used to store a single if block. Grammar:
- ifStmtifClause
elifClause* (elseClause)? BLOCK_CLOSE;
- if_clause = None
- elif_clauses = None
- else_clause = None
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- equals(other)
The equals method. :param other: a different object. :type other: object :return: True if equals, otherwise False. :rtype: bool
- get_elif_clauses()
Returns a list of elif-clauses. :return: a list of elif-clauses. :rtype: List[ASTElifClause]
- get_else_clause()
Returns the else-clause. :return: the else-clause. :rtype: ASTElseClause
- get_if_clause()
Returns the if-clause. :return: the if clause :rtype: ASTfClause
- get_parent(ast)
Indicates whether a this node contains the handed over node. :param ast: an arbitrary meta_model node. :type ast: ASTNode :return: AST if this or one of the child nodes contains the handed over element. :rtype: Optional[ASTNode]
- has_elif_clauses()
Returns whether object contains elif clauses. :return: True if at leas one elif clause, False else. :rtype: bool
- has_else_clause()
Returns whether object contains elif clauses. :return: True if object contains an else-clause, False else. :rtype: bool
pynestml.meta_model.ast_inline_expression module
- class pynestml.meta_model.ast_inline_expression.ASTInlineExpression(is_recordable=False, variable_name=None, data_type=None, expression=None, decorators=None, *args, **kwargs)
Bases:
ASTNode
- Stores a single declaration of an inline expression, e.g.,
inline v_init mV = V_m - 50mV.
- Grammar:
inline : (recordable=’recordable’)? INLINE_KEYWORD variableName=NAME datatype ‘=’ rhs;
- is_recordable = False
- variable_name = None
- data_type = None
- expression = None
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- equals(other)
The equals method. :param other: a different object. :type other: object :return: True if equal, otherwise False. :rtype: bool
- get_data_type()
Returns the data type as an object of ASTDatatype. :return: the type as an object of ASTDatatype. :rtype: ast_data_type
- get_decorators()
- get_expression()
Returns the rhs as an object of ASTExpression. :return: the rhs as an object of ASTExpression. :rtype: ast_expression
- get_parent(ast)
Indicates whether a this node contains the handed over node. :param ast: an arbitrary meta_model node. :type ast: AST_ :return: AST if this or one of the child nodes contains the handed over element. :rtype: AST_ or None
- get_variable_name()
Returns the variable name. :return: the name of the variable. :rtype: str
pynestml.meta_model.ast_input_block module
- class pynestml.meta_model.ast_input_block.ASTInputBlock(input_definitions=None, *args, **kwargs)
Bases:
ASTNode
This class is used to store blocks of input definitions. ASTInputBlock represents the input block, e.g.:
input: spike_in pA <- excitatory spike current_in pA <- continuous
@attribute inputPort set of input ports. Grammar:
- inputBlock: ‘input’
- BLOCK_OPEN
(inputPort | NEWLINE)*
BLOCK_CLOSE;
- input_definitions = None
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- equals(other)
The equals method. :param other: a different object. :type other: object :return: True if equal, otherwise False. :rtype: bool
- get_input_ports()
Returns the list of input ports. :return: a list of input ports :rtype: list(ASTInputPort)
pynestml.meta_model.ast_input_port module
- class pynestml.meta_model.ast_input_port.ASTInputPort(name: str, signal_type: PortSignalType, size_parameter: str | None = None, data_type: ASTDataType | None = None, input_qualifiers: List[ASTInputQualifier] | None = None, *args, **kwargs)
Bases:
ASTNode
This class is used to store a declaration of an input port. ASTInputPort represents a single input port, e.g.:
spike_in pA <- excitatory spike
@attribute name: The name of the input port. @attribute sizeParameter: Optional size parameter for multisynapse neuron. @attribute datatype: Optional data type of the port. @attribute inputQualifier: The qualifier keyword of the input port, to indicate e.g. inhibitory-only or excitatory-only spiking inputs on this port. @attribute isSpike: Indicates that this input port accepts spikes. @attribute isContinuous: Indicates that this input port accepts continuous time input.
- Grammar:
- inputPort:
name=NAME (LEFT_SQUARE_BRACKET sizeParameter=NAME RIGHT_SQUARE_BRACKET)? (dataType)? LEFT_ANGLE_MINUS inputQualifier* (isContinuous = CONTINUOUS_KEYWORD | isSpike = SPIKE_KEYWORD);
- clone() ASTInputPort
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- equals(other: Any) bool
The equals method. :param other: a different object. :return: True if equal,otherwise False.
- get_datatype() ASTDataType
Returns the currently used data type of this port. :return: a single data type object.
- get_input_qualifiers() List[ASTInputQualifier]
Returns the list of input qualifiers. :return: a list of input qualifiers.
- get_parent(ast: ASTNode) ASTNode | None
Indicates whether a this node contains the handed over node. :param ast: an arbitrary meta_model node. :return: AST if this or one of the child nodes contains the handed over element.
- has_datatype()
Returns whether this port has a defined data type or not. :return: True if it has a datatype, otherwise False.
- has_input_qualifiers() bool
Returns whether input qualifiers have been defined. :return: True, if at least one input qualifier has been defined.
- has_size_parameter() bool
Returns whether a size parameter has been defined. :return: True if size has been used, otherwise False.
- is_continuous() bool
Returns whether this is a continous time port or not. :return: True if continuous time, False otherwise.
- is_excitatory() bool
Returns whether this port is excitatory or not. For this, it has to be marked explicitly by the excitatory keyword or no keywords at all shall occur (implicitly all types). :return: True if excitatory, False otherwise.
pynestml.meta_model.ast_input_qualifier module
- class pynestml.meta_model.ast_input_qualifier.ASTInputQualifier(is_inhibitory=False, is_excitatory=False, *args, **kwargs)
Bases:
ASTNode
This class is used to store the qualifier of a buffer. ASTInputQualifier represents the qualifier of the input port. Only valid for spiking inputs. @attribute inhibitory true Indicates that this spiking input port is inhibitory. @attribute excitatory true Indicates that this spiking input port is excitatory.
- Grammar:
inputQualifier : (‘inhibitory’ | ‘excitatory’);
- is_inhibitory = False
- is_excitatory = False
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- equals(other)
The equals method. :param other: a different object. :type other: object :return: True if equal, otherwise False. :rtype: bool
- get_parent(ast)
Indicates whether a this node contains the handed over node. :param ast: an arbitrary meta_model node. :type ast: ASTNode :return: AST if this or one of the child nodes contains the handed over element. :rtype: Optional[ASTNode]
pynestml.meta_model.ast_kernel module
- class pynestml.meta_model.ast_kernel.ASTKernel(variables, expressions, *args, **kwargs)
Bases:
ASTNode
This class is used to store kernels. Grammar:
kernel : KERNEL_KEYWORD variable EQUALS expression (COMMA variable EQUALS expression)* (SEMICOLON)?;
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- equals(other)
The equals method. :param other: a different object. :type other: object :return: True if equal, otherwise False. :rtype: bool
- get_expressions()
Returns the right-hand side rhs. :return: the rhs :rtype: ast_expression
- get_parent(ast)
Indicates whether this node contains the handed over node. :param ast: an arbitrary meta_model node. :type ast: ASTNode :return: AST if this or one of the child nodes contains the handed over element. :rtype: ASTNode or None
- get_variable_names()
Returns the variable of the left-hand side. :return: the variable :rtype: ast_variable
- get_variables()
Returns the variable of the left-hand side. :return: the variable :rtype: ast_variable
pynestml.meta_model.ast_logical_operator module
- class pynestml.meta_model.ast_logical_operator.ASTLogicalOperator(is_logical_and=False, is_logical_or=False, *args, **kwargs)
Bases:
ASTNode
This class is used to store a single logical operator. Grammar:
logicalOperator : (logicalAnd=’and’ | logicalOr=’or’);
- is_logical_and = False
- is_logical_or = False
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- equals(other)
The equals method. :param other: a different object. :type other: object :return: True if equal, otherwise False. :rtype: bool
pynestml.meta_model.ast_namespace_decorator module
- class pynestml.meta_model.ast_namespace_decorator.ASTNamespaceDecorator(namespace: str = '', name: str = '', *args, **kwargs)
Bases:
ASTNode
Namespace decorator, for example “@nest::delay”.
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
pynestml.meta_model.ast_nestml_compilation_unit module
- class pynestml.meta_model.ast_nestml_compilation_unit.ASTNestMLCompilationUnit(neuron_list=None, synapse_list=None, artifact_name=None, *args, **kwargs)
Bases:
ASTNode
The ASTNestMLCompilationUnit class as used to store a collection of processed ASTNeurons. Grammar:
nestMLCompilationUnit: (neuron | NEWLINE )* EOF;
- neuron_list = None # a list of all processed neurons
- artifact_name = None
- add_neuron(neuron)
Expects an instance of neuron element which is added to the collection. :param neuron: an instance of a neuron :type neuron: ASTNeuron
- add_synapse(synapse)
Expects an instance of synapse element which is added to the collection. :param synapse: an instance of a synapse :type synapse: ASTsynapse :return: no returned value :rtype: void
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- delete_neuron(neuron)
Expects an instance of neuron element which is deleted from the collection. :param neuron: an instance of a ASTNeuron :type neuron:ASTNeuron :return: True if element deleted from list, False else. :rtype: bool
- delete_synapse(synapse)
Expects an instance of synapse element which is deleted from the collection. :param synapse: an instance of a ASTsynapse :type synapse:ASTsynapse :return: True if element deleted from list, False else. :rtype: bool
- equals(other)
The equals method. :param other: a different object :type other: object :return: True if equal, otherwise False. :rtype: bool
- get_neuron_list()
- get_parent(ast)
Indicates whether a this node contains the handed over node. :param ast: an arbitrary meta_model node. :type ast: AST_ :return: AST if this or one of the child nodes contains the handed over element. :rtype: AST_ or None
- get_synapse_by_name(name: str) ASTSynapse | None
pynestml.meta_model.ast_neuron module
- class pynestml.meta_model.ast_neuron.ASTNeuron(name, body, artifact_name=None, *args, **kwargs)
Bases:
ASTNeuronOrSynapse
This class is used to store instances of neurons. ASTNeuron represents neuron. @attribute Name The name of the neuron @attribute Body The body of the neuron, e.g. internal, state, parameter… Grammar:
neuron : ‘neuron’ NAME body;
- name = None
- body = None
- artifact_name = None
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- equals(other: ASTNode) bool
The equals method. :param other: a different object. :return: True if equal, otherwise False.
- get_continuous_input_ports() List[VariableSymbol]
Returns a list of all continuous time input ports defined in the model.
- get_input_ports() List[VariableSymbol]
Returns a list of all defined input ports. :return: a list of all input ports.
- get_parameter_invariants()
Returns a list of all invariants of all parameters. :return: a list of rhs representing invariants :rtype: list(ASTExpression)
- get_parent(ast) ASTNode | None
Indicates whether a this node contains the handed over node. :param ast: an arbitrary meta_model node. :type ast: AST_ :return: AST if this or one of the child nodes contains the handed over element.
- get_single_receptors() List[VariableSymbol]
Returns a list of spike input ports that are defined as either excitatory or inhibitory. :return: a list of spike input port variable symbols
- get_spike_input_ports() List[VariableSymbol]
Returns a list of all spike input ports defined in the model.
- get_vector_state_symbols() List[VariableSymbol]
Returns a list of all state symbols that are vectors :return: a list of vector state symbols
- get_vector_symbols() List[VariableSymbol]
Returns a list of all the vector variables declared in State, Parameters, and Internals block :return: a list of vector symbols
pynestml.meta_model.ast_neuron_or_synapse module
- class pynestml.meta_model.ast_neuron_or_synapse.ASTNeuronOrSynapse(name, body, artifact_name=None, *args, **kwargs)
Bases:
ASTNode
This class is used to stuff common to neurons and synapses
- add_to_internals_block(declaration: ASTDeclaration, index: int = -1) None
Adds the handed over declaration the internals block :param declaration: a single declaration
- add_to_state_block(declaration: ASTDeclaration) None
Adds the handed over declaration to an arbitrary state block. A state block will be created if none exists. :param declaration: a single declaration.
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- create_empty_update_block()
Create an empty update block. Only makes sense if one does not already exist.
- equals(other: ASTNode) bool
The equals method. :param other: a different object. :return: True if equal, otherwise False.
- get_all_kernels()
- get_artifact_name() str
Returns the name of the artifact this neuron has been stored in. :return: the name of the file
- get_body() ASTNeuronOrSynapseBody
Return the body of the neuron. :return: the body containing the definitions.
- get_current_buffers()
Returns a list of all current buffers defined in the model. :return: a list of all current input buffers. :rtype: list(VariableSymbol)
- get_equations() List[ASTOdeEquation]
Returns all ode equations as defined in this neuron. :return list of ode-equations
- get_equations_blocks() List[ASTEquationsBlock]
Returns a list of all
equations
blocks defined in this body. :return: a list of equations-blocks.
- get_functions() List[ASTFunction]
Returns a list of all function block declarations in this body. :return: a list of function declarations.
- get_inline_expression_symbols() List[VariableSymbol]
Returns a list of all inline expression symbols defined in the model. :return: a list of symbols
- get_input_blocks() List[ASTInputBlock]
Returns a list of all input-blocks defined. :return: a list of defined input-blocks.
- get_input_buffers()
Returns a list of all defined input buffers. :return: a list of all input buffers. :rtype: list(VariableSymbol)
- get_internal_symbols() List[VariableSymbol]
Returns a list of all internals symbol defined in the model. :return: a list of internals symbols.
- get_internals_blocks() List[ASTBlockWithVariables]
Returns a list of all internals blocks defined in this body. :return: a list of internals-blocks.
- get_multiple_receptors() List[VariableSymbol]
Returns a list of all spike input ports which are defined as both inhibitory and excitatory at the same time. :return: a list of spike input port variable symbols
- get_non_inline_state_symbols() List[VariableSymbol]
Returns a list of all state symbols as defined in the model which are not marked as inline expressions. :return: a list of symbols
- get_ode_defined_symbols()
Returns a list of all variable symbols which have been defined in th state blocks and are provided with an ode. :return: a list of state variables with odes :rtype: list(VariableSymbol)
- get_output_blocks() List[ASTOutputBlock]
Returns a list of all output-blocks defined. :return: a list of defined output-blocks.
- get_parameter_invariants()
Returns a list of all invariants of all parameters. :return: a list of rhs representing invariants :rtype: list(ASTExpression)
- get_parameter_symbols()
Returns a list of all parameter symbol defined in the model. :return: a list of parameter symbols. :rtype: list(VariableSymbol)
- get_parameter_variables() List[ASTVariable]
Returns a list of all parameters. :return:
- get_parameters_blocks() List[ASTBlockWithVariables]
Returns a list of all parameter blocks defined in this body. :return: a list of parameters-blocks.
- get_parent(ast)
Indicates whether a this node contains the handed over node. :param ast: an arbitrary meta_model node. :type ast: AST_ :return: AST if this or one of the child nodes contains the handed over element. :rtype: AST_ or None
- get_spike_buffers()
Returns a list of all spike input buffers defined in the model. :return: a list of all spike input buffers. :rtype: list(VariableSymbol)
- get_state_blocks() List[ASTBlockWithVariables]
Returns a list of all state blocks defined in this body. :return: a list of state-blocks.
- get_state_declarations()
Returns a list of initial values declarations made in this neuron. :return: a list of initial values declarations :rtype: list(ASTDeclaration)
- get_state_symbols() List[VariableSymbol]
Returns a list of all state symbol defined in the model. :return: a list of state symbols.
- get_state_symbols_without_ode()
Returns a list of all elements which have been defined in the state block. :return: a list of of state variable symbols. :rtype: list(VariableSymbol)
- get_state_variables() List[ASTVariable]
Returns a list of all state variables. :return:
- get_update_blocks() List[ASTUpdateBlock]
Returns a list of all update blocks defined in this body. :return: a list of update-block elements.
- has_delay_variables() bool
This method indicates if the neuron has variables with a delay parameter. :return: True if variables with delay parameter exist, False otherwise.
- is_array_buffer()
This method indicates whether this neuron uses buffers defined vector-wise. :return: True if vector buffers defined, otherwise False. :rtype: bool
- is_multisynapse_spikes() bool
Returns whether this neuron uses multi-synapse inputs. :return: True if multi-synaptic, otherwise False.
- print_comment(prefix: str = '') str
Prints the header comment of this neuron. :param prefix: a prefix string :return: the comment.
- remove_equations_block() None
Deletes all equations blocks. By construction as checked through cocos there is only one there.
- set_name(name)
Set the name of the node.
pynestml.meta_model.ast_neuron_or_synapse_body module
- class pynestml.meta_model.ast_neuron_or_synapse_body.ASTNeuronOrSynapseBody(body_elements, *args, **kwargs)
Bases:
ASTNode
This class is used to store the body of a neuron or synapse, an object containing all the definitions. ASTNeuronOrSynapseBody The body of the neuron, e.g. internal, state, parameter… Grammar:
- bodyBLOCK_OPEN
(NEWLINE | blockWithVariables | updateBlock | equationsBlock | inputBlock | outputBlock | function)* BLOCK_CLOSE;
- body_elements = None
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- equals(other)
The equals method. :param other: a different object. :type other: object :return: True if equal, otherwise False. :rtype: bool
- get_body_elements()
Returns the list of body elements. :return: a list of body elements. :rtype: list()
- get_equations_blocks() List[ASTEquationsBlock]
Returns a list of all equations blocks defined in this body. :return: a list of equations-blocks.
- get_functions()
Returns a list of all function block declarations in this body. :return: a list of function declarations. :rtype: list(ASTFunction)
- get_input_blocks() List[ASTInputBlock]
Returns a list of all input-blocks defined. :return: a list of defined input-blocks.
- get_internals_blocks() List[ASTBlockWithVariables]
Returns a list of all internals blocks defined in this body. :return: a list of internals-blocks. :rtype: list(ASTBlockWithVariables)
- get_on_receive_block(port_name) ASTOnReceiveBlock | None
- get_on_receive_blocks() List[ASTOnReceiveBlock]
- get_output_blocks() List[ASTOutputBlock]
Returns a list of all output-blocks defined. :return: a list of defined output-blocks. :rtype: list(ASTOutputBlock)
- get_parameters_blocks() List[ASTBlockWithVariables]
Returns a list of all parameter blocks defined in this body. :return: a list of parameters-blocks.
- get_parent(ast=None)
Indicates whether a this node contains the handed over node. :param ast: an arbitrary meta_model node. :type ast: AST_ :return: AST if this or one of the child nodes contains the handed over element. :rtype: AST_ or None
- get_spike_input_ports() List[ASTInputPort]
Returns a list of all spike input ports defined in the model. :return: a list of all spike input ports
- get_state_blocks() List[ASTBlockWithVariables]
Returns a list of all state blocks defined in this body. :return: a list of state-blocks.
- get_update_blocks() List[ASTUpdateBlock]
Returns a list of all update blocks defined in this body. :return: a list of update-block elements.
pynestml.meta_model.ast_node module
- class pynestml.meta_model.ast_node.ASTNode(source_position: ASTSourceLocation | None = None, scope: Scope | None = None, comment: str | None = None, pre_comments: List[str] | None = None, in_comment: str | None = None, implicit_conversion_factor: float | None = None)
Bases:
object
This class is not a part of the grammar but is used to store commonalities of all possible meta_model classes, e.g., the source position.
This class is abstract, thus no instances can be created.
- source_position = None
- scope = None
- comment = None
- #
- pre_comments = list()
- in_comment = None
- #
- implicit_conversion_factor = None
- accept(visitor)
Double dispatch for visitor pattern. :param visitor: A visitor. :type visitor: Inherited from ASTVisitor.
- abstract clone()
Return a deep copy of this node.
- abstract equals(other)
The equals operation. :param other: a different object. :type other: object :return: True if equal, otherwise False. :rtype: bool
- get_comment()
Returns the comment of this element. :return: a comment. :rtype: str
- get_comments()
- get_implicit_conversion_factor() float | None
Returns the factor installed as implicitConversionFactor for this expression :return: the conversion factor, if present, or None
- abstract get_parent(ast)
Indicates whether a this node contains the handed over node. :param ast: an arbitrary meta_model node. :type ast: AST_ :return: AST if this or one of the child nodes contains the handed over element. :rtype: AST_ or None
- get_scope()
Returns the scope of this element. :return: a scope object. :rtype: Scope
- get_source_position()
Returns the source position of the element. :return: a source position object. :rtype: ASTSourceLocation
- has_comment()
Indicates whether this element stores a comment. :return: True if has comment, otherwise False. :rtype: bool
- print_comment(prefix: str = '') str
Prints the comment of this meta_model element. :param prefix: a prefix string :return: a comment
- set_comment(comment)
Updates the comment of this element. :param comment: a comment :type comment: str
- set_implicit_conversion_factor(implicit_factor: float | None) None
Sets a factor that, when applied to the (unit-typed) expression, converts it to the magnitude of the context where it is used. eg. Volt + milliVolt needs to either be 1000*Volt + milliVolt or Volt + 0.001 * milliVolt :param implicit_factor: the factor to be installed
- set_source_position(new_position)
Updates the source position of the element. :param new_position: a new source position :type new_position: ASTSourceLocation :return: a source position object. :rtype: ASTSourceLocation
- update_scope(_scope)
Updates the scope of this element. :param _scope: a scope object. :type _scope: Scope
pynestml.meta_model.ast_node_factory module
- class pynestml.meta_model.ast_node_factory.ASTNodeFactory
Bases:
object
An implementation of the factory pattern for an easier initialization of new AST nodes.
- classmethod create_ast_arithmetic_operator(is_times_op: bool = False, is_div_op: bool = False, is_modulo_op: bool = False, is_plus_op: bool = False, is_minus_op: bool = False, is_pow_op: bool = False, source_position: ASTSourceLocation | None = None) ASTArithmeticOperator
- classmethod create_ast_assignment(lhs: ASTVariable = None, is_direct_assignment: bool = False, is_compound_sum: bool = False, is_compound_minus: bool = False, is_compound_product: bool = False, is_compound_quotient: bool = False, expression: Union(ASTSimpleExpression, ASTExpression) = None, source_position: ASTSourceLocation = None) ASTAssignment
- classmethod create_ast_bit_operator(is_bit_and: bool = False, is_bit_xor: bool = False, is_bit_or: bool = False, is_bit_shift_left: bool = False, is_bit_shift_right: bool = False, source_position: ASTSourceLocation | None = None) ASTBitOperator
- classmethod create_ast_block(stmts: list(ASTSmallStmt | ASTCompoundStmt), source_position: ASTSourceLocation) ASTBlock
- classmethod create_ast_block_with_variables(is_state: bool = False, is_parameters: bool = False, is_internals: bool = False, declarations: bool = None, source_position: list(ASTDeclaration) = None) ASTBlockWithVariables
- classmethod create_ast_comparison_operator(is_lt: bool = False, is_le: bool = False, is_eq: bool = False, is_ne: bool = False, is_ne2: bool = False, is_ge: bool = False, is_gt: bool = False, source_position: ASTSourceLocation | None = None) ASTComparisonOperator
- classmethod create_ast_compound_expression(lhs: Union(ASTExpression, ASTSimpleExpression), binary_operator: Union(ASTLogicalOperator, ASTBitOperator, ASTComparisonOperator, ASTArithmeticOperator), rhs: Union(ASTExpression, ASTSimpleExpression), source_position: ASTSourceLocation) ASTExpression
The factory method used to create compound expressions, e.g. 10mV + V_m.
- classmethod create_ast_compound_stmt(if_stmt: ASTIfStmt, while_stmt: ASTWhileStmt, for_stmt: ASTForStmt, source_position: ASTSourceLocation) ASTCompoundStmt
- classmethod create_ast_data_type(is_integer: bool = False, is_real: bool = False, is_string: bool = False, is_boolean: bool = False, is_void: bool = False, is_unit_type: ASTUnitType | None = None, source_position: ASTSourceLocation | None = None) ASTDataType
- classmethod create_ast_declaration(is_recordable: bool = False, is_inline_expression: bool = False, variables=None, data_type=None, size_parameter=None, expression=None, invariant=None, source_position=None, decorators=None) ASTDeclaration
- classmethod create_ast_elif_clause(condition: ASTExpression | ASTSimpleExpression, block: ASTBlock, source_position: ASTSourceLocation = None) ASTElifClause
- classmethod create_ast_else_clause(block: ASTBlock, source_position: ASTSourceLocation) ASTElseClause
- classmethod create_ast_equations_block(declarations: list | None = None, source_position: ASTSourceLocation | None = None) ASTEquationsBlock
- classmethod create_ast_expression(is_encapsulated: bool = False, unary_operator: ASTUnaryOperator = None, is_logical_not: bool = False, expression: ASTExpression | ASTSimpleExpression = None, source_position: ASTSourceLocation = None) ASTExpression
The factory method used to create rhs which are either encapsulated in parentheses (e.g., (10mV)) OR have a unary (e.g., ~bitVar), OR are negated (e.g., not logVar), or are simple rhs (e.g., 10mV).
- classmethod create_ast_for_stmt(variable: str, start_from: Union(ASTSimpleExpression, ASTExpression), end_at: Union(ASTSimpleExpression, ASTExpression), step: float = 0, block: ASTBlock = None, source_position: ASTSourceLocation = None) ASTForStmt
- classmethod create_ast_function(name: str, parameters: None | list(ASTParameter), return_type: ASTDataType | None, block: ASTBlock, source_position: ASTSourceLocation) ASTFunction
- classmethod create_ast_function_call(callee_name: str, args: None | list(ASTExpression | ASTSimpleExpression), source_position: ASTSourceLocation) ASTFunctionCall
- classmethod create_ast_if_clause(condition: ASTSimpleExpression | ASTExpression, block: ASTBlock, source_position: ASTSourceLocation) ASTIfClause
- classmethod create_ast_if_stmt(if_clause: ASTIfClause, elif_clauses: None | list(ASTElifClause), else_clause: None | ASTElseClause, source_position: ASTSourceLocation) ASTIfStmt
- classmethod create_ast_inline_expression(variable_name: str, data_type: ASTDataType, expression: ASTExpression | ASTSimpleExpression, source_position: ASTSourceLocation, is_recordable: bool = False, decorators: list | None = None) ASTInlineExpression
- classmethod create_ast_input_block(input_definitions: list(ASTInputPort), source_position: ASTSourceLocation) ASTInputBlock
- classmethod create_ast_input_port(name: str, size_parameter: str, data_type: None | ASTDataType, input_qualifiers: list(ASTInputQualifier), signal_type: PortSignalType, source_position: ASTSourceLocation) ASTInputPort
- classmethod create_ast_input_qualifier(is_inhibitory: bool = False, is_excitatory: bool = False, source_position: ASTSourceLocation | None = None) ASTInputQualifier
- classmethod create_ast_kernel(variables: ASTVariable = None, expressions: ASTSimpleExpression | ASTExpression = None, source_position: ASTSourceLocation = None) ASTKernel
- classmethod create_ast_logical_operator(is_logical_and: bool = False, is_logical_or: bool = False, source_position: ASTSourceLocation | None = None) ASTLogicalOperator
- classmethod create_ast_namespace_decorator(namespace=None, name=None, source_position=None)
- classmethod create_ast_nestml_compilation_unit(list_of_neurons, list_of_synapses, source_position: ASTSourceLocation, artifact_name: str) ASTNestMLCompilationUnit
- classmethod create_ast_neuron(name: str, body: ASTNeuronOrSynapseBody, source_position: ASTSourceLocation, artifact_name: str) ASTNeuron
- classmethod create_ast_neuron_or_synapse_body(body_elements: list, source_position: ASTSourceLocation) ASTNeuronOrSynapseBody
- classmethod create_ast_ode_equation(lhs: ASTVariable, rhs: ASTSimpleExpression | ASTExpression, source_position: ASTSourceLocation, decorators: List | None = None) ASTOdeEquation
- classmethod create_ast_on_receive_block(block=None, port_name=None, const_parameters=None, source_position=None)
- classmethod create_ast_output_block(s_type: PortSignalType, source_position: ASTSourceLocation) ASTOutputBlock
- classmethod create_ast_parameter(name: str, data_type: ASTDataType, source_position: ASTSourceLocation) ASTParameter
- classmethod create_ast_return_stmt(expression: ASTSimpleExpression | ASTExpression = None, source_position: ASTSourceLocation = None) ASTReturnStmt
- classmethod create_ast_simple_expression(function_call: Union(ASTFunctionCall, None) = None, boolean_literal: Union(bool, None) = None, numeric_literal: Union(float, int) = None, is_inf: bool = False, variable: ASTVariable = None, string: Union(str, None) = None, source_position: ASTSourceLocation = None) ASTSimpleExpression
- classmethod create_ast_small_stmt(assignment: ASTAssignment | None = None, function_call: ASTFunctionCall | None = None, declaration: ASTDeclaration | None = None, return_stmt: ASTReturnStmt | None = None, source_position: ASTSourceLocation | None = None) ASTSmallStmt
- classmethod create_ast_stmt(small_stmt: ASTSmallStmt | None = None, compound_stmt: ASTCompoundStmt | None = None, source_position: ASTSourceLocation | None = None) ASTStmt
- classmethod create_ast_synapse(name: str, body: ASTNeuronOrSynapseBody, source_position: ASTSourceLocation, artifact_name: str) ASTSynapse
- classmethod create_ast_ternary_expression(condition: Union(ASTSimpleExpression, ASTExpression), if_true: Union(ASTSimpleExpression, ASTExpression), if_not: Union(ASTSimpleExpression, ASTExpression), source_position: ASTSourceLocation) ASTExpression
The factory method used to create a ternary operator rhs, e.g., 10mV<V_m?10mV:V_m
- classmethod create_ast_unary_operator(is_unary_plus: bool = False, is_unary_minus: bool = False, is_unary_tilde: bool = False, source_position: ASTSourceLocation | None = None) ASTUnaryOperator
- classmethod create_ast_unit_type(is_encapsulated: bool = False, compound_unit: ASTUnitType = None, base: ASTUnitType = None, is_pow: bool = False, exponent: int = None, lhs: Union(ASTUnitType, int) = None, rhs: ASTUnitType = None, is_div: bool = False, is_times: bool = False, unit: str = None, source_position: ASTSourceLocation = None) ASTUnitType
- classmethod create_ast_update_block(block: ASTBlock, source_position: ASTSourceLocation) ASTUpdateBlock
- classmethod create_ast_variable(name: str, differential_order: int = 0, vector_parameter=None, is_homogeneous=False, source_position: ASTSourceLocation | None = None, scope: Scope | None = None) ASTVariable
- classmethod create_ast_while_stmt(condition: Union(ASTSimpleExpression, ASTExpression), block: ASTBlock, source_position: ASTSourceLocation) ASTWhileStmt
pynestml.meta_model.ast_ode_equation module
- class pynestml.meta_model.ast_ode_equation.ASTOdeEquation(lhs, rhs, decorators=None, *args, **kwargs)
Bases:
ASTNode
This class is used to store meta_model equations, e.g., V_m’ = 10mV + V_m. ASTOdeEquation Represents an equation, e.g. “I = exp(t)” or represents an differential equations,
e.g. “V_m’ = V_m+1”.
@attribute lhs Left hand side, e.g. a Variable. @attribute rhs Expression defining the right hand side. Grammar:
odeEquation : lhs=variable ‘=’ rhs=rhs;
- lhs = None
- rhs = None
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- equals(other=None)
The equals method. :param other: a different object. :type other: object :return: True if equal, otherwise False. :rtype: bool
- get_decorators()
- get_lhs()
Returns the left-hand side of the equation. :return: an object of the meta_model-variable class. :rtype: ASTVariable
- get_parent(ast=None)
Indicates whether a this node contains the handed over node. :param ast: an arbitrary meta_model node. :type ast: AST_ :return: AST if this or one of the child nodes contains the handed over element. :rtype: AST_ or None
- get_rhs()
Returns the left-hand side of the equation. :return: an object of the meta_model-expr class. :rtype: Union[ASTExpression, ASTSimpleExpression]
pynestml.meta_model.ast_on_receive_block module
- class pynestml.meta_model.ast_on_receive_block.ASTOnReceiveBlock(block: ASTBlock, port_name: str, const_parameters: Mapping | None = None, *args, **kwargs)
Bases:
ASTNode
This class is used to store a declaration of an onReceive block, for example:
onReceive(pre_spikes): pre_tr += 1
- clone() ASTOnReceiveBlock
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- equals(other: Any) bool
The equals method. :param other: a different object. :return: True if equal, otherwise False.
- get_const_parameters()
pynestml.meta_model.ast_output_block module
- class pynestml.meta_model.ast_output_block.ASTOutputBlock(o_type, *args, **kwargs)
Bases:
ASTNode
This class is used to store output port declarations. ASTOutput represents the output block of the neuron:
- output:
spike
@attribute spike true if and only if the neuron has a spike output. @attribute continuous true if and only if the neuron has a continuous time output.
- Grammar:
outputBlock: ‘output’ BLOCK_OPEN (‘spike’ | ‘continuous’) ;
- type = None
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- equals(other) bool
The equals method. :param other: a different object. :type other: object :return: True if equals, otherwise False.
- get_parent(ast)
Indicates whether a this node contains the handed over node. :param ast: an arbitrary meta_model node. :type ast: AST_ :return: AST if this or one of the child nodes contains the handed over element. :rtype: AST_ or None
pynestml.meta_model.ast_parameter module
- class pynestml.meta_model.ast_parameter.ASTParameter(name: str, data_type: ASTDataType, *args, **kwargs)
Bases:
ASTNode
This class is used to store a single function parameter definition.
- Grammar:
parameter : NAME datatype;
- data_type
The data type of the parameter.
- Type:
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- equals(other)
The equals method. :param other: a different object. :type other: object :return: True if equal, otherwise False. :rtype: bool
- get_data_type()
Returns the data type of the parameter. :return: the data type of the parameter. :rtype: ASTDataType
- get_name()
Returns the name of the parameter. :return: the name of the parameter. :rtype: str
pynestml.meta_model.ast_return_stmt module
- class pynestml.meta_model.ast_return_stmt.ASTReturnStmt(expression=None, *args, **kwargs)
Bases:
ASTNode
- This class is used to store a return statement.
A ReturnStmt Models the return statement in a function. @attribute minus An optional sing @attribute definingVariable Name of the variable Grammar:
returnStmt : ‘return’ expr?;
- expression
An rhs representing the returned value.
- Type:
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- equals(other)
The equals method. :param other: a different object. :type other: object :return: True if equal, otherwise False. :rtype: bool
- get_expression()
Returns the rhs. :return: an rhs. :rtype: ASTExpression
- get_parent(ast)
Indicates whether a this node contains the handed over node. :param ast: an arbitrary meta_model node. :type ast: AST_ :return: AST if this or one of the child nodes contains the handed over element. :rtype: AST_ or None
- has_expression()
Returns whether the return statement has an rhs or not. :return: True if has rhs, otherwise False. :rtype: bool
pynestml.meta_model.ast_simple_expression module
- class pynestml.meta_model.ast_simple_expression.ASTSimpleExpression(function_call: ASTFunctionCall | None = None, boolean_literal: bool | None = None, numeric_literal: int | float | None = None, is_inf: bool = False, variable: ASTVariable | None = None, string: str | None = None, has_delay: bool = False, *args, **kwargs)
Bases:
ASTExpressionNode
This class is used to store a simple rhs, e.g. +42mV. ASTSimpleExpression, consisting of a single element without combining operator, e.g.,10mV, inf, V_m. Grammar: simpleExpression : functionCall
BOOLEAN_LITERAL // true & false ;(UNSIGNED_INTEGER | FLOAT) (variable)?isInf=’inf’STRING_LITERALvariable;- function_call
A function call reference.
- numeric_literal
A numeric literal.
- variable
A variable reference.
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- equals(other)
The equals method. :param other: a different object. :type other: object :return:True if equal, otherwise False. :rtype: bool
- get_boolean_literal() bool | None
Returns boolean literal if available, otherwise None. :return: boolean literal if ASTSimpleExpression is boolean literal, otherwise None
- get_function_call()
Returns the function call object. :return: the function call object. :rtype: ASTFunctionCall
- get_function_calls()
This function is used for better interactions with the general rhs meta_model class. :return: returns a single list with this function call if such an exists, otherwise an empty list :rtype: list(ASTFunctionCall)
- get_has_delay()
Returns the has_delay parameter :return: returns the value of has_delay parameter
- get_numeric_literal()
Returns the value of the numeric literal. :return: the value of the numeric literal. :rtype: int/float
- get_parent(ast)
Indicates whether a this node contains the handed over node. :param ast: an arbitrary meta_model node. :type ast: AST_ :return: AST if this or one of the child nodes contains the handed over element. :rtype: AST_ or None
- get_string()
Returns the string as stored in this simple rhs. :return: a string as stored in this rhs. :rtype: str
- get_units()
This function is used for better interactions with the general rhs meta_model class. :return: returns a single list with unit if such an exists, otherwise an empty list :rtype: list(ASTVariable)
- get_variable()
Returns the variable. :return: the variable object. :rtype: ASTVariable
- get_variables()
This function is used for better interactions with the general rhs meta_model class. :return: returns a single list with this variable if such an exists, otherwise an empty list :rtype: list(ASTVariable)
- has_unit()
Returns whether this is a numeric literal with a defined unit. :return: True if numeric literal with unit, otherwise False. :rtype: bool
- is_delay_variable()
Returns whether it is a delay variable or not :return: True if the variable has a delay parameter, False otherwise
- is_function_call()
Returns whether it is a function call or not. :return: True if function call, otherwise False. :rtype: bool
- is_numeric_literal()
Returns whether it is a numeric literal or not. :return: True if numeric literal, otherwise False. :rtype: bool
- is_string()
Returns whether this simple rhs is a string. :return: True if string, False otherwise. :rtype: bool
- is_variable()
Returns whether it is a variable or not. :return: True if has a variable, otherwise False. :rtype: bool
- set_function_call(function_call)
Updates the function call of this node. :param function_call: a single function call :type function_call: Union(ASTFunctionCall,None)
- set_numeric_literal(numeric_literal)
Updates the numeric literal attribute of this node. :param numeric_literal: a single numeric literal :type numeric_literal: int or float
- set_variable(variable)
Updates the variable of this node. :param variable: a single variable :type variable: ASTVariable
pynestml.meta_model.ast_small_stmt module
- class pynestml.meta_model.ast_small_stmt.ASTSmallStmt(assignment=None, function_call=None, declaration=None, return_stmt=None, *args, **kwargs)
Bases:
ASTNode
This class is used to store small statements, e.g., a declaration. Grammar:
- smallStmtassignment
- functionCalldeclarationreturnStmt;
- assignment
A assignment reference.
- Type:
ast_assignment
- function_call
A function call reference.
- Type:
ast_function_call
- declaration
A declaration reference.
- Type:
ast_declaration
- return_stmt
A reference to the returns statement.
- Type:
ast_return_stmt
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- equals(other)
The equals method. :param other: a different object :type other: object :return: True if equals, otherwise False. :rtype: bool
- get_assignment()
Returns the assignment. :return: the assignment statement. :rtype: ast_assignment
- get_declaration()
Returns the assignment. :return: the declaration statement. :rtype: ast_declaration
- get_function_call()
Returns the function call. :return: the function call statement. :rtype: ast_function_call
- get_parent(ast)
Indicates whether a this node contains the handed over node. :param ast: an arbitrary meta_model node. :type ast: AST_ :return: AST if this or one of the child nodes contains the handed over element. :rtype: AST_ or None
- get_return_stmt()
Returns the return statement. :return: the return statement. :rtype: ast_return_stmt
- is_assignment()
Returns whether it is an assignment statement or not. :return: True if assignment, False else. :rtype: bool
- is_declaration()
Returns whether it is a declaration statement or not. :return: True if declaration, False else. :rtype: bool
- is_function_call()
Returns whether it is an function call or not. :return: True if function call, False else. :rtype: bool
- is_return_stmt()
Returns whether it is a return statement or not. :return: True if return stmt, False else. :rtype: bool
pynestml.meta_model.ast_stmt module
- class pynestml.meta_model.ast_stmt.ASTStmt(small_stmt, compound_stmt, *args, **kwargs)
Bases:
ASTNode
Stores a reference to either small or compound statement. Grammar:
stmt : smallStmt | compoundStmt;
- small_stmt = None
- compound_stmt = None
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- equals(other=None)
The equals operation. :param other: a different object. :type other: object :return: True if equal, otherwise False. :rtype: bool
- get_parent(ast: ASTNode | None = None) ASTNode | None
Returns the parent node of a handed over AST object.
- is_compound_stmt()
- is_small_stmt()
pynestml.meta_model.ast_synapse module
- class pynestml.meta_model.ast_synapse.ASTSynapse(name, body, default_weight=None, artifact_name=None, *args, **kwargs)
Bases:
ASTNeuronOrSynapse
This class is used to store instances of synapses. ASTSynapse represents synapse. @attribute Name The name of the synapse @attribute Body The body of the synapse, e.g. internal, state, parameter… Grammar:
synapse : ‘synapse’ NAME body;
- name = None
- body = None
- artifact_name = None
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- get_default_delay_dtype()
- get_default_delay_expression()
- get_default_delay_variable()
- get_default_weight()
- get_input_buffers()
Returns a list of all defined input buffers. :return: a list of all input buffers. :rtype: list(VariableSymbol)
- get_on_receive_block(port_name: str) ASTOnReceiveBlock | None
- get_on_receive_blocks() List[ASTOnReceiveBlock]
- get_spike_buffers()
Returns a list of all spike input buffers defined in the model. :return: a list of all spike input buffers. :rtype: list(VariableSymbol)
- get_weight_variable()
- set_default_delay(var, expr, dtype)
- set_default_weight(w)
pynestml.meta_model.ast_unary_operator module
- class pynestml.meta_model.ast_unary_operator.ASTUnaryOperator(is_unary_plus=False, is_unary_minus=False, is_unary_tilde=False, *args, **kwargs)
Bases:
ASTNode
This class is used to store a single unary operator, e.g., ~. Grammar:
unaryOperator : (unaryPlus=’+’ | unaryMinus=’-’ | unaryTilde=’~’);
- is_unary_plus = False
- is_unary_minus = False
- is_unary_tilde = False
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- equals(other)
The equals method. :param other: a different object. :type other: object :return: True if equal, otherwise False. :rtype: bool
pynestml.meta_model.ast_unit_type module
- class pynestml.meta_model.ast_unit_type.ASTUnitType(is_encapsulated=False, compound_unit=None, base=None, is_pow=False, exponent=None, lhs=None, rhs=None, is_div=False, is_times=False, _unit=None, type_symbol=None, *args, **kwargs)
Bases:
ASTNode
This class stores information regarding unit types and their properties. ASTUnitType. Represents an unit datatype. It can be a plain datatype as ‘mV’ or a complex data type as ‘mV/s’
- unitTypeleftParentheses=’(’ unitType rightParentheses=’)’
- base=unitType powOp=’**’ exponent=UNSIGNED_INTEGERleft=unitType (timesOp=’*’ | divOp=’/’) right=unitTypeunitlessLiteral=UNSIGNED_INTEGER divOp=’/’ right=unitTypeunit=NAME;
- # encapsulated or not
- is_encapsulated = False
- compound_unit = None
- # pow rhs
- base = None
- is_pow = False
- exponent = None
- # arithmetic combination case
- lhs = None
- is_times = False
- is_div = False
- rhs = None
- # simple case, just a name
- unit = None
- # the corresponding symbol
- type_symbol = None
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- equals(other)
The equals method. :param other: a different object. :type other: object :return: True if equal, otherwise False. :rtype: bool
- get_lhs()
Returns the left-hand side rhs if present. :return: ASTUnitType instance if present, otherwise None. :rtype: ASTUnitType
- get_parent(ast)
Indicates whether a this node contains the handed over node. :param ast: an arbitrary meta_model node. :type ast: AST_ :return: AST if this or one of the child nodes contains the handed over element. :rtype: AST_ or None
- get_rhs()
Returns the right-hand side rhs if present. :return: ASTUnitType instance if present, otherwise None. :rtype: ASTUnitType
- get_type_symbol()
- is_arithmetic_expression()
Returns whether the rhs is a arithmetic combination, e.g, mV/mS. :return: True if arithmetic rhs, otherwise false. :rtype: bool
- is_simple_unit()
Returns whether the rhs is a simple unit, e.g., mV. :return: True if simple unit, otherwise False. :rtype: bool
- set_type_symbol(type_symbol)
pynestml.meta_model.ast_update_block module
- class pynestml.meta_model.ast_update_block.ASTUpdateBlock(block, *args, **kwargs)
Bases:
ASTNode
This class is used to store dynamic blocks. ASTUpdateBlock is a special function definition:
- update:
- if r == 0: # not refractory
integrate(V)
@attribute block Implementation of the dynamics.
- Grammar:
- updateBlock:
‘update’ BLOCK_OPEN
block
BLOCK_CLOSE;
- block = None
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- equals(other)
The equals method. :param other: a different object. :type other: object :return: True if equal, otherwise False. :rtype: bool
- get_block()
Returns the block of definitions. :return: the block :rtype: ASTBlock
pynestml.meta_model.ast_variable module
- class pynestml.meta_model.ast_variable.ASTVariable(name, differential_order=0, type_symbol: str | None = None, vector_parameter: str | None = None, is_homogeneous: bool = False, delay_parameter: str | None = None, *args, **kwargs)
Bases:
ASTNode
This class is used to store a single variable.
ASTVariable Provides a ‘marker’ AST node to identify variables used in expressions. Grammar:
variable : NAME (differentialOrder=’'’)*;
- name = None
- differential_order = None
- # the corresponding type symbol
- type_symbol = None
- clone()
Return a clone (“deep copy”) of this node.
- equals(other: Any) bool
The equals method. :param other: a different object. :return: True if equals, otherwise False.
- get_complete_name() str
Returns the complete name, consisting of the name and the differential order. :return: the complete name.
- get_delay_parameter()
Returns the delay parameter :return: delay parameter
- get_differential_order() int
Returns the differential order of the variable. :return: the differential order.
- get_name_of_lhs() str
Returns the complete name but with differential order reduced by one. :return: the name.
- get_parent(ast: ASTNode) ASTNode | None
Indicates whether a this node contains the handed over node. :param ast: an arbitrary meta_model node. :return: AST if this or one of the child nodes contains the handed over element.
- get_type_symbol() TypeSymbol
Returns the type symbol of this rhs. :return: a single type symbol.
- get_vector_parameter() str
Returns the vector parameter of the variable :return: the vector parameter
- has_vector_parameter() bool
Returns the vector parameter of the variable :return: the vector parameter
- is_delay_variable() bool
Returns whether it is a delay variable or not :return: True if the variable has a delay parameter, False otherwise
- is_unit_variable() bool
Provided on-the-fly information whether this variable represents a unit-variable, e.g., nS. Caution: It assumes that the symbol table has already been constructed. :return: True if unit-variable, otherwise False.
- resolve_in_own_scope()
- set_delay_parameter(delay: str)
Updates the current delay parameter to the handed over value :param delay: delay parameter
- set_differential_order(differential_order: int) None
Returns the differential order of the variable.
- set_type_symbol(type_symbol: TypeSymbol)
Updates the current type symbol to the handed over one. :param type_symbol: a single type symbol object.
- set_vector_parameter(vector_parameter)
Updates the vector parameter of the variable
pynestml.meta_model.ast_while_stmt module
- class pynestml.meta_model.ast_while_stmt.ASTWhileStmt(condition: ASTExpression, block: ASTBlock, *args, **kwargs)
Bases:
ASTNode
This class is used to store a new while-block. Grammar:
whileStmt : ‘while’ expr BLOCK_OPEN block BLOCK_CLOSE;
- condition = None
- block = None
- clone()
Return a clone (“deep copy”) of this node.
- Returns:
new AST node instance
- Return type:
- equals(other)
The equals method. :param other: a different object. :type other: object :return: True if equals, otherwise False. :rtype: bool
- get_block()
Returns the block of statements. :return: the block of statements. :rtype: ASTBlock
- get_condition()
Returns the condition of the block. :return: the condition. :rtype: ASTExpression