WrightTools.units module

Unit and label handling in WrightTools.

class WrightTools.units.SymbolDict[source]

Bases: dict

Subclass dictionary to get at __missing__ method.

WrightTools.units.converter(val, current_unit, destination_unit)[source]

Convert from one unit to another.

Parameters:
  • val (number) – Number to convert.
  • current_unit (string) – Current unit.
  • destination_unit (string) – Destination unit.
Returns:

Converted value.

Return type:

number

WrightTools.units.get_default_symbol_type(units_str)[source]

Get default symbol type.

Parameters:units_str (string) – Units.
Returns:Symbol dictionary name.
Return type:string
WrightTools.units.kind(units)[source]

Find the kind of given units.

Parameters:units (string) – The units of interest
Returns:The kind of the given units. If no match is found, returns None.
Return type:string