示例#1
0
def listOfUnits_dict(model):
    items = []
    for item in model.getListOfUnitDefinitions():
        info = infoSbase(item)
        info["units"] = formating.formula_to_mathml(
            formating.unitDefinitionToString(item))
        items.append(info)
    return items
示例#2
0
    def info_unit_definitions(self) -> List[Dict[str, Any]]:
        """Information dictionaries for UnitDefinitions.

        :return: list of info dictionaries for UnitDefinitions
        """
        data = []
        for ud in self.model.getListOfUnitDefinitions(
        ):  # type: libsbml.UnitDefinition
            info = self.info_sbase(ud)
            info["units"] = formating.formula_to_mathml(
                formating.unitDefinitionToString(ud))
            data.append(info)
        return data
示例#3
0
def test_unit_def3() -> None:
    unit = Unit("pmol", [(UNIT_KIND_MOLE, 1.0, -12, 1.0)])
    unit_def = unit.create_sbml(model)
    assert formating.unitDefinitionToString(unit_def) == "(10^-12)*mole"
示例#4
0
def test_unit_def2() -> None:
    unit = Unit("dimensionless", [(UNIT_KIND_DIMENSIONLESS, 1.0)])
    unit_def = unit.create_sbml(model)
    assert formating.unitDefinitionToString(unit_def) == ""
示例#5
0
def test_unit_def1() -> None:
    unit = Unit("mM", [(UNIT_KIND_MOLE, 1.0), (UNIT_KIND_METRE, -3.0)])
    unit_def = unit.create_sbml(model)
    assert formating.unitDefinitionToString(unit_def) == "(mole)/(m^3)"
示例#6
0
def derived_units(item):
    if item:
        return formating.formula_to_mathml(
            formating.unitDefinitionToString(item.getDerivedUnitDefinition()))
    return ""