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
"""
           <math xmlns="http://www.w3.org/1998/Math/MathML">
                <piecewise>
                  <piece>
                    <cn type="integer"> 8 </cn>
                    <apply>
                      <lt/>
                      <ci> x </ci>
                      <cn type="integer"> 4 </cn>
                    </apply>
                  </piece>
                  <piece>
                    <cn> 0.1 </cn>
                    <apply>
                      <and/>
                      <apply>
                        <leq/>
                        <cn type="integer"> 4 </cn>
                        <ci> x </ci>
                      </apply>
                      <apply>
                        <lt/>
                        <ci> x </ci>
                        <cn type="integer"> 6 </cn>
                      </apply>
                    </apply>
                  </piece>
                  <otherwise>
                    <cn type="integer"> 8 </cn>
                  </otherwise>
                </piecewise>
              </math>
    """