Unit checking warnings on log(2 dimensionless)

8 views
Skip to first unread message

Matthias König

unread,
Dec 17, 2018, 11:40:07 AM12/17/18
to libsbml-development
Hi all,

I have a formula which uses log(2).
In earlier versions of libsbml, i.e. libsbml 5.15.0 it was possible to use log(2) within unit validation by stating that the 2 is dimensionless and the log evalutated then to dimensionless units, i.e. log(2 dimensionless). This does not work anymore in the latest libsbml.

With libsbml-5.17.2 (and libsbml 5.16.0) I now get unit validation errors on log(2 dimensionless). I noticed this when recreating an old model with the new libsbml version.

E0: SBML unit consistency (core, L75, code)
[Warning] Missing unit declarations on parameters or literal numbers in expression
In situations where a mathematical expression contains literal numbers or parameters whose units have not been declared, it is not possible to verify accurately the consistency of the units in the expression.
The units of the <assignmentRule> <math> expression 'log10(2)' cannot be fully checked. Unit consistency reported as either no errors or further unit errors related to this object may not be accurate.

/home/mkoenig/git/sbmlutils/sbmlutils/validation.py:175 log_errors ERROR
E1: SBML component consistency (comp, L1, code)
[Warning] Line numbers unreliable.
Due to the need to instantiate models, modelDefinitions, submodels etc. for the purposes of validation it is problematic to reliably report line numbers when performing validation on models using the Hierarchical Model Composition package.

/home/mkoenig/git/sbmlutils/sbmlutils/validation.py:175 log_errors ERROR
E2: SBML unit consistency (core, L75, code)
[Warning] Missing unit declarations on parameters or literal numbers in expression
In situations where a mathematical expression contains literal numbers or parameters whose units have not been declared, it is not possible to verify accurately the consistency of the units in the expression.
The units of the <assignmentRule> <math> expression 'log10(2)' cannot be fully checked. Unit consistency reported as either no errors or further unit errors related to this object may not be accurate.

A minimal example model is attached showing the issue.
Changing it to log(2) without the inline unit on the constant works. But in my opinion better praxis to allow the inline unit. The explicit stating of the unit should still be supported.

Best Matthias



log2_test_1.xml

Matthias König

unread,
Dec 17, 2018, 11:49:56 AM12/17/18
to libsbml-development
Sorry, just checked against the wrong library version.

Neither
log(2)
nor
log(2 dimensionless)
is working in unit validation in libsbml 5.17.2.

Other functions work correctly in unit validation, for instance
exp(2 dimensionless). So this seems to be a bug in unit validation.
See example attached.
Best M
log2_test_2.xml

Keating, Sarah M.

unread,
Dec 20, 2018, 5:09:11 AM12/20/18
to libsbml-d...@googlegroups.com
Thanks Matthias for the report/example. I haven't had time to get to it
yet. It is first on my libSBML to do list :-)

Sarah

Keating, Sarah M.

unread,
Jan 2, 2019, 6:28:13 AM1/2/19
to libsbml-d...@googlegroups.com
Hi Matthias

This is fixed in trunk and the online validator.

Both Frank and Brett are still away but once they are both
back/available we will update PyPi and all the other Combine libraries
that use libsbml to sort your build issues.

Thanks for the good reports/with examples - it makes finding the issue
so much easier.

Sarah

Matthias König

unread,
Jan 2, 2019, 9:35:54 AM1/2/19
to libsbml-development
Hi Sarah,
thanks a lot for the fix.

I wanted to check the next few days if the issue with the various COMBINE python bindings still exists with the latest version and will write a detailed issue report with some test code.
In summary, I always had issues making the various COMBINE libraries work together if they are not build against the same libsbml with the same cmake settings.
This resulted in segfaults when using the libraries, e.g. python-libsbml, python-libsedml, python-libnuml and python-libcombine together in a project.

I will post an update as soon as I have checked.
Best Matthias
Reply all
Reply to author
Forward
0 new messages