Bases: numpy.ndarray
A Quantity represents a number with some associated unit.
Parameters: | value : number, Quantity object, or sequence of Quantity objects. unit : UnitBase instance, str
dtype : ~numpy.dtype, optional
copy : bool, optional
|
---|---|
Raises: | TypeError :
TypeError :
|
Attributes Summary
cgs | Returns a copy of the current Quantity instance with CGS units. |
equivalencies | A list of equivalencies that will be applied by default during unit conversions. |
flat | A 1-D iterator over the Quantity array. |
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
all([axis, out]) | |
any([axis, out]) | |
argmax([axis, out]) | |
argmin([axis, out]) | |
argsort([axis, kind, order]) | |
choose(choices[, out, mode]) | |
clip(a_min, a_max[, out]) | |
copy() | Return a copy of this Quantity instance |
cumprod([axis, dtype, out]) | |
cumsum([axis, dtype, out]) | |
decompose([bases]) | Generates a new Quantity with the units decomposed. |
diff([n, axis]) | |
dot(b[, out]) | |
dump(file) | |
dumps() | |
ediff1d([to_end, to_begin]) | |
fill(value) | |
item(*args) | |
itemset(*args) | |
list() | |
max([axis, out, keepdims]) | |
mean([axis, dtype, out]) | |
min([axis, out, keepdims]) | |
nansum([axis]) | |
prod([axis, dtype, out, keepdims]) | |
ptp([axis, out]) | |
put(indices, values[, mode]) | |
searchsorted(v, *args, **kwargs) | |
std([axis, dtype, out, ddof]) | |
sum([axis, dtype, out, keepdims]) | |
to(unit[, equivalencies]) | Returns a new Quantity object with the specified units. |
tofile(fid[, sep, format]) | |
tostring([order]) | |
trace([offset, axis1, axis2, dtype, out]) | |
var([axis, dtype, out, ddof]) |
Attributes Documentation
Returns a copy of the current Quantity instance with CGS units. The value of the resulting object will be scaled.
A list of equivalencies that will be applied by default during unit conversions.
A 1-D iterator over the Quantity array.
This returns a QuantityIterator instance, which behaves the same as the flatiter instance returned by flat, and is similar to, but not a subclass of, Python’s built-in iterator object.
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
|
---|