[yt-svn] commit/yt: 2 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Fri Apr 18 16:47:58 PDT 2014
2 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/e302cebc3051/
Changeset: e302cebc3051
Branch: yt-3.0
User: ngoldbaum
Date: 2014-04-19 01:25:41
Summary: Do not override unit labels in the default latex lookup table.
Affected #: 2 files
diff -r b493d3104e7d28f63e3233c6ff425a582ee628cc -r e302cebc30519abd8bd1b14b5b0dd46c4ca03691 yt/units/unit_lookup_table.py
--- a/yt/units/unit_lookup_table.py
+++ b/yt/units/unit_lookup_table.py
@@ -94,6 +94,7 @@
# Add LaTeX representations for units with trivial representations.
latex_symbol_lut = {
"unitary" : "",
+ "dimensionless" : "",
"code_length" : "\\rm{code}\/\\rm{length}",
"code_time" : "\\rm{code}\/\\rm{time}",
"code_mass" : "\\rm{code}\/\\rm{mass}",
diff -r b493d3104e7d28f63e3233c6ff425a582ee628cc -r e302cebc30519abd8bd1b14b5b0dd46c4ca03691 yt/units/unit_registry.py
--- a/yt/units/unit_registry.py
+++ b/yt/units/unit_registry.py
@@ -49,13 +49,13 @@
if not isinstance(cgs_value, float):
raise UnitParseError("cgs_value must be a float, got a %s." \
% type(cgs_value))
-
+
validate_dimensions(dimensions)
# Add to symbol lut
- if tex_repr is None:
- latex_symbol_lut[symbol] = "\\rm{" + symbol + "}"
- else:
+ if symbol not in latex_symbol_lut:
+ if tex_repr is None:
+ tex_repr = "\\rm{" + symbol + "}"
latex_symbol_lut[symbol] = tex_repr
# Add to lut
https://bitbucket.org/yt_analysis/yt/commits/402f4475430d/
Changeset: 402f4475430d
Branch: yt-3.0
User: ngoldbaum
Date: 2014-04-19 01:46:17
Summary: Use setdefault to clean up logic. Minor pep8/style cleanups.
Affected #: 1 file
diff -r e302cebc30519abd8bd1b14b5b0dd46c4ca03691 -r 402f4475430dfd4e0689382cb8813b5c46ff78a6 yt/units/unit_registry.py
--- a/yt/units/unit_registry.py
+++ b/yt/units/unit_registry.py
@@ -47,20 +47,18 @@
# Validate
if not isinstance(cgs_value, float):
- raise UnitParseError("cgs_value must be a float, got a %s." \
+ raise UnitParseError("cgs_value must be a float, got a %s."
% type(cgs_value))
validate_dimensions(dimensions)
# Add to symbol lut
- if symbol not in latex_symbol_lut:
- if tex_repr is None:
- tex_repr = "\\rm{" + symbol + "}"
- latex_symbol_lut[symbol] = tex_repr
+ if tex_repr is None:
+ tex_repr = "\\rm{" + symbol + "}"
+ latex_symbol_lut.setdefault(symbol, tex_repr)
# Add to lut
- if tex_repr is None: tex_repr = symbol
- self.lut.update( {symbol: (cgs_value, dimensions)} )
+ self.lut.update({symbol: (cgs_value, dimensions)})
def remove(self, symbol):
"""
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