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:
symbolstuple of str

The symbols of the prefix, to be combined with symbols of units. If multiple are specified then they will be treated as aliases.

namestuple of str

The names of the prefix, to be combined with names of units. If multiple are specified then they will be treated as aliases.

factorUnitScale

The multiplicative factor represented by the prefix.

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

factor

The multiplicative factor represented by the prefix.

names

The names of the prefix, to be combined with names of units.

symbols

The symbols of the prefix, to be combined with symbols of units.

Attributes Documentation

factor: UnitScale#

The multiplicative factor represented by the prefix.

names: tuple[str, ...]#

The names of the prefix, to be combined with names of units.

symbols: tuple[str, ...]#

The symbols of the prefix, to be combined with symbols of units.