Skip to content

cellmlunits

Conversion of SBML units to CellML units.

Every unit definition of an SBML model becomes CellML units of the same name. An SBML unit stands for (multiplier * 10^scale * kind)^exponent, a CellML unit for multiplier * (10^prefix * reference)^exponent: the scale becomes the prefix, together with a multiplier which is a power of ten, and any other multiplier its power multiplier^exponent. The unit kinds of SBML are the standard units of CellML, except for item, which becomes new base units (units without a unit), and avogadro, which becomes the dimensionless units of that number.

CellMLUnits also finds the units of the elements which become variables. A compartment, a parameter and a species with only substance units reference their units (a unit definition, a unit kind or the units of the model), a species in concentration has the units of its substance per the units of its compartment and the rate of a reaction the units of the extent per the units of time. For such a quotient the unit definition of the model which is identical to it is used, else units numerator_per_denominator are added.

CellMLUnits

CellMLUnits(model_sbml, model)

The CellML units of an SBML model.

Convert the unit definitions of the SBML model.

Parameters:

Name Type Description Default
model_sbml Model

the SBML model.

required
model Model

the CellML model, which the units are added to.

required

is_annotated property

is_annotated

Whether the SBML model says anything about units.

The units which level 1 and 2 have built in do not count: a model without any unit of its own is not an incomplete annotation.

name

name(reference)

CellML units of an SBML unit reference.

Parameters:

Name Type Description Default
reference str

the id of a unit definition, the name of a unit kind or units which the SBML level has built in (substance).

required

Returns:

Type Description
str | None

The name of the CellML units, None for an unknown reference.

number_units

number_units(reference)

CellML units of the units of a number in a formula.

Parameters:

Name Type Description Default
reference str

the sbml:units of the number.

required

Returns:

Type Description
str

The name of the CellML units, the reference itself when it is

str

unknown (the validation of the CellML model reports it).

per

per(numerator, denominator)

CellML units of the quotient of two SBML unit references.

Parameters:

Name Type Description Default
numerator str

SBML unit reference, e.g. the substance units.

required
denominator str

SBML unit reference, e.g. the units of a compartment.

required

Returns:

Type Description
str | None

The name of the unit definition of the model which is identical

str | None

to the quotient, else of the units

str | None

numerator_per_denominator, which are added to the CellML model;

str | None

None for an unknown reference.

time

time()

CellML units of time, None when the model does not set them.

of_compartment

of_compartment(compartment)

CellML units of the size of a compartment, None when unknown.

of_parameter

of_parameter(parameter)

CellML units of a parameter, None when it has none.

of_amount

of_amount(species)

CellML units of the amount of a species, None when unknown.

of_species

of_species(species)

CellML units of a species, None when unknown.

The units of its substance when it has only substance units or its compartment no dimensions, else the concentration substance per size of the compartment.

of_reaction

of_reaction()

CellML units of the rate of a reaction: extent per time.