petab.v1.math.printer
A PEtab-compatible sympy string-printer.
Functions
|
Convert a sympy expression to a PEtab-compatible math expression string. |
Classes
|
A PEtab-compatible sympy string-printer. |
- class petab.v1.math.printer.PetabStrPrinter(settings=None)[source]
Bases:
StrPrinterA PEtab-compatible sympy string-printer.
- petab.v1.math.printer.petab_math_str(expr: Basic | Expr | None) str[source]
Convert a sympy expression to a PEtab-compatible math expression string.
- Example:
>>> expr = sp.sympify("x**2 + sin(y)") >>> petab_math_str(expr) 'x ^ 2 + sin(y)' >>> expr = sp.sympify("Piecewise((1, x > 0), (0, True))") >>> petab_math_str(expr) 'piecewise(1, x > 0, 0)'