Commit ba1af1ee authored by Jason Swails's avatar Jason Swails
Browse files

Delete now out-of-date docs as well as adding __array_priority__ to Quantity.

This should be *lower* than that of Unit (and ScaledUnit/BaseUnit), since we
still want Units to take priority over Quantities (but Quantity to take
precedence over regular ndarrays) for reasons like this:

>>> a = np.array([1]) * u.angstroms
>>> b = a * u.angstroms # should be np.array([1])*u.angstroms**2
>>> np.arange(10) * a # utilize broadcasting
[1 2 3 4 5 6 7 8 9 10] A**2
parent 83255aa8
......@@ -2712,10 +2712,6 @@ multiply operator (‘*’) or the explicit Quantity constructor:
# or more verbosely
bond_length = Quantity(value=1.53, unit=nanometer)
When working with Numpy arrays you *must* use the explicit constructor. You cannot
multiply them by a unit, because the Numpy array class overloads the multiply operator.
Arithmetic with units
---------------------
......
......@@ -92,6 +92,7 @@ class Quantity(object):
4 - lists of tuples of numbers, lists of lists of ... etc. of numbers
5 - numpy.arrays
"""
__array_priority__ = 99
def __init__(self, value=None, unit=None):
"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment