Bases: object
A Quantity represents a number with some associated unit.
Parameters : | value : number, Quantity object, or sequence of Quantity objects. unit : UnitBase instance, str
|
---|---|
Raises : | TypeError :
TypeError :
|
Attributes Summary
cgs | Returns a copy of the current Quantity instance with CGS units. |
isscalar | True if the value of this quantity is a scalar, or False if it is an array-like object. |
si | Returns a copy of the current Quantity instance with SI units. |
unit | A UnitBase object representing the unit of this quantity. |
value | The numerical value of this quantity. |
Methods Summary
copy() | Return a copy of this Quantity instance |
decompose([bases]) | Generates a new Quantity with the units decomposed. |
to(unit[, equivalencies]) | Returns a new Quantity object with the specified units. |
Attributes Documentation
Returns a copy of the current Quantity instance with CGS units. The value of the resulting object will be scaled.
True if the value of this quantity is a scalar, or False if it is an array-like object.
Note
This is subtly different from numpy.isscalar in that numpy.isscalar returns False for a zero-dimensional array (e.g. np.array(1)), while this is True in that case.
Returns a copy of the current Quantity instance with SI units. The value of the resulting object will be scaled.
Methods Documentation
Return a copy of this Quantity instance
Generates a new Quantity with the units decomposed. Decomposed units have only irreducible units in them (see astropy.units.UnitBase.decompose).
Parameters : | bases : sequence of UnitBase, optional
|
---|---|
Returns : | newq : Quantity
|
Returns a new Quantity object with the specified units.
Parameters : | unit : UnitBase instance, str
equivalencies : list of equivalence pairs, optional
|
---|