UnitPrefix#
- class astropy.units.UnitPrefix(symbols: tuple[str, ...], names: tuple[str, ...], factor: UnitScale)[source]#
Bases:
NamedTuple
Prefix for representing multiples or sub-multiples of units.
- Parameters:
- symbols
tuple
ofstr
The symbols of the prefix, to be combined with symbols of units. If multiple are specified then they will be treated as aliases.
- names
tuple
ofstr
The names of the prefix, to be combined with names of units. If multiple are specified then they will be treated as aliases.
- factor
UnitScale
The multiplicative factor represented by the prefix.
- symbols
Examples
>>> UnitPrefix(("k",), ("kilo",), 1e3) # Simple prefix UnitPrefix(symbols=('k',), names=('kilo',), factor=1000.0) >>> UnitPrefix(("da",), ("deca", "deka"), 1e1) # Multiple names UnitPrefix(symbols=('da',), names=('deca', 'deka'), factor=10.0) >>> UnitPrefix(("u", "µ"), ("micro",), 1e-6) # Multiple symbols UnitPrefix(symbols=('u', 'µ'), names=('micro',), factor=1e-06)
Create new instance of UnitPrefix(symbols, names, factor)
Attributes Summary
The multiplicative factor represented by the prefix.
The names of the prefix, to be combined with names of units.
The symbols of the prefix, to be combined with symbols of units.
Attributes Documentation
- factor: UnitScale#
The multiplicative factor represented by the prefix.