527: Added [concentration] quantity, with molar units. Closes #526. r=hgrecco
In addition I modified a test that had defined molar units locally, and added tags files to the .gitignore.

I think I ran all the tests but I wasn't quite sure how they were run, so it's possible I missed some, but in that case your CI should catch them. Additionally, I was unsure if the [concentration] def in line 76 will function properly, as [volume] is defined later in that file, but it didn't seem to cause any issues when I played with it. 

Happy to make any necessary changes, of course.
This commit is contained in:
bors[bot] 2017-06-09 02:46:21 +00:00
commit 562e433a44
3 changed files with 8 additions and 2 deletions

3
.gitignore vendored
View File

@ -12,3 +12,6 @@ MANIFEST
# WebDAV file system cache files
.DAV/
# tags files (from ctags)
tags

View File

@ -72,6 +72,10 @@ cmil = 5.067075e-10 * m ** 2 = circular_mils
darcy = 9.869233e-13 * m ** 2
hectare = 100 * are = ha
# Concentration
[concentration] = [substance] / [volume]
molar = mol / (1e-3 * m ** 3) = M
# EM
esu = 1 * erg**0.5 * centimeter**0.5 = statcoulombs = statC = franklin = Fr
esu_per_second = 1 * esu / second = statampere

View File

@ -39,7 +39,6 @@ class TestIssues(QuantityTestCase):
def test_issue29(self):
ureg = UnitRegistry()
ureg.define('molar = mole / liter = M')
t = 4 * ureg('mM')
self.assertEqual(t.magnitude, 4)
self.assertEqual(t._units, UnitsContainer(millimolar=1))
@ -561,4 +560,4 @@ class TestIssuesNP(QuantityTestCase):
a = np.asarray([1, 2, 3])
q = [1, 2, 3] * ureg.dimensionless
p = (q ** q).m
np.testing.assert_array_equal(p, a ** a)
np.testing.assert_array_equal(p, a ** a)