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.

get_id() str[source]#

Internal usage to get IDs from objects without ID attribute

get_name() str[source]#

Returns the appropriate name of the unit

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.

field units: List[BaseUnit] [Optional]#

List of SI baseunits.

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

validator check_meta_id  »  meta_id[source]#

Checks if the meta ID provided is following the standard

getFootprint()[source]#
getId()[source]#

Deprecated since version Use: the attribute id instead.

getMetaid()[source]#

Deprecated since version Use: the attribute meta_id instead.

getName()[source]#

Deprecated since version Use: the attribute name instead.

getOntology()[source]#

Deprecated since version Use: the attribute ontology instead.

getUnits()[source]#

Deprecated since version Use: the attribute units instead.

validator set_meta_id  »  id[source]#

Sets the meta ID when an ID is provided