biosimulators / Biosimulators_utils

Utilities for building standardized command-line interfaces for biosimulation software packages
https://docs.biosimulators.org/Biosimulators_utils
MIT License
4 stars 6 forks source link

substitute '**' for '^' for python execution of sedml changes #119

Closed jcschaff closed 1 year ago

jcschaff commented 1 year ago

fix SEDML validation error when model changes include power operator

see Issue 118: "infix math from libsedml uses '^' instead of '**' in python, validation fails

Background

if the MathML for a computeChange contains a operator, the infix notation from returned by libsedml.formulaToL3String() represents the pow operator as '^', but the corresponding python syntax is '**'. During validation of a computed change, this infix representation (stored in change.math) is evaluated and fails if the operands are not compatible with bitwise XOR (e.g. if either operand is a float)

compile_math() function in Biosimulators_utils/sedml/math.py now replaces '^' with '**' in infix strings before python evaluation. It is assumed that SEDML MathML will not support the bitwise XOR operator.

Fixes the following bug

Testing

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication