[yt-svn] commit/yt: ngoldbaum: Merged in brittonsmith/yt (pull request #2373)

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Sat Sep 24 14:54:13 PDT 2016


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/5a08f4cc1af1/
Changeset:   5a08f4cc1af1
Branch:      yt
User:        ngoldbaum
Date:        2016-09-24 21:53:47+00:00
Summary:     Merged in brittonsmith/yt (pull request #2373)

[bugfix] Do not take absolute value of redshift for plot modification.
Affected #:  1 file

diff -r 6d05ffb05f3fbe2295f0fcce5db0b82837b03401 -r 5a08f4cc1af1a18889e0dc93cb3afa908f2d3d2f yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -19,6 +19,7 @@
 
 import matplotlib
 import numpy as np
+import re
 
 from distutils.version import LooseVersion
 from functools import wraps
@@ -1953,11 +1954,14 @@
         # If we're annotating the redshift, put it in the correct format
         if self.redshift:
             try:
-                z = np.abs(plot.data.ds.current_redshift)
+                z = plot.data.ds.current_redshift
             except AttributeError:
                 raise AttributeError("Dataset does not have current_redshift. "
                                      "Set redshift=False.")
+            # Replace instances of -0.0* with 0.0* to avoid
+            # negative null redshifts (e.g., "-0.00").
             self.text += self.redshift_format.format(redshift=float(z))
+            self.text = re.sub('-(0.0*)$', "\g<1>", self.text)
 
         # This is just a fancy wrapper around the TextLabelCallback
         tcb = TextLabelCallback(self.pos, self.text,

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