mpacts.core.units. registry

Defines the Registry, a class to contain units and their relations.

The module actually defines 5 registries with different capabilites:

  • BaseRegistry: Basic unit definition and querying.

    Conversion between multiplicative units.

  • NonMultiplicativeRegistry: Conversion between non multiplicative (offset) units.

    (e.g. Temperature)

    • Inherits from BaseRegistry
  • ContextRegisty: Conversion between units with different dimenstions according

    to previously established relations (contexts). (e.g. in the spectroscopy, conversion between frequency and energy is possible)

    • Inherits from BaseRegistry
  • SystemRegistry: Group unit and changing of base units.

    (e.g. in MKS, meter, kilogram and second are base units.)

    • Inherits from BaseRegistry
  • UnitRegistry: Combine all previous capabilities, it is exposed by Pint.

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.registry
#or assign it to a shorter name
import mpacts.core.units.registry as reg


class mpacts.core.units.registry.LazyRegistry(args=None, kwargs=None)

Bases: object

LazyRegistry(name, parent, **kwargs)


class mpacts.core.units.registry._Meta

Bases: type

This is just to call after_init at the right time instead of asking the developer to do it when subclassing.

_Meta(name, parent, **kwargs)