[yt-svn] commit/yt: 2 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Mon Sep 21 11:34:23 PDT 2015
2 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/f5e1c50cc87d/
Changeset: f5e1c50cc87d
Branch: yt
User: ngoldbaum
Date: 2015-09-15 18:47:56+00:00
Summary: Replace '_' in default latex labels with '\ '
Affected #: 2 files
diff -r 4979406431c662b038db914287ae227092199b78 -r f5e1c50cc87d0573d77df1fa3afffbf9fa726229 yt/units/tests/test_units.py
--- a/yt/units/tests/test_units.py
+++ b/yt/units/tests/test_units.py
@@ -454,7 +454,7 @@
assert_raises(InvalidUnitOperation, operator.mul, u1, u2)
assert_raises(InvalidUnitOperation, operator.truediv, u1, u2)
-def test_comoving_labels():
+def test_comoving_and_code_unit_labels():
ds = fake_random_ds(64, nprocs=1)
# create a fake comoving unit
@@ -464,3 +464,10 @@
test_unit = Unit('Mpccm', registry=ds.unit_registry)
assert_almost_equal(test_unit.base_value, cm_per_mpc/3)
assert_equal(test_unit.latex_repr, r'\rm{Mpc}/(1+z)')
+
+ test_unit = Unit('code_mass', registry=ds.unit_registry)
+ assert_equal(test_unit.latex_repr, '\\rm{code\\ mass}')
+
+ test_unit = Unit('code_mass/code_length**3', registry=ds.unit_registry)
+ assert_equal(test_unit.latex_repr,
+ '\\frac{\\rm{code\\ mass}}{\\rm{code\\ length}^{3}}')
diff -r 4979406431c662b038db914287ae227092199b78 -r f5e1c50cc87d0573d77df1fa3afffbf9fa726229 yt/units/unit_registry.py
--- a/yt/units/unit_registry.py
+++ b/yt/units/unit_registry.py
@@ -63,7 +63,7 @@
if tex_repr is None:
# make educated guess that will look nice in most cases
- tex_repr = r"\rm{" + symbol + "}"
+ tex_repr = r"\rm{" + symbol.replace('_', '\ ') + "}"
# Add to lut
self.lut.update({symbol: (base_value, dimensions, offset, tex_repr)})
https://bitbucket.org/yt_analysis/yt/commits/9acfe15f8b6a/
Changeset: 9acfe15f8b6a
Branch: yt
User: chummels
Date: 2015-09-21 18:34:13+00:00
Summary: Merged in ngoldbaum/yt (pull request #1753)
[bugfix] fix code unit labels
Affected #: 2 files
diff -r 9b76efa712c65a3118ef2c6fb8e97defae53fc7e -r 9acfe15f8b6a998c7817e34706571437ff0eb8dc yt/units/tests/test_units.py
--- a/yt/units/tests/test_units.py
+++ b/yt/units/tests/test_units.py
@@ -454,7 +454,7 @@
assert_raises(InvalidUnitOperation, operator.mul, u1, u2)
assert_raises(InvalidUnitOperation, operator.truediv, u1, u2)
-def test_comoving_labels():
+def test_comoving_and_code_unit_labels():
ds = fake_random_ds(64, nprocs=1)
# create a fake comoving unit
@@ -464,3 +464,10 @@
test_unit = Unit('Mpccm', registry=ds.unit_registry)
assert_almost_equal(test_unit.base_value, cm_per_mpc/3)
assert_equal(test_unit.latex_repr, r'\rm{Mpc}/(1+z)')
+
+ test_unit = Unit('code_mass', registry=ds.unit_registry)
+ assert_equal(test_unit.latex_repr, '\\rm{code\\ mass}')
+
+ test_unit = Unit('code_mass/code_length**3', registry=ds.unit_registry)
+ assert_equal(test_unit.latex_repr,
+ '\\frac{\\rm{code\\ mass}}{\\rm{code\\ length}^{3}}')
diff -r 9b76efa712c65a3118ef2c6fb8e97defae53fc7e -r 9acfe15f8b6a998c7817e34706571437ff0eb8dc yt/units/unit_registry.py
--- a/yt/units/unit_registry.py
+++ b/yt/units/unit_registry.py
@@ -63,7 +63,7 @@
if tex_repr is None:
# make educated guess that will look nice in most cases
- tex_repr = r"\rm{" + symbol + "}"
+ tex_repr = r"\rm{" + symbol.replace('_', '\ ') + "}"
# Add to lut
self.lut.update({symbol: (base_value, dimensions, offset, tex_repr)})
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list