yt.units.unit_registry module

A registry for units that can be added to and modified.

exception yt.units.unit_registry.SymbolNotFoundError[source]

Bases: Exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception yt.units.unit_registry.UnitParseError[source]

Bases: Exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class yt.units.unit_registry.UnitRegistry(add_default_symbols=True, lut=None)[source]

Bases: object

A registry for unit symbols

add(symbol, base_value, dimensions, tex_repr=None, offset=None)[source]

Add a symbol to this registry.

classmethod from_json(json_text)[source]

Returns a UnitRegistry object from a json-serialized unit registry

keys()[source]

Print out the units contained in the lookup table.

modify(symbol, base_value)[source]

Change the base value of a unit symbol. Useful for adjusting code units after parsing parameters.

remove(symbol)[source]

Remove the entry for the unit matching symbol.

to_json()[source]

Returns a json-serialized version of the unit registry

unit_system_id

This is a unique identifier for the unit registry created from a FNV hash. It is needed to register a dataset’s code unit system in the unit system registry.

yt.units.unit_registry.positive_symbol_replacer(match)[source]