scipp.Unit#
- class scipp.Unit#
A physical unit.
- __init__(self: scipp._scipp.core.Unit, arg0: str) None #
Methods
__init__
(self, arg0)from_dict
(self)Deserialize a unit from a dict.
to_dict
(self)Serialize a unit to a dict.
Attributes
A read-only string describing the type of unit.
- from_dict(self: dict[str, int | float | bool | dict[str, float]]) scipp._scipp.core.Unit #
Deserialize a unit from a dict.
This function is meant to be used in combination with
scipp.Unit.to_dict()
.
- property name#
A read-only string describing the type of unit.
- to_dict(self: scipp._scipp.core.Unit) dict[str, int | float | bool | dict[str, float]] #
Serialize a unit to a dict.
This function is meant to be used with
scipp.Unit.from_dict()
to serialize units.Warning
The structure of the returned dict is an implementation detail and may change without warning at any time! It should not be used to access the internal representation of
Unit
.