yt.units.unit_systems module

Unit system class.

class yt.units.unit_systems.UnitSystem(name, length_unit, mass_unit, time_unit, temperature_unit='K', angle_unit='rad', current_mks_unit=None, registry=None)[source]

Bases: object

Create a UnitSystem for facilitating conversions to a default set of units.

Parameters:
  • name (string) – The name of the unit system. Will be used as the key in the unit_system_registry dict to reference the unit system by.
  • length_unit (string) – The base length unit of this unit system.
  • mass_unit (string) – The base mass unit of this unit system.
  • time_unit (string) – The base time unit of this unit system.
  • temperature_unit (string, optional) – The base temperature unit of this unit system. Defaults to “K”.
  • angle_unit (string, optional) – The base angle unit of this unit system. Defaults to “rad”.
  • curent_mks_unit (string, optional) – The base current unit of this unit system. Only used in MKS or MKS-based unit systems.
  • registry (yt.units.unit_registry.UnitRegistry object) – The unit registry associated with this unit system. Only useful for defining unit systems based on code units.
class yt.units.unit_systems.UnitSystemConstants(name)[source]

Bases: object

A class to faciliate conversions of physical constants into a given unit system specified by name.

yt.units.unit_systems.create_code_unit_system(unit_registry, current_mks_unit=None)[source]