SBML distrib

The following examples demonstrate the creation of SBML models with SBML distrib information.

%load_ext autoreload
%autoreload 2
from notebook_utils import print_xml
from sbmlutils.units import *
from sbmlutils.factory import *
from sbmlutils.modelcreator.creator import CoreModel
from sbmlutils.validation import check_doc

Assigning a distribution to a parameter

Here we create a parameter

\[p_1 = 0.0\]

and assign the initial value from a normal distribution with mean=0 and standard deviation=1

\[p_1 = \sigma(0,1)\]
model_dict = {
    'mid': 'distrib_assignment',
    'packages': ['distrib'],
    'model_units': ModelUnits(time=UNIT_hr, extent=UNIT_KIND_MOLE, substance=UNIT_KIND_MOLE,
                              length=UNIT_m, area=UNIT_m2, volume=UNIT_KIND_LITRE),
    'units': [UNIT_hr, UNIT_m, UNIT_m2, UNIT_mM],
    'parameters': [
        Parameter(sid="p1", value=0.0, unit=UNIT_mM)
    ],
    'assignments': [
        InitialAssignment('p1', 'normal(0 mM, 1 mM)'),
    ]
}

# create model and print SBML
core_model = CoreModel.from_dict(model_dict=model_dict)
print_xml(core_model.get_sbml())

# validate model
check_doc(core_model.doc, units_consistency=False);
<?xml version="1.0" encoding="UTF-8"?>
<sbml xmlns="http://www.sbml.org/sbml/level3/version1/core" xmlns:comp="http://www.sbml.org/sbml/level3/version1/comp/version1" xmlns:distrib="http://www.sbml.org/sbml/level3/version1/distrib/version1" level="3" version="1" comp:required="true" distrib:required="true">
  <model metaid="meta_distrib_assignment" id="distrib_assignment" name="distrib_assignment" substanceUnits="mole" timeUnits="hr" volumeUnits="litre" areaUnits="m2" lengthUnits="m" extentUnits="mole">
    <listOfUnitDefinitions>
      <unitDefinition id="hr">
        <listOfUnits>
          <unit kind="second" exponent="1" scale="0" multiplier="3600"/>
        </listOfUnits>
      </unitDefinition>
      <unitDefinition id="m">
        <listOfUnits>
          <unit kind="metre" exponent="1" scale="0" multiplier="1"/>
        </listOfUnits>
      </unitDefinition>
      <unitDefinition id="m2">
        <listOfUnits>
          <unit kind="metre" exponent="2" scale="0" multiplier="1"/>
        </listOfUnits>
      </unitDefinition>
      <unitDefinition id="mM">
        <listOfUnits>
          <unit kind="mole" exponent="1" scale="-3" multiplier="1"/>
          <unit kind="litre" exponent="-1" scale="0" multiplier="1"/>
        </listOfUnits>
      </unitDefinition>
    </listOfUnitDefinitions>
    <listOfParameters>
      <parameter id="p1" value="0" units="mM" constant="true"/>
    </listOfParameters>
    <listOfInitialAssignments>
      <initialAssignment symbol="p1">
        <math xmlns="http://www.w3.org/1998/Math/MathML" xmlns:sbml="http://www.sbml.org/sbml/level3/version1/core">
          <apply>
            <csymbol encoding="text" definitionURL="http://www.sbml.org/sbml/symbols/distrib/normal"> normal </csymbol>
            <cn sbml:units="mM" type="integer"> 0 </cn>
            <cn sbml:units="mM" type="integer"> 1 </cn>
          </apply>
        </math>
      </initialAssignment>
    </listOfInitialAssignments>
    <comp:listOfPorts>
      <comp:port metaid="hr_port" sboTerm="SBO:0000599" comp:unitRef="hr" comp:id="hr_port" comp:name="hr_port"/>
      <comp:port metaid="m_port" sboTerm="SBO:0000599" comp:unitRef="m" comp:id="m_port" comp:name="m_port"/>
      <comp:port metaid="m2_port" sboTerm="SBO:0000599" comp:unitRef="m2" comp:id="m2_port" comp:name="m2_port"/>
      <comp:port metaid="mM_port" sboTerm="SBO:0000599" comp:unitRef="mM" comp:id="mM_port" comp:name="mM_port"/>
    </comp:listOfPorts>
  </model>
</sbml>
WARNING:root:
--------------------------------------------------------------------------------
<SBMLDocument>
valid                    : TRUE
validation error(s)      : 0
validation warnings(s)   : 2
check time (s)           : 0.002
--------------------------------------------------------------------------------

WARNING:root:E0: 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.

WARNING:root:E1: SBML component consistency (comp, L1, code)
[Warning] Flattening not implemented for required package.
The CompFlatteningConverter has encountered a required package for which the necessary routines to allow flattening have not yet been implemented.
 The CompFlatteningConverter has the 'abortIfUnflattenable' option set to 'requiredOnly'  and thus flattening will not be attempted.


Using a normal distribution

In this example, the initial value of y is set as a draw from the normal distribution normal(z,10):

model_dict = {
    'mid': 'normal',
    'packages': ['distrib'],
    'parameters': [
        Parameter('y', value=1.0),
        Parameter('z', value=1.0),
    ],
    'assignments': [
        InitialAssignment('y', 'normal(z, 10)'),
    ]
}

# create model and print SBML
core_model = CoreModel.from_dict(model_dict=model_dict)
print_xml(core_model.get_sbml())

# validate model
check_doc(core_model.doc, units_consistency=False);
ERROR:root:Model units should be provided for a model, i.e., set the 'model_units' field on model.
<?xml version="1.0" encoding="UTF-8"?>
<sbml xmlns="http://www.sbml.org/sbml/level3/version1/core" xmlns:comp="http://www.sbml.org/sbml/level3/version1/comp/version1" xmlns:distrib="http://www.sbml.org/sbml/level3/version1/distrib/version1" level="3" version="1" comp:required="true" distrib:required="true">
  <model metaid="meta_normal" id="normal" name="normal">
    <listOfParameters>
      <parameter id="y" value="1" constant="true"/>
      <parameter id="z" value="1" constant="true"/>
    </listOfParameters>
    <listOfInitialAssignments>
      <initialAssignment symbol="y">
        <math xmlns="http://www.w3.org/1998/Math/MathML">
          <apply>
            <csymbol encoding="text" definitionURL="http://www.sbml.org/sbml/symbols/distrib/normal"> normal </csymbol>
            <ci> z </ci>
            <cn type="integer"> 10 </cn>
          </apply>
        </math>
      </initialAssignment>
    </listOfInitialAssignments>
  </model>
</sbml>
WARNING:root:
--------------------------------------------------------------------------------
<SBMLDocument>
valid                    : TRUE
validation error(s)      : 0
validation warnings(s)   : 2
check time (s)           : 0.001
--------------------------------------------------------------------------------

WARNING:root:E0: 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.

WARNING:root:E1: SBML component consistency (comp, L1, code)
[Warning] Flattening not implemented for required package.
The CompFlatteningConverter has encountered a required package for which the necessary routines to allow flattening have not yet been implemented.
 The CompFlatteningConverter has the 'abortIfUnflattenable' option set to 'requiredOnly'  and thus flattening will not be attempted.


Defining a truncated normal distribution

When used with four arguments instead of two, the normal distribution is truncated to normal(z, 10, z-2, z+2). This use would apply a draw from a normal distribution with mean z, standard deviation 10, lower bound z-2 (inclusive) and upper bound z+2 (not inclusive) to the SBML symbol y.

model_dict = {
    'mid': 'truncated_normal',
    'packages': ['distrib'],
    'parameters': [
        Parameter('y', value=1.0),
        Parameter('z', value=1.0),
    ],
    'assignments': [
        InitialAssignment('y', 'normal(z, 10, z-2, z+2)'),
    ]
}

# create model and print SBML
core_model = CoreModel.from_dict(model_dict=model_dict)
print_xml(core_model.get_sbml())

# validate model
check_doc(core_model.doc, units_consistency=False);
ERROR:root:Model units should be provided for a model, i.e., set the 'model_units' field on model.
<?xml version="1.0" encoding="UTF-8"?>
<sbml xmlns="http://www.sbml.org/sbml/level3/version1/core" xmlns:comp="http://www.sbml.org/sbml/level3/version1/comp/version1" xmlns:distrib="http://www.sbml.org/sbml/level3/version1/distrib/version1" level="3" version="1" comp:required="true" distrib:required="true">
  <model metaid="meta_truncated_normal" id="truncated_normal" name="truncated_normal">
    <listOfParameters>
      <parameter id="y" value="1" constant="true"/>
      <parameter id="z" value="1" constant="true"/>
    </listOfParameters>
    <listOfInitialAssignments>
      <initialAssignment symbol="y">
        <math xmlns="http://www.w3.org/1998/Math/MathML">
          <apply>
            <csymbol encoding="text" definitionURL="http://www.sbml.org/sbml/symbols/distrib/normal"> normal </csymbol>
            <ci> z </ci>
            <cn type="integer"> 10 </cn>
            <apply>
              <minus/>
              <ci> z </ci>
              <cn type="integer"> 2 </cn>
            </apply>
            <apply>
              <plus/>
              <ci> z </ci>
              <cn type="integer"> 2 </cn>
            </apply>
          </apply>
        </math>
      </initialAssignment>
    </listOfInitialAssignments>
  </model>
</sbml>
WARNING:root:
--------------------------------------------------------------------------------
<SBMLDocument>
valid                    : TRUE
validation error(s)      : 0
validation warnings(s)   : 2
check time (s)           : 0.001
--------------------------------------------------------------------------------

WARNING:root:E0: 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.

WARNING:root:E1: SBML component consistency (comp, L1, code)
[Warning] Flattening not implemented for required package.
The CompFlatteningConverter has encountered a required package for which the necessary routines to allow flattening have not yet been implemented.
 The CompFlatteningConverter has the 'abortIfUnflattenable' option set to 'requiredOnly'  and thus flattening will not be attempted.


Defining conditional events

Simultaneous events in SBML are ordered based on their Priority values, with higher values being executed first, and potentially cancelling events that fire after them. In this example, two simultaneous events have priorities set with csymbols defined in distrib. The event E0 has a priority of uniform(0,1), while the event E1 has a priority of uniform(0,2). This means that 75% of the time, event E1 will have a higher priority than E0, and will fire first, assigning a value of 5 to parameter x. Because this negates the trigger condition for E0, which is set persistent="false", this means that E0 never fires, and the value of x remains at 5. The remaining 25% of the time, the reverse happens, with E0 setting the value of x to 3 instead.

model_dict = {
    'mid': 'conditional_events',
    'packages': ['distrib'],
    'parameters': [
        Parameter('x', value=1.0, constant=False)
    ],
    'events': [
        Event(
            "E0",
            trigger="time>2 && x<1",
            priority="uniform(0, 1)",
            trigger_initialValue=True, trigger_persistent=False,
            assignments={"x": "3"}
        ),
        Event(
            "E1",
            trigger="time>2 && x<1",
            priority="uniform(0, 2)",
            trigger_initialValue=True, trigger_persistent=False,
            assignments={"x": "5"}
        )
    ]
}

# create model and print SBML
core_model = CoreModel.from_dict(model_dict=model_dict)
print_xml(core_model.get_sbml())

# validate model
check_doc(core_model.doc, units_consistency=False);
ERROR:root:Model units should be provided for a model, i.e., set the 'model_units' field on model.
<?xml version="1.0" encoding="UTF-8"?>
<sbml xmlns="http://www.sbml.org/sbml/level3/version1/core" xmlns:comp="http://www.sbml.org/sbml/level3/version1/comp/version1" xmlns:distrib="http://www.sbml.org/sbml/level3/version1/distrib/version1" level="3" version="1" comp:required="true" distrib:required="true">
  <model metaid="meta_conditional_events" id="conditional_events" name="conditional_events">
    <listOfParameters>
      <parameter id="x" value="1" constant="false"/>
    </listOfParameters>
    <listOfEvents>
      <event id="E0" useValuesFromTriggerTime="true">
        <trigger initialValue="true" persistent="false">
          <math xmlns="http://www.w3.org/1998/Math/MathML">
            <apply>
              <and/>
              <apply>
                <gt/>
                <csymbol encoding="text" definitionURL="http://www.sbml.org/sbml/symbols/time"> time </csymbol>
                <cn type="integer"> 2 </cn>
              </apply>
              <apply>
                <lt/>
                <ci> x </ci>
                <cn type="integer"> 1 </cn>
              </apply>
            </apply>
          </math>
        </trigger>
        <priority>
          <math xmlns="http://www.w3.org/1998/Math/MathML">
            <apply>
              <csymbol encoding="text" definitionURL="http://www.sbml.org/sbml/symbols/distrib/uniform"> uniform </csymbol>
              <cn type="integer"> 0 </cn>
              <cn type="integer"> 1 </cn>
            </apply>
          </math>
        </priority>
        <listOfEventAssignments>
          <eventAssignment variable="x">
            <math xmlns="http://www.w3.org/1998/Math/MathML">
              <cn type="integer"> 3 </cn>
            </math>
          </eventAssignment>
        </listOfEventAssignments>
      </event>
      <event id="E1" useValuesFromTriggerTime="true">
        <trigger initialValue="true" persistent="false">
          <math xmlns="http://www.w3.org/1998/Math/MathML">
            <apply>
              <and/>
              <apply>
                <gt/>
                <csymbol encoding="text" definitionURL="http://www.sbml.org/sbml/symbols/time"> time </csymbol>
                <cn type="integer"> 2 </cn>
              </apply>
              <apply>
                <lt/>
                <ci> x </ci>
                <cn type="integer"> 1 </cn>
              </apply>
            </apply>
          </math>
        </trigger>
        <priority>
          <math xmlns="http://www.w3.org/1998/Math/MathML">
            <apply>
              <csymbol encoding="text" definitionURL="http://www.sbml.org/sbml/symbols/distrib/uniform"> uniform </csymbol>
              <cn type="integer"> 0 </cn>
              <cn type="integer"> 2 </cn>
            </apply>
          </math>
        </priority>
        <listOfEventAssignments>
          <eventAssignment variable="x">
            <math xmlns="http://www.w3.org/1998/Math/MathML">
              <cn type="integer"> 5 </cn>
            </math>
          </eventAssignment>
        </listOfEventAssignments>
      </event>
    </listOfEvents>
  </model>
</sbml>
WARNING:root:
--------------------------------------------------------------------------------
<SBMLDocument>
valid                    : TRUE
validation error(s)      : 0
validation warnings(s)   : 2
check time (s)           : 0.002
--------------------------------------------------------------------------------

WARNING:root:E0: 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.

WARNING:root:E1: SBML component consistency (comp, L1, code)
[Warning] Flattening not implemented for required package.
The CompFlatteningConverter has encountered a required package for which the necessary routines to allow flattening have not yet been implemented.
 The CompFlatteningConverter has the 'abortIfUnflattenable' option set to 'requiredOnly'  and thus flattening will not be attempted.


Overview of all distributions

The following gives an example how to use all of the various distributions

model_dict = {
    'mid': 'all_distributions',
    'packages': ['distrib'],
    'assignments': [
        InitialAssignment('p_normal_1', 'normal(0, 1)'),
        InitialAssignment('p_normal_2', 'normal(0, 1, 0, 10)'),
        InitialAssignment('p_uniform', 'uniform(5, 10)'),
        InitialAssignment('p_bernoulli', 'bernoulli(0.4)'),
        InitialAssignment('p_binomial_1', 'binomial(100, 0.3)'),
        InitialAssignment('p_binomial_2', 'binomial(100, 0.3, 0, 2)'),
        InitialAssignment('p_cauchy_1', 'cauchy(0, 1)'),
        InitialAssignment('p_cauchy_2', 'cauchy(0, 1, 0, 5)'),
        InitialAssignment('p_chisquare_1', 'chisquare(10)'),
        InitialAssignment('p_chisquare_2', 'chisquare(10, 0, 10)'),
        InitialAssignment('p_exponential_1', 'exponential(1.0)'),
        InitialAssignment('p_exponential_2', 'exponential(1.0, 0, 10)'),
        InitialAssignment('p_gamma_1', 'gamma(0, 1)'),
        InitialAssignment('p_gamma_2', 'gamma(0, 1, 0, 10)'),
        InitialAssignment('p_laplace_1', 'laplace(0, 1)'),
        InitialAssignment('p_laplace_2', 'laplace(0, 1, 0, 10)'),
        InitialAssignment('p_lognormal_1', 'lognormal(0, 1)'),
        InitialAssignment('p_lognormal_2', 'lognormal(0, 1, 0, 10)'),
        InitialAssignment('p_poisson_1', 'poisson(0.5)'),
        InitialAssignment('p_poisson_2', 'poisson(0.5, 0, 10)'),
        InitialAssignment('p_raleigh_1', 'rayleigh(0.5)'),
        InitialAssignment('p_raleigh_2', 'rayleigh(0.5, 0, 10)'),
    ]
}

# create model and print SBML
core_model = CoreModel.from_dict(model_dict=model_dict)
print_xml(core_model.get_sbml())

# validate model
check_doc(core_model.doc, units_consistency=False);
ERROR:root:Model units should be provided for a model, i.e., set the 'model_units' field on model.
<?xml version="1.0" encoding="UTF-8"?>
<sbml xmlns="http://www.sbml.org/sbml/level3/version1/core" xmlns:comp="http://www.sbml.org/sbml/level3/version1/comp/version1" xmlns:distrib="http://www.sbml.org/sbml/level3/version1/distrib/version1" level="3" version="1" comp:required="true" distrib:required="true">
  <model metaid="meta_all_distributions" id="all_distributions" name="all_distributions">
    <listOfParameters>
      <parameter id="p_normal_1" units="dimensionless" constant="true"/>
      <parameter id="p_normal_2" units="dimensionless" constant="true"/>
      <parameter id="p_uniform" units="dimensionless" constant="true"/>
      <parameter id="p_bernoulli" units="dimensionless" constant="true"/>
      <parameter id="p_binomial_1" units="dimensionless" constant="true"/>
      <parameter id="p_binomial_2" units="dimensionless" constant="true"/>
      <parameter id="p_cauchy_1" units="dimensionless" constant="true"/>
      <parameter id="p_cauchy_2" units="dimensionless" constant="true"/>
      <parameter id="p_chisquare_1" units="dimensionless" constant="true"/>
      <parameter id="p_chisquare_2" units="dimensionless" constant="true"/>
      <parameter id="p_exponential_1" units="dimensionless" constant="true"/>
      <parameter id="p_exponential_2" units="dimensionless" constant="true"/>
      <parameter id="p_gamma_1" units="dimensionless" constant="true"/>
      <parameter id="p_gamma_2" units="dimensionless" constant="true"/>
      <parameter id="p_laplace_1" units="dimensionless" constant="true"/>
      <parameter id="p_laplace_2" units="dimensionless" constant="true"/>
      <parameter id="p_lognormal_1" units="dimensionless" constant="true"/>
      <parameter id="p_lognormal_2" units="dimensionless" constant="true"/>
      <parameter id="p_poisson_1" units="dimensionless" constant="true"/>
      <parameter id="p_poisson_2" units="dimensionless" constant="true"/>
      <parameter id="p_raleigh_1" units="dimensionless" constant="true"/>
      <parameter id="p_raleigh_2" units="dimensionless" constant="true"/>
    </listOfParameters>
    <listOfInitialAssignments>
      <initialAssignment symbol="p_normal_1">
        <math xmlns="http://www.w3.org/1998/Math/MathML">
          <apply>
            <csymbol encoding="text" definitionURL="http://www.sbml.org/sbml/symbols/distrib/normal"> normal </csymbol>
            <cn type="integer"> 0 </cn>
            <cn type="integer"> 1 </cn>
          </apply>
        </math>
      </initialAssignment>
      <initialAssignment symbol="p_normal_2">
        <math xmlns="http://www.w3.org/1998/Math/MathML">
          <apply>
            <csymbol encoding="text" definitionURL="http://www.sbml.org/sbml/symbols/distrib/normal"> normal </csymbol>
            <cn type="integer"> 0 </cn>
            <cn type="integer"> 1 </cn>
            <cn type="integer"> 0 </cn>
            <cn type="integer"> 10 </cn>
          </apply>
        </math>
      </initialAssignment>
      <initialAssignment symbol="p_uniform">
        <math xmlns="http://www.w3.org/1998/Math/MathML">
          <apply>
            <csymbol encoding="text" definitionURL="http://www.sbml.org/sbml/symbols/distrib/uniform"> uniform </csymbol>
            <cn type="integer"> 5 </cn>
            <cn type="integer"> 10 </cn>
          </apply>
        </math>
      </initialAssignment>
      <initialAssignment symbol="p_bernoulli">
        <math xmlns="http://www.w3.org/1998/Math/MathML">
          <apply>
            <csymbol encoding="text" definitionURL="http://www.sbml.org/sbml/symbols/distrib/bernoulli"> bernoulli </csymbol>
            <cn> 0.4 </cn>
          </apply>
        </math>
      </initialAssignment>
      <initialAssignment symbol="p_binomial_1">
        <math xmlns="http://www.w3.org/1998/Math/MathML">
          <apply>
            <csymbol encoding="text" definitionURL="http://www.sbml.org/sbml/symbols/distrib/binomial"> binomial </csymbol>
            <cn type="integer"> 100 </cn>
            <cn> 0.3 </cn>
          </apply>
        </math>
      </initialAssignment>
      <initialAssignment symbol="p_binomial_2">
        <math xmlns="http://www.w3.org/1998/Math/MathML">
          <apply>
            <csymbol encoding="text" definitionURL="http://www.sbml.org/sbml/symbols/distrib/binomial"> binomial </csymbol>
            <cn type="integer"> 100 </cn>
            <cn> 0.3 </cn>
            <cn type="integer"> 0 </cn>
            <cn type="integer"> 2 </cn>
          </apply>
        </math>
      </initialAssignment>
      <initialAssignment symbol="p_cauchy_1">
        <math xmlns="http://www.w3.org/1998/Math/MathML">
          <apply>
            <csymbol encoding="text" definitionURL="http://www.sbml.org/sbml/symbols/distrib/cauchy"> cauchy </csymbol>
            <cn type="integer"> 0 </cn>
            <cn type="integer"> 1 </cn>
          </apply>
        </math>
      </initialAssignment>
      <initialAssignment symbol="p_cauchy_2">
        <math xmlns="http://www.w3.org/1998/Math/MathML">
          <apply>
            <csymbol encoding="text" definitionURL="http://www.sbml.org/sbml/symbols/distrib/cauchy"> cauchy </csymbol>
            <cn type="integer"> 0 </cn>
            <cn type="integer"> 1 </cn>
            <cn type="integer"> 0 </cn>
            <cn type="integer"> 5 </cn>
          </apply>
        </math>
      </initialAssignment>
      <initialAssignment symbol="p_chisquare_1">
        <math xmlns="http://www.w3.org/1998/Math/MathML">
          <apply>
            <csymbol encoding="text" definitionURL="http://www.sbml.org/sbml/symbols/distrib/chisquare"> chisquare </csymbol>
            <cn type="integer"> 10 </cn>
          </apply>
        </math>
      </initialAssignment>
      <initialAssignment symbol="p_chisquare_2">
        <math xmlns="http://www.w3.org/1998/Math/MathML">
          <apply>
            <csymbol encoding="text" definitionURL="http://www.sbml.org/sbml/symbols/distrib/chisquare"> chisquare </csymbol>
            <cn type="integer"> 10 </cn>
            <cn type="integer"> 0 </cn>
            <cn type="integer"> 10 </cn>
          </apply>
        </math>
      </initialAssignment>
      <initialAssignment symbol="p_exponential_1">
        <math xmlns="http://www.w3.org/1998/Math/MathML">
          <apply>
            <csymbol encoding="text" definitionURL="http://www.sbml.org/sbml/symbols/distrib/exponential"> exponential </csymbol>
            <cn> 1 </cn>
          </apply>
        </math>
      </initialAssignment>
      <initialAssignment symbol="p_exponential_2">
        <math xmlns="http://www.w3.org/1998/Math/MathML">
          <apply>
            <csymbol encoding="text" definitionURL="http://www.sbml.org/sbml/symbols/distrib/exponential"> exponential </csymbol>
            <cn> 1 </cn>
            <cn type="integer"> 0 </cn>
            <cn type="integer"> 10 </cn>
          </apply>
        </math>
      </initialAssignment>
      <initialAssignment symbol="p_gamma_1">
        <math xmlns="http://www.w3.org/1998/Math/MathML">
          <apply>
            <csymbol encoding="text" definitionURL="http://www.sbml.org/sbml/symbols/distrib/gamma"> gamma </csymbol>
            <cn type="integer"> 0 </cn>
            <cn type="integer"> 1 </cn>
          </apply>
        </math>
      </initialAssignment>
      <initialAssignment symbol="p_gamma_2">
        <math xmlns="http://www.w3.org/1998/Math/MathML">
          <apply>
            <csymbol encoding="text" definitionURL="http://www.sbml.org/sbml/symbols/distrib/gamma"> gamma </csymbol>
            <cn type="integer"> 0 </cn>
            <cn type="integer"> 1 </cn>
            <cn type="integer"> 0 </cn>
            <cn type="integer"> 10 </cn>
          </apply>
        </math>
      </initialAssignment>
      <initialAssignment symbol="p_laplace_1">
        <math xmlns="http://www.w3.org/1998/Math/MathML">
          <apply>
            <csymbol encoding="text" definitionURL="http://www.sbml.org/sbml/symbols/distrib/laplace"> laplace </csymbol>
            <cn type="integer"> 0 </cn>
            <cn type="integer"> 1 </cn>
          </apply>
        </math>
      </initialAssignment>
      <initialAssignment symbol="p_laplace_2">
        <math xmlns="http://www.w3.org/1998/Math/MathML">
          <apply>
            <csymbol encoding="text" definitionURL="http://www.sbml.org/sbml/symbols/distrib/laplace"> laplace </csymbol>
            <cn type="integer"> 0 </cn>
            <cn type="integer"> 1 </cn>
            <cn type="integer"> 0 </cn>
            <cn type="integer"> 10 </cn>
          </apply>
        </math>
      </initialAssignment>
      <initialAssignment symbol="p_lognormal_1">
        <math xmlns="http://www.w3.org/1998/Math/MathML">
          <apply>
            <csymbol encoding="text" definitionURL="http://www.sbml.org/sbml/symbols/distrib/lognormal"> lognormal </csymbol>
            <cn type="integer"> 0 </cn>
            <cn type="integer"> 1 </cn>
          </apply>
        </math>
      </initialAssignment>
      <initialAssignment symbol="p_lognormal_2">
        <math xmlns="http://www.w3.org/1998/Math/MathML">
          <apply>
            <csymbol encoding="text" definitionURL="http://www.sbml.org/sbml/symbols/distrib/lognormal"> lognormal </csymbol>
            <cn type="integer"> 0 </cn>
            <cn type="integer"> 1 </cn>
            <cn type="integer"> 0 </cn>
            <cn type="integer"> 10 </cn>
          </apply>
        </math>
      </initialAssignment>
      <initialAssignment symbol="p_poisson_1">
        <math xmlns="http://www.w3.org/1998/Math/MathML">
          <apply>
            <csymbol encoding="text" definitionURL="http://www.sbml.org/sbml/symbols/distrib/poisson"> poisson </csymbol>
            <cn> 0.5 </cn>
          </apply>
        </math>
      </initialAssignment>
      <initialAssignment symbol="p_poisson_2">
        <math xmlns="http://www.w3.org/1998/Math/MathML">
          <apply>
            <csymbol encoding="text" definitionURL="http://www.sbml.org/sbml/symbols/distrib/poisson"> poisson </csymbol>
            <cn> 0.5 </cn>
            <cn type="integer"> 0 </cn>
            <cn type="integer"> 10 </cn>
          </apply>
        </math>
      </initialAssignment>
      <initialAssignment symbol="p_raleigh_1">
        <math xmlns="http://www.w3.org/1998/Math/MathML">
          <apply>
            <csymbol encoding="text" definitionURL="http://www.sbml.org/sbml/symbols/distrib/rayleigh"> rayleigh </csymbol>
            <cn> 0.5 </cn>
          </apply>
        </math>
      </initialAssignment>
      <initialAssignment symbol="p_raleigh_2">
        <math xmlns="http://www.w3.org/1998/Math/MathML">
          <apply>
            <csymbol encoding="text" definitionURL="http://www.sbml.org/sbml/symbols/distrib/rayleigh"> rayleigh </csymbol>
            <cn> 0.5 </cn>
            <cn type="integer"> 0 </cn>
            <cn type="integer"> 10 </cn>
          </apply>
        </math>
      </initialAssignment>
    </listOfInitialAssignments>
  </model>
</sbml>
WARNING:root:
--------------------------------------------------------------------------------
<SBMLDocument>
valid                    : TRUE
validation error(s)      : 0
validation warnings(s)   : 2
check time (s)           : 0.004
--------------------------------------------------------------------------------

WARNING:root:E0: 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.

WARNING:root:E1: SBML component consistency (comp, L1, code)
[Warning] Flattening not implemented for required package.
The CompFlatteningConverter has encountered a required package for which the necessary routines to allow flattening have not yet been implemented.
 The CompFlatteningConverter has the 'abortIfUnflattenable' option set to 'requiredOnly'  and thus flattening will not be attempted.


Basic uncertainty example

Here, the species with an initial amount of 3.22 is described as having a standard deviation of 0.3, a value that might be written as 3.22 +- 0.3.

import libsbml
model_dict = {
    'mid': 'basic_example_1',
    'packages': ['distrib'],
    'compartments': [
        Compartment("C", value=1.0)
    ],
    'species': [
        Species(sid="s1", compartment="C", initialAmount=3.22,
                uncertainties=[
                  Uncertainty(uncertParameters=[
                      UncertParameter(type=libsbml.DISTRIB_UNCERTTYPE_STANDARDDEVIATION, value=0.3)
                  ])
                ])
    ],
}

# create model and print SBML
core_model = CoreModel.from_dict(model_dict=model_dict)
print_xml(core_model.get_sbml())

# validate model
check_doc(core_model.doc, units_consistency=False);
ERROR:root:Model units should be provided for a model, i.e., set the 'model_units' field on model.
<?xml version="1.0" encoding="UTF-8"?>
<sbml xmlns="http://www.sbml.org/sbml/level3/version1/core" xmlns:comp="http://www.sbml.org/sbml/level3/version1/comp/version1" xmlns:distrib="http://www.sbml.org/sbml/level3/version1/distrib/version1" level="3" version="1" comp:required="true" distrib:required="true">
  <model metaid="meta_basic_example_1" id="basic_example_1" name="basic_example_1">
    <listOfCompartments>
      <compartment id="C" spatialDimensions="3" size="1" constant="true"/>
    </listOfCompartments>
    <listOfSpecies>
      <species id="s1" compartment="C" initialAmount="3.22" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false">
        <distrib:listOfUncertainties>
          <distrib:uncertainty>
            <distrib:uncertParameter distrib:value="0.3" distrib:type="standardDeviation"/>
          </distrib:uncertainty>
        </distrib:listOfUncertainties>
      </species>
    </listOfSpecies>
  </model>
</sbml>
WARNING:root:
--------------------------------------------------------------------------------
<SBMLDocument>
valid                    : TRUE
validation error(s)      : 0
validation warnings(s)   : 2
check time (s)           : 0.001
--------------------------------------------------------------------------------

WARNING:root:E0: 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.

WARNING:root:E1: SBML component consistency (comp, L1, code)
[Warning] Flattening not implemented for required package.
The CompFlatteningConverter has encountered a required package for which the necessary routines to allow flattening have not yet been implemented.
 The CompFlatteningConverter has the 'abortIfUnflattenable' option set to 'requiredOnly'  and thus flattening will not be attempted.


It is also possible to include additional information about the species, should more be known. In this example, the initial amount of 3.22 is noted as having a mean of 3.2, a standard deviation of 0.3, and a variance of 0.09.

import libsbml
model_dict = {
    'mid': 'basic_example_2',
    'packages': ['distrib'],
    'compartments': [
        Compartment("C", value=1.0)
    ],
    'species': [
        Species(sid="s1", compartment="C", initialAmount=3.22,
                uncertainties=[
                  Uncertainty(uncertParameters=[
                      UncertParameter(type=libsbml.DISTRIB_UNCERTTYPE_MEAN, value=3.2),
                      UncertParameter(type=libsbml.DISTRIB_UNCERTTYPE_STANDARDDEVIATION, value=0.3),
                      UncertParameter(type=libsbml.DISTRIB_UNCERTTYPE_VARIANCE, value=0.09),
                  ])
                ])
    ],
}

# create model and print SBML
core_model = CoreModel.from_dict(model_dict=model_dict)
print_xml(core_model.get_sbml())

# validate model
check_doc(core_model.doc, units_consistency=False);
ERROR:root:Model units should be provided for a model, i.e., set the 'model_units' field on model.
<?xml version="1.0" encoding="UTF-8"?>
<sbml xmlns="http://www.sbml.org/sbml/level3/version1/core" xmlns:comp="http://www.sbml.org/sbml/level3/version1/comp/version1" xmlns:distrib="http://www.sbml.org/sbml/level3/version1/distrib/version1" level="3" version="1" comp:required="true" distrib:required="true">
  <model metaid="meta_basic_example_2" id="basic_example_2" name="basic_example_2">
    <listOfCompartments>
      <compartment id="C" spatialDimensions="3" size="1" constant="true"/>
    </listOfCompartments>
    <listOfSpecies>
      <species id="s1" compartment="C" initialAmount="3.22" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false">
        <distrib:listOfUncertainties>
          <distrib:uncertainty>
            <distrib:uncertParameter distrib:value="3.2" distrib:type="mean"/>
            <distrib:uncertParameter distrib:value="0.3" distrib:type="standardDeviation"/>
            <distrib:uncertParameter distrib:value="0.09" distrib:type="variance"/>
          </distrib:uncertainty>
        </distrib:listOfUncertainties>
      </species>
    </listOfSpecies>
  </model>
</sbml>
WARNING:root:
--------------------------------------------------------------------------------
<SBMLDocument>
valid                    : TRUE
validation error(s)      : 0
validation warnings(s)   : 2
check time (s)           : 0.001
--------------------------------------------------------------------------------

WARNING:root:E0: 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.

WARNING:root:E1: SBML component consistency (comp, L1, code)
[Warning] Flattening not implemented for required package.
The CompFlatteningConverter has encountered a required package for which the necessary routines to allow flattening have not yet been implemented.
 The CompFlatteningConverter has the 'abortIfUnflattenable' option set to 'requiredOnly'  and thus flattening will not be attempted.


Multiple uncertainties

The following gives an example how to encode multiple uncertainties for a parameter. Here the two uncertainties 5.0 (mean) +- 0.3 (std) [2.0 - 8.0] and 4.5 (mean) +- 1.1 (std) [1.0 - 10.0] are set.

import libsbml
model_dict = {
    'mid': 'multiple_uncertainties',
    'packages': ['distrib'],
    'model_units': ModelUnits(time=UNIT_hr, extent=UNIT_KIND_MOLE, substance=UNIT_KIND_MOLE,
                              length=UNIT_m, area=UNIT_m2, volume=UNIT_KIND_LITRE),
    'units': [UNIT_hr, UNIT_m, UNIT_m2, UNIT_mM],
    'parameters': [
        Parameter(sid="p1", value=5.0, unit=UNIT_mM,
                  uncertainties=[
                      Uncertainty('p1_uncertainty_1', uncertParameters=[
                          UncertParameter(type=libsbml.DISTRIB_UNCERTTYPE_MEAN, value=5.0, unit=UNIT_mM),
                          UncertParameter(type=libsbml.DISTRIB_UNCERTTYPE_STANDARDDEVIATION, value=0.3, unit=UNIT_mM),
                          UncertSpan(type=libsbml.DISTRIB_UNCERTTYPE_RANGE, valueLower=2.0, valueUpper=8.0, unit=UNIT_mM),
                      ]),
                      Uncertainty('p1_uncertainty_2', uncertParameters=[
                          UncertParameter(type=libsbml.DISTRIB_UNCERTTYPE_MEAN, value=4.5, unit=UNIT_mM),
                          UncertParameter(type=libsbml.DISTRIB_UNCERTTYPE_STANDARDDEVIATION, value=1.1, unit=UNIT_mM),
                          UncertSpan(type=libsbml.DISTRIB_UNCERTTYPE_RANGE, valueLower=1.0, valueUpper=10.0, unit=UNIT_mM),
                      ])
                  ])
    ],
    'assignments': [
        InitialAssignment('p1', 'normal(0 mM, 1 mM)'),
    ]
}

# create model and print SBML
core_model = CoreModel.from_dict(model_dict=model_dict)
print_xml(core_model.get_sbml())

# validate model
check_doc(core_model.doc, units_consistency=False);
<?xml version="1.0" encoding="UTF-8"?>
<sbml xmlns="http://www.sbml.org/sbml/level3/version1/core" xmlns:comp="http://www.sbml.org/sbml/level3/version1/comp/version1" xmlns:distrib="http://www.sbml.org/sbml/level3/version1/distrib/version1" level="3" version="1" comp:required="true" distrib:required="true">
  <model metaid="meta_multiple_uncertainties" id="multiple_uncertainties" name="multiple_uncertainties" substanceUnits="mole" timeUnits="hr" volumeUnits="litre" areaUnits="m2" lengthUnits="m" extentUnits="mole">
    <listOfUnitDefinitions>
      <unitDefinition id="hr">
        <listOfUnits>
          <unit kind="second" exponent="1" scale="0" multiplier="3600"/>
        </listOfUnits>
      </unitDefinition>
      <unitDefinition id="m">
        <listOfUnits>
          <unit kind="metre" exponent="1" scale="0" multiplier="1"/>
        </listOfUnits>
      </unitDefinition>
      <unitDefinition id="m2">
        <listOfUnits>
          <unit kind="metre" exponent="2" scale="0" multiplier="1"/>
        </listOfUnits>
      </unitDefinition>
      <unitDefinition id="mM">
        <listOfUnits>
          <unit kind="mole" exponent="1" scale="-3" multiplier="1"/>
          <unit kind="litre" exponent="-1" scale="0" multiplier="1"/>
        </listOfUnits>
      </unitDefinition>
    </listOfUnitDefinitions>
    <listOfParameters>
      <parameter id="p1" value="5" units="mM" constant="true">
        <distrib:listOfUncertainties>
          <distrib:uncertainty>
            <distrib:uncertParameter distrib:value="5" distrib:units="mM" distrib:type="mean"/>
            <distrib:uncertParameter distrib:value="0.3" distrib:units="mM" distrib:type="standardDeviation"/>
            <distrib:uncertSpan distrib:units="mM" distrib:type="range" distrib:valueLower="2" distrib:valueUpper="8"/>
          </distrib:uncertainty>
          <distrib:uncertainty>
            <distrib:uncertParameter distrib:value="4.5" distrib:units="mM" distrib:type="mean"/>
            <distrib:uncertParameter distrib:value="1.1" distrib:units="mM" distrib:type="standardDeviation"/>
            <distrib:uncertSpan distrib:units="mM" distrib:type="range" distrib:valueLower="1" distrib:valueUpper="10"/>
          </distrib:uncertainty>
        </distrib:listOfUncertainties>
      </parameter>
    </listOfParameters>
    <listOfInitialAssignments>
      <initialAssignment symbol="p1">
        <math xmlns="http://www.w3.org/1998/Math/MathML" xmlns:sbml="http://www.sbml.org/sbml/level3/version1/core">
          <apply>
            <csymbol encoding="text" definitionURL="http://www.sbml.org/sbml/symbols/distrib/normal"> normal </csymbol>
            <cn sbml:units="mM" type="integer"> 0 </cn>
            <cn sbml:units="mM" type="integer"> 1 </cn>
          </apply>
        </math>
      </initialAssignment>
    </listOfInitialAssignments>
    <comp:listOfPorts>
      <comp:port metaid="hr_port" sboTerm="SBO:0000599" comp:unitRef="hr" comp:id="hr_port" comp:name="hr_port"/>
      <comp:port metaid="m_port" sboTerm="SBO:0000599" comp:unitRef="m" comp:id="m_port" comp:name="m_port"/>
      <comp:port metaid="m2_port" sboTerm="SBO:0000599" comp:unitRef="m2" comp:id="m2_port" comp:name="m2_port"/>
      <comp:port metaid="mM_port" sboTerm="SBO:0000599" comp:unitRef="mM" comp:id="mM_port" comp:name="mM_port"/>
    </comp:listOfPorts>
  </model>
</sbml>
WARNING:root:
--------------------------------------------------------------------------------
<SBMLDocument>
valid                    : TRUE
validation error(s)      : 0
validation warnings(s)   : 2
check time (s)           : 0.002
--------------------------------------------------------------------------------

WARNING:root:E0: 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.

WARNING:root:E1: SBML component consistency (comp, L1, code)
[Warning] Flattening not implemented for required package.
The CompFlatteningConverter has encountered a required package for which the necessary routines to allow flattening have not yet been implemented.
 The CompFlatteningConverter has the 'abortIfUnflattenable' option set to 'requiredOnly'  and thus flattening will not be attempted.


Defining a random variable

In addition to describing the uncertainty about an experimental observation one can also use this mechanism to describe a parameter as a random variable.

import libsbml
model_dict = {
    'mid': 'random_variable',
    'packages': ['distrib'],
    'parameters': [
        Parameter("shape_Z", value=10.0),
        Parameter("scale_Z", value=0.1),
        Parameter("Z", value=0.1,
                  uncertainties=[
                      Uncertainty(formula="gamma(shape_Z, scale_Z)",
                                  uncertParameters=[
                                      UncertParameter(type=libsbml.DISTRIB_UNCERTTYPE_MEAN, value=1.03),
                                      UncertParameter(type=libsbml.DISTRIB_UNCERTTYPE_VARIANCE, value=0.97),
                                  ])
                  ])
    ]
}

# create model and print SBML
core_model = CoreModel.from_dict(model_dict=model_dict)
print_xml(core_model.get_sbml())

# validate model
check_doc(core_model.doc, units_consistency=False);
ERROR:root:Model units should be provided for a model, i.e., set the 'model_units' field on model.
<?xml version="1.0" encoding="UTF-8"?>
<sbml xmlns="http://www.sbml.org/sbml/level3/version1/core" xmlns:comp="http://www.sbml.org/sbml/level3/version1/comp/version1" xmlns:distrib="http://www.sbml.org/sbml/level3/version1/distrib/version1" level="3" version="1" comp:required="true" distrib:required="true">
  <model metaid="meta_random_variable" id="random_variable" name="random_variable">
    <listOfParameters>
      <parameter id="shape_Z" value="10" constant="true"/>
      <parameter id="scale_Z" value="0.1" constant="true"/>
      <parameter id="Z" value="0.1" constant="true">
        <distrib:listOfUncertainties>
          <distrib:uncertainty>
            <distrib:uncertParameter distrib:value="1.03" distrib:type="mean"/>
            <distrib:uncertParameter distrib:value="0.97" distrib:type="variance"/>
            <distrib:uncertParameter distrib:type="distribution" distrib:definitionURL="http://www.sbml.org/sbml/symbols/distrib/gamma">
              <math xmlns="http://www.w3.org/1998/Math/MathML">
                <apply>
                  <csymbol encoding="text" definitionURL="http://www.sbml.org/sbml/symbols/distrib/gamma"> gamma </csymbol>
                  <ci> shape_Z </ci>
                  <ci> scale_Z </ci>
                </apply>
              </math>
            </distrib:uncertParameter>
          </distrib:uncertainty>
        </distrib:listOfUncertainties>
      </parameter>
    </listOfParameters>
  </model>
</sbml>
WARNING:root:
--------------------------------------------------------------------------------
<SBMLDocument>
valid                    : TRUE
validation error(s)      : 0
validation warnings(s)   : 2
check time (s)           : 0.001
--------------------------------------------------------------------------------

WARNING:root:E0: 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.

WARNING:root:E1: SBML component consistency (comp, L1, code)
[Warning] Flattening not implemented for required package.
The CompFlatteningConverter has encountered a required package for which the necessary routines to allow flattening have not yet been implemented.
 The CompFlatteningConverter has the 'abortIfUnflattenable' option set to 'requiredOnly'  and thus flattening will not be attempted.


Overview over UncertParameters and UncertSpans

The following example provides an overview over the available fields.

import libsbml
model_dict = {
    'mid': 'parameters_spans',
    'packages': ['distrib'],
    'parameters': [
        Parameter("p",
          uncertainties=[
              Uncertainty(
                  formula="normal(0, 1)",  # distribution
                  uncertParameters=[
                      UncertParameter(type=libsbml.DISTRIB_UNCERTTYPE_COEFFIENTOFVARIATION, value=1.0),
                      UncertParameter(type=libsbml.DISTRIB_UNCERTTYPE_KURTOSIS, value=2.0),
                      UncertParameter(type=libsbml.DISTRIB_UNCERTTYPE_MEAN, value=3.0),
                      UncertParameter(type=libsbml.DISTRIB_UNCERTTYPE_MEDIAN, value=4.0),
                      UncertParameter(type=libsbml.DISTRIB_UNCERTTYPE_MODE, value=5.0),
                      UncertParameter(type=libsbml.DISTRIB_UNCERTTYPE_SAMPLESIZE, value=6.0),
                      UncertParameter(type=libsbml.DISTRIB_UNCERTTYPE_SKEWNESS, value=7.0),
                      UncertParameter(type=libsbml.DISTRIB_UNCERTTYPE_STANDARDDEVIATION, value=8.0),
                      UncertParameter(type=libsbml.DISTRIB_UNCERTTYPE_STANDARDERROR, value=9.0),
                      UncertParameter(type=libsbml.DISTRIB_UNCERTTYPE_VARIANCE, value=10.0),
                      UncertSpan(type=libsbml.DISTRIB_UNCERTTYPE_CONFIDENCEINTERVAL, valueLower=1.0, valueUpper=2.0),
                      UncertSpan(type=libsbml.DISTRIB_UNCERTTYPE_CREDIBLEINTERVAL, valueLower=2.0, valueUpper=3.0),
                      UncertSpan(type=libsbml.DISTRIB_UNCERTTYPE_INTERQUARTILERANGE, valueLower=3.0, valueUpper=4.0),
                      UncertSpan(type=libsbml.DISTRIB_UNCERTTYPE_RANGE, valueLower=4.0, valueUpper=5.0),
                  ])
          ])
    ]
}

# create model and print SBML
core_model = CoreModel.from_dict(model_dict=model_dict)
print_xml(core_model.get_sbml())

# validate model
check_doc(core_model.doc, units_consistency=False);
ERROR:root:Model units should be provided for a model, i.e., set the 'model_units' field on model.
<?xml version="1.0" encoding="UTF-8"?>
<sbml xmlns="http://www.sbml.org/sbml/level3/version1/core" xmlns:comp="http://www.sbml.org/sbml/level3/version1/comp/version1" xmlns:distrib="http://www.sbml.org/sbml/level3/version1/distrib/version1" level="3" version="1" comp:required="true" distrib:required="true">
  <model metaid="meta_parameters_spans" id="parameters_spans" name="parameters_spans">
    <listOfParameters>
      <parameter id="p" constant="true">
        <distrib:listOfUncertainties>
          <distrib:uncertainty>
            <distrib:uncertParameter distrib:value="1" distrib:type="coeffientOfVariation"/>
            <distrib:uncertParameter distrib:value="2" distrib:type="kurtosis"/>
            <distrib:uncertParameter distrib:value="3" distrib:type="mean"/>
            <distrib:uncertParameter distrib:value="4" distrib:type="median"/>
            <distrib:uncertParameter distrib:value="5" distrib:type="mode"/>
            <distrib:uncertParameter distrib:value="6" distrib:type="sampleSize"/>
            <distrib:uncertParameter distrib:value="7" distrib:type="skewness"/>
            <distrib:uncertParameter distrib:value="8" distrib:type="standardDeviation"/>
            <distrib:uncertParameter distrib:value="9" distrib:type="standardError"/>
            <distrib:uncertParameter distrib:value="10" distrib:type="variance"/>
            <distrib:uncertSpan distrib:type="confidenceInterval" distrib:valueLower="1" distrib:valueUpper="2"/>
            <distrib:uncertSpan distrib:type="credibleInterval" distrib:valueLower="2" distrib:valueUpper="3"/>
            <distrib:uncertSpan distrib:type="interquartileRange" distrib:valueLower="3" distrib:valueUpper="4"/>
            <distrib:uncertSpan distrib:type="range" distrib:valueLower="4" distrib:valueUpper="5"/>
            <distrib:uncertParameter distrib:type="distribution" distrib:definitionURL="http://www.sbml.org/sbml/symbols/distrib/normal">
              <math xmlns="http://www.w3.org/1998/Math/MathML">
                <apply>
                  <csymbol encoding="text" definitionURL="http://www.sbml.org/sbml/symbols/distrib/normal"> normal </csymbol>
                  <cn type="integer"> 0 </cn>
                  <cn type="integer"> 1 </cn>
                </apply>
              </math>
            </distrib:uncertParameter>
          </distrib:uncertainty>
        </distrib:listOfUncertainties>
      </parameter>
    </listOfParameters>
  </model>
</sbml>
WARNING:root:
--------------------------------------------------------------------------------
<SBMLDocument>
valid                    : TRUE
validation error(s)      : 0
validation warnings(s)   : 3
check time (s)           : 0.002
--------------------------------------------------------------------------------

WARNING:root:E0: Modeling practice (core, L1, code)
[Warning] It's best to declare values for every parameter in a model
As a principle of best modeling practice, the <parameter> should set an initial value rather than be left undefined. Doing so improves the portability of models between different simulation and analysis systems, and helps make it easier to detect potential errors in models.
 The <parameter> with the id 'p' does not have 'value' attribute, nor is its initial value set by an <initialAssignment> or <assignmentRule>.

WARNING:root: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.

WARNING:root:E2: SBML component consistency (comp, L1, code)
[Warning] Flattening not implemented for required package.
The CompFlatteningConverter has encountered a required package for which the necessary routines to allow flattening have not yet been implemented.
 The CompFlatteningConverter has the 'abortIfUnflattenable' option set to 'requiredOnly'  and thus flattening will not be attempted.