Bases: astropy.units.core.UnitBase
Create a composite unit using expressions of previously defined units.
Direct use of this class is not recommended. Instead use the factory function Unit(...) and arithmetic operators to compose units.
Parameters : | scale : number
bases : sequence of UnitBase
powers : sequence of numbers
|
---|
Attributes Summary
bases | Return the bases of the composite unit. |
scale | Return the scale of the composite unit. |
powers | Return the powers of the composite unit. |
Methods Summary
is_dimensionless() | Returns True if this unit translates into a scalar quantity without a unit. |
simplify() | Compresses a possibly composite unit down to a single instance. |
dimensionless_constant() | If this unit is dimensionless, return its scalar quantity. |
decompose() | Return a unit object composed of only irreducible units. |
Attributes Documentation
Methods Documentation
Returns True if this unit translates into a scalar quantity without a unit.
Examples
>>> ((2 * u.m) / (3 * u.m)).is_dimensionless()
True
>>> (2 * u.m).is_dimensionless()
False
Compresses a possibly composite unit down to a single instance.
If this unit is dimensionless, return its scalar quantity.
Direct use of this method is not recommended. It is generally better to use the to or get_converter methods instead.
Return a unit object composed of only irreducible units.
Parameters : | None : |
---|---|
Returns : | unit : CompositeUnit object
|