mpacts.core.units. converters

Functions and classes related to unit conversions.

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

Converter

class mpacts.core.units.converters.Converter

Bases: object

Base class for value converters.

Converter(name, parent, **kwargs)
from_reference(value, inplace=False)
is_multiplicative = True
to_reference(value, inplace=False)

OffsetConverter

class mpacts.core.units.converters.OffsetConverter(scale, offset)

Bases: mpacts.core.units.converters.Converter

An affine transformation

OffsetConverter(name, parent, **kwargs)
from_reference(value, inplace=False)
is_multiplicative
to_reference(value, inplace=False)

ScaleConverter

class mpacts.core.units.converters.ScaleConverter(scale)

Bases: mpacts.core.units.converters.Converter

A linear transformation

ScaleConverter(name, parent, **kwargs)
from_reference(value, inplace=False)
is_multiplicative = True
to_reference(value, inplace=False)