Bases: object
A Quantity represents a number with some associated unit.
Parameters : | value : number
unit : UnitBase instance, str
|
---|---|
Raises : | TypeError :
TypeError :
|
Attributes Summary
isscalar | True if the value of this quantity is a scalar, or False if it is an array-like object. |
unit | A UnitBase object representing the unit of this quantity. |
decomposed_unit | Generates a new Quantity with the units decomposed. |
cgs | Returns a copy of the current Quantity instance with CGS units. |
value | The numerical value of this quantity. |
si | Returns a copy of the current Quantity instance with SI units. |
Methods Summary
to(unit) | Returns a new Quantity object with the specified units. |
copy() | Return a copy of this Quantity instance |
Attributes Documentation
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.
Generates a new Quantity with the units decomposed. Decomposed units have only irreducible units in them (see astropy.units.UnitBase.decompose).
Returns : | newq : Quantity
|
---|
Returns a copy of the current Quantity instance with CGS units. The value of the resulting object will be scaled.
Returns a copy of the current Quantity instance with SI units. The value of the resulting object will be scaled.
Methods Documentation
Returns a new Quantity object with the specified units.
Parameters : | unit : UnitBase instance, str
|
---|
Return a copy of this Quantity instance