Unit validation with distrib uniform not working
matthiaskoenig opened this issue · 6 comments
Hi all,
I have an SBML model with an initial assignment from a uniform distribution (model attached).
spt_random.zip
Despite having set the units on the distributions I get a unit validation warning.
It seems like the unit validation does not work with the distributions.
Here the basic structure. An initial assignment from a uniform(0 dimensionless, 1 dimensionless)
to a parameter which is dimensionless. I.e. the distribution and the parameter are compatible, but still get the warning below.
<listOfParameters>
<parameter id="protein_random" value="0.5" units="dimensionless" constant="true"/>
</listOfParameters>
<listOfInitialAssignments>
<initialAssignment symbol="protein_random">
<math xmlns="http://www.w3.org/1998/Math/MathML" xmlns:sbml="http://www.sbml.org/sbml/level3/version2/core">
<apply>
<csymbol encoding="text" definitionURL="http://www.sbml.org/sbml/symbols/distrib/uniform"> uniform </csymbol>
<cn sbml:units="dimensionless" type="integer"> 0 </cn>
<cn sbml:units="dimensionless" type="integer"> 1 </cn>
</apply>
</math>
</initialAssignment>
</listOfInitialAssignments>
WARNING E0: SBML unit consistency (core, L91, code) validation.py:186
[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 <initialAssignment> <math> expression 'uniform(0, 1)' cannot be fully checked. Unit consistency reported as either no errors or further unit errors related to this object may not
be accurate.
Probably similar things happen with the other csymbol distributions.
Best Matthias
looks like unit validation cannot know what the result of a function defined in the distrib package is. I am not aware of any plugin system in libSBML that allows packages to extend unit validation. Will have to discuss with @skeating
Thanks.
I tried the following 'uniform(0, 1) dimensionless', i.e. annotating the unit of the csymbol similar to constants in math expressions (e.g.
1 dimensionless`). Not sure if something like this could work to communicate the unit.
it feels like the proper thing to do would be to have the distrib plugin provide information about the csymbols and the unit input/output relationship. adding dimensionless like in your example would prove troublesome in more involved expressions, potentially.
Hi all,
is there some simple solution to support unit validation for the distributions? I have some models using the distrib features with units and these errors make it hard to unit validate the models.
Best Matthias
Thanks so much.
we'll try to get new binaries out next week