* Top level Python module is now "openmm"
* Updated module names in examples
* Updated module names in documentation
* Updated module in CI scripts
* Added deprecation warning
* Updated to latest values for physical constants
* Updated documentation on physical constants
* Updated Python unit definitions
* Fixed constants in test case
* Added a comment
From @peastman:
> Test cases are failing. I believe it's because the parent for a ScaledUnit needs to be a Unit, not another ScaledUnit. So in the line
>
> ```
> hartree_base_unit = ScaledUnit(4.3597447222071e-18, joule_base_unit, "hartree", "Ha")
> ```
>
> replace joule_base_unit with joule.
Swigged python docstrings now include documented return values and type
information or their arguments. They are generated in numpydoc format.
Furthermore, all of the Python app layer docstrings have been changed
to numpydoc format. The filterPythonFiles.py script which helps to
generate the Doxygen Python API docs has been updated to reflect these
changes.
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
The main thing that's done here is that numpy arrays can be given units via the
* operator, rather than relying on the Quantity constructor
e.g.,
>>> import numpy as np
>>> np.zeros(10) * u.angstroms
Quantity(value=array([ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]), unit=angstrom)
yay!
Traceback (most recent call last):
File ".../python/tests/TestNumpyCompatibility.py", line 87, in testNumpyAttributes
d = self.data.reshape((100, 3))
File ".../simtk/unit/quantity.py", line 575, in reshape
return Quantity(self._value.reshape(shape, order=order))
File ".../simtk/unit/quantity.py", line 142, in __init__
if value == first_item:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Also add a test for new unit numpy capabilities.
underlying numpy array. This function would be used in instances where, for
instance, a certain API would send a flattened array of coordinates or
velocities with units attached, and you wanted to reshape the array into
(natom, 3) to be consistent with OpenMM's Context object.
arguments and pass them to the numpy function if applicable. That way, users get
the full flexibility of the numpy API on those particular methods AND get the
added benefit that the result has the correct units (and it all runs fast).
it. Not only that, I got this FutureWarning:
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/simtk/unit/quantity.py:170:
FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.
if value == None:
sqrt of the variance), and average, returning a Quantity with the proper units.
This should be reasonably efficient, as it takes advantage of numpy-accelerated
methods if they're present.