mpacts.core.units. definitions

Functions and classes related to unit definitions.

copyright:2016 by Pint Authors, see AUTHORS for more details.
license:BSD, see LICENSE for more details.

In order to be able to use this module import it like this:

import mpacts.core.units.definitions
#or assign it to a shorter name
import mpacts.core.units.definitions as def

Definition

class mpacts.core.units.definitions.Definition(name, symbol, aliases, converter)

Bases: object

Base class for definitions.

Parameters:
  • name – name.
  • symbol – a short name or symbol for the definition
  • aliases – iterable of other names.
  • converter – an instance of Converter.
Definition(name, parent, **kwargs)
aliases
converter
classmethod from_string(definition)

Parse a definition

has_symbol
is_multiplicative
name
symbol

DimensionDefinition

class mpacts.core.units.definitions.DimensionDefinition(name, symbol, aliases, converter, reference=None, is_base=False)

Bases: mpacts.core.units.definitions.Definition

Definition of a dimension.

DimensionDefinition(name, parent, **kwargs)

PrefixDefinition

class mpacts.core.units.definitions.PrefixDefinition(name, symbol, aliases, converter)

Bases: mpacts.core.units.definitions.Definition

Definition of a prefix.

PrefixDefinition(name, parent, **kwargs)

UnitDefinition

class mpacts.core.units.definitions.UnitDefinition(name, symbol, aliases, converter, reference=None, is_base=False)

Bases: mpacts.core.units.definitions.Definition

Definition of a unit.

Parameters:
  • reference – Units container with reference units.
  • is_base – indicates if it is a base unit.
UnitDefinition(name, parent, **kwargs)