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
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
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"
def test_unit_def2() -> None: unit = Unit("dimensionless", [(UNIT_KIND_DIMENSIONLESS, 1.0)]) unit_def = unit.create_sbml(model) assert formating.unitDefinitionToString(unit_def) == ""
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)"
def derived_units(item): if item: return formating.formula_to_mathml( formating.unitDefinitionToString(item.getDerivedUnitDefinition())) return ""