sbmlutils.converters.mathml

Helper functions for evaluation of mathml expressions.

In this namespace all the possible names occuring in formula strings have to be defined.

In build in python are

*, /, +, - and, or, not

Module Contents

Functions

product(*args)

Product calculation.

sqr(x)

Square calculation.

root(a, b)

Root calculation.

xor(*args)

XOR calculation.

piecewise(*args)

Piecewise calculation.

evaluableMathML(astnode[, variables])

Create evaluable python formula string from ASTNode.

evaluateMathML(astnode[, variables])

Evaluate MathML string with given set of variable and parameter values.

Attributes

mathmlStr

sbmlutils.converters.mathml.product(*args)[source]

Product calculation.

Parameters

args (float) –

Return type

float

sbmlutils.converters.mathml.sqr(x)[source]

Square calculation.

Parameters

x (float) –

Return type

float

sbmlutils.converters.mathml.root(a, b)[source]

Root calculation.

Parameters
  • a (float) –

  • b (float) –

Return type

float

sbmlutils.converters.mathml.xor(*args)[source]

XOR calculation.

Parameters

args (float) –

Return type

int

sbmlutils.converters.mathml.piecewise(*args)[source]

Piecewise calculation.

Parameters

args (float) –

Return type

float

sbmlutils.converters.mathml.evaluableMathML(astnode, variables=None)[source]

Create evaluable python formula string from ASTNode.

Parameters
  • astnode (libsbml.ASTNode) –

  • variables (Optional[Dict]) –

Return type

str

sbmlutils.converters.mathml.evaluateMathML(astnode, variables=None)[source]

Evaluate MathML string with given set of variable and parameter values.

Parameters
  • astnode (libsbml.ASTNode) – astnode of MathML string

  • variables (Optional[Dict]) – dictionary of var : value

Returns

value of evaluated MathML

Return type

Any

sbmlutils.converters.mathml.mathmlStr = Multiline-String[source]
Show Value
 1           <math xmlns="http://www.w3.org/1998/Math/MathML">
 2                <piecewise>
 3                  <piece>
 4                    <cn type="integer"> 8 </cn>
 5                    <apply>
 6                      <lt/>
 7                      <ci> x </ci>
 8                      <cn type="integer"> 4 </cn>
 9                    </apply>
10                  </piece>
11                  <piece>
12                    <cn> 0.1 </cn>
13                    <apply>
14                      <and/>
15                      <apply>
16                        <leq/>
17                        <cn type="integer"> 4 </cn>
18                        <ci> x </ci>
19                      </apply>
20                      <apply>
21                        <lt/>
22                        <ci> x </ci>
23                        <cn type="integer"> 6 </cn>
24                      </apply>
25                    </apply>
26                  </piece>
27                  <otherwise>
28                    <cn type="integer"> 8 </cn>
29                  </otherwise>
30                </piecewise>
31              </math>