Unit Definition#
- pydantic model pyenzyme.enzymeml.core.unitdef.BaseUnit[source]#
Bases:
EnzymeMLBase
Base unit description including kind, exponent, scale and multiplier
Show JSON schema
{ "title": "BaseUnit", "description": "Base unit description including kind, exponent, scale and multiplier", "type": "object", "properties": { "kind": { "title": "Kind", "description": "Unit kind used to write SBML.", "type": "string" }, "exponent": { "title": "Exponent", "description": "Unit exponent.", "type": "number" }, "scale": { "title": "Scale", "description": "Unit scale.", "type": "integer" }, "multiplier": { "title": "Multiplier", "description": "Unit multiplier.", "type": "number" } }, "required": [ "kind", "exponent", "scale", "multiplier" ] }
- Config
validate_all: bool = True
validate_assignment: bool = True
- Fields
- field exponent: float [Required]#
Unit exponent.
- field kind: str [Required]#
Unit kind used to write SBML.
- field multiplier: float [Required]#
Unit multiplier.
- field scale: int [Required]#
Unit scale.
- pydantic model pyenzyme.enzymeml.core.unitdef.UnitDef[source]#
Bases:
EnzymeMLBase
Show JSON schema
{ "title": "UnitDef", "type": "object", "properties": { "name": { "title": "Name", "description": "Name of the SI unit.", "type": "string" }, "id": { "title": "Id", "description": "Interal Identifier of the SI unit.", "type": "string" }, "meta_id": { "title": "Meta Id", "description": "Interal meta identifier of the SI unit.", "type": "string" }, "units": { "title": "Units", "description": "List of SI baseunits.", "type": "array", "items": { "$ref": "#/definitions/BaseUnit" } }, "ontology": { "title": "Ontology", "description": "Ontology of the SI unit.", "type": "string" } }, "definitions": { "BaseUnit": { "title": "BaseUnit", "description": "Base unit description including kind, exponent, scale and multiplier", "type": "object", "properties": { "kind": { "title": "Kind", "description": "Unit kind used to write SBML.", "type": "string" }, "exponent": { "title": "Exponent", "description": "Unit exponent.", "type": "number" }, "scale": { "title": "Scale", "description": "Unit scale.", "type": "integer" }, "multiplier": { "title": "Multiplier", "description": "Unit multiplier.", "type": "number" } }, "required": [ "kind", "exponent", "scale", "multiplier" ] } } }
- Config
validate_all: bool = True
validate_assignment: bool = True
- Fields
- Validators
- field id: Optional[str] = None#
Interal Identifier of the SI unit.
- Validated by
- field meta_id: Optional[str] = None#
Interal meta identifier of the SI unit.
- Validated by
- field name: Optional[str] = None#
Name of the SI unit.
- field ontology: Optional[str] = None#
Ontology of the SI unit.
- addBaseUnit(kind: str, exponent: float, scale: int, multiplier: float) None [source]#
Adds a base unit to the units element and sort the units.
- Parameters
kind (str) – SBML unit kind string.
exponent (float) – Exponent of the unit.
scale (float) – Scale of the unit.
multiplier (float) – Muliplier of the unit.
- calculateTransformValue(kind: str, scale: int)[source]#
Calculates the value that is needed to re-scale the given unit to the desired scale.
- Parameters
kind (str) – The kind of unit that is used as a reference.
scale (int) – The desired scale.
- Raises
ValueError – Raised when the given unit kind is not part of the unitdef.
- Returns
The value that is needed to re-scale the given unit to the desired scale.
- Return type
float