CompositeUnit#
- class astropy.units.CompositeUnit(scale, bases, powers, decompose=False, decompose_bases={}, _error_check=True)[source]#
 Bases:
UnitBaseCreate a composite unit using expressions of previously defined units.
Direct use of this class is not recommended. Instead use the factory function
Unitand arithmetic operators to compose units.- Parameters:
 - Raises:
 UnitScaleErrorIf the scale is zero.
Attributes Summary
The bases of the composite unit.
The powers of the bases of the composite unit.
The scale of the composite unit.
Methods Summary
decompose([bases])Return a unit object composed of only irreducible units.
is_unity()Check whether the unit is unscaled and dimensionless.
Attributes Documentation
- bases#
 The bases of the composite unit.
- powers#
 The powers of the bases of the composite unit.
- scale#
 The scale of the composite unit.
Methods Documentation
- decompose(bases={})[source]#
 Return a unit object composed of only irreducible units.
- Parameters:
 - basespython:sequence of 
UnitBase, optional The bases to decompose into. When not provided, decomposes down to any irreducible units. When provided, the decomposed result will only contain the given units. This will raises a
UnitsErrorif it’s not possible to do so.
- basespython:sequence of 
 - Returns:
 - unit
CompositeUnit New object containing only irreducible unit objects.
- unit