parmed.unit.BaseUnit

class parmed.unit.BaseUnit(base_dim, name, symbol)[source]

Physical unit expressed in exactly one BaseDimension.

For example, meter_base_unit could be a BaseUnit for the length dimension. The BaseUnit class is used internally in the more general Unit class.

Methods

conversion_factor_to(other)

Returns a conversion factor from this BaseUnit to another BaseUnit.

define_conversion_factor_to(other, factor)

Defines a conversion factor between two BaseUnits.

get_dimension_tuple()

Returns a sorted tuple of (BaseDimension, exponent) pairs, that can be used as a dictionary key.

iter_base_dimensions()

Returns a dictionary of BaseDimension:exponent pairs, describing the dimension of this unit.

iter_base_units

__init__(base_dim, name, symbol)[source]

Creates a new BaseUnit.

Parameters
  • self: The newly created BaseUnit.

  • base_dim: (BaseDimension) The dimension of the new unit, e.g. ‘mass’

  • name: (string) Name of the unit, e.g. “kilogram”

  • symbol: (string) Symbol for the unit, e.g. ‘kg’. This symbol will appear in

    Quantity string descriptions.

Methods

__init__(base_dim, name, symbol)

Creates a new BaseUnit.

conversion_factor_to(other)

Returns a conversion factor from this BaseUnit to another BaseUnit.

define_conversion_factor_to(other, factor)

Defines a conversion factor between two BaseUnits.

get_dimension_tuple()

Returns a sorted tuple of (BaseDimension, exponent) pairs, that can be used as a dictionary key.

iter_base_dimensions()

Returns a dictionary of BaseDimension:exponent pairs, describing the dimension of this unit.

iter_base_units()