sbmlsim.combine.mathml
¶
Helper functions for evaluation of MathML expressions.
Using sympy to evaluate the expressions.
Module Contents¶
Functions¶
|
Parse ASTNode from formula. |
|
Write ASTNode as formula. |
|
Parse MathML string. |
|
Parse formula to ASTNode. |
|
Parse ASTNode. |
|
Parse sympy expression from given formula string. |
|
Evaluate the astnode with values. |
|
Add variable names to the variables. |
|
Replace libsedml piecewise with sympy piecewise. |
Attributes¶
- sbmlsim.combine.mathml.formula_to_astnode(formula)[source]¶
Parse ASTNode from formula.
- Parameters:
formula (str) –
- Return type:
libsedml.ASTNode
- sbmlsim.combine.mathml.astnode_to_formula(astnode)[source]¶
Write ASTNode as formula.
- Parameters:
astnode (libsedml.ASTNode) –
- Return type:
str
- sbmlsim.combine.mathml.parse_mathml_str(mathml_str)[source]¶
Parse MathML string.
- Parameters:
mathml_str (str) –
- sbmlsim.combine.mathml.parse_formula(formula)[source]¶
Parse formula to ASTNode.
- Parameters:
formula (str) –
- Return type:
libsedml.ASTNode
- sbmlsim.combine.mathml.parse_astnode(astnode)[source]¶
Parse ASTNode.
An AST node in libSBML is a recursive tree structure; each node has a type, a pointer to a value, and a list of children nodes. Each ASTNode node may have none, one, two, or more children depending on its type. There are node types to represent numbers (with subtypes to distinguish integer, real, and rational numbers), names (e.g., constants or variables), simple mathematical operators, logical or relational operators and functions.
see also: http://sbml.org/Software/libSBML/docs/python-api/libsedml-math.html
- Parameters:
mathml –
astnode (libsedml.ASTNode) –
- Returns:
- Return type:
Any
- sbmlsim.combine.mathml.expr_from_formula(formula)[source]¶
Parse sympy expression from given formula string.
- Parameters:
formula (str) –
- sbmlsim.combine.mathml.evaluate(astnode, variables)[source]¶
Evaluate the astnode with values.
- Parameters:
astnode (libsedml.ASTNode) –
variables (Dict) –
- sbmlsim.combine.mathml._get_variables(astnode, variables=None)[source]¶
Add variable names to the variables.
- Parameters:
astnode (libsedml.ASTNode) –
- Return type:
Set[str]