[yt-svn] commit/yt: 4 new changesets

Bitbucket commits-noreply at bitbucket.org
Mon Sep 10 08:23:51 PDT 2012


4 new commits in yt:


https://bitbucket.org/yt_analysis/yt/changeset/c90637c3128c/
changeset:   c90637c3128c
branch:      yt
user:        ngoldbaum
date:        2012-09-07 21:00:01
summary:     Adding a callback that annotates a plot with the current time.
affected #:  1 file

diff -r 551e1238ab38bfd9f1951e6a3fe692cc995e5768 -r c90637c3128c0d5b6e4c846b3d5f601f5829074a yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -456,6 +456,27 @@
         plot._axes.set_xlabel(self.label)
         plot._axes.set_ylabel(self.label)
 
+class TimeCallback(PlotCallback):
+    _type_name = "time"
+    def __init__(self):
+        """
+        This annotates the plot with the current simulation time.
+        For now, the time is displayed in seconds.
+        """
+        PlotCallback.__init__(self)
+    
+    def __call__(self, plot):
+        current_time = plot.pf.current_time/plot.pf['Time']
+        timestring = format(current_time,'10.7e')
+        base = timestring[:timestring.find('e')]
+        exponent = timestring[timestring.find('e')+1:]
+        if exponent[0] == '+':
+            exponent = exponent[1:]
+        timestring = r'$t\/=\/'+base+''+r'\times\,10^{'+exponent+r'}\, \rm{s}$'
+        from mpl_toolkits.axes_grid1.anchored_artists import AnchoredText
+        at = AnchoredText(timestring, prop=dict(size=12), frameon=True, loc=4)
+        plot._axes.add_artist(at)
+
 def get_smallest_appropriate_unit(v, pf):
     max_nu = 1e30
     good_u = None



https://bitbucket.org/yt_analysis/yt/changeset/60555858b71a/
changeset:   60555858b71a
branch:      yt
user:        ngoldbaum
date:        2012-09-07 21:05:06
summary:     Passing in the format code as a kwarg.
affected #:  1 file

diff -r c90637c3128c0d5b6e4c846b3d5f601f5829074a -r 60555858b71a86a118fe6a31fadfcd8cc776e87b yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -458,16 +458,18 @@
 
 class TimeCallback(PlotCallback):
     _type_name = "time"
-    def __init__(self):
+    def __init__(self, format_code='10.7e'):
         """
         This annotates the plot with the current simulation time.
         For now, the time is displayed in seconds.
+        *format_code* can be optionally set, allowing a custom 
+        c-style format code for the time display.
         """
         PlotCallback.__init__(self)
     
     def __call__(self, plot):
         current_time = plot.pf.current_time/plot.pf['Time']
-        timestring = format(current_time,'10.7e')
+        timestring = format(current_time,format_code)
         base = timestring[:timestring.find('e')]
         exponent = timestring[timestring.find('e')+1:]
         if exponent[0] == '+':



https://bitbucket.org/yt_analysis/yt/changeset/821990647710/
changeset:   821990647710
branch:      yt
user:        ngoldbaum
date:        2012-09-07 21:15:03
summary:     Properly handling format_code.
affected #:  1 file

diff -r 60555858b71a86a118fe6a31fadfcd8cc776e87b -r 82199064771081fe61b58de835e150916e692860 yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -465,11 +465,12 @@
         *format_code* can be optionally set, allowing a custom 
         c-style format code for the time display.
         """
+        self.format_code = format_code
         PlotCallback.__init__(self)
     
     def __call__(self, plot):
         current_time = plot.pf.current_time/plot.pf['Time']
-        timestring = format(current_time,format_code)
+        timestring = format(current_time,self.format_code)
         base = timestring[:timestring.find('e')]
         exponent = timestring[timestring.find('e')+1:]
         if exponent[0] == '+':



https://bitbucket.org/yt_analysis/yt/changeset/5b0682498d83/
changeset:   5b0682498d83
branch:      yt
user:        MatthewTurk
date:        2012-09-10 17:23:49
summary:     Merged in ngoldbaum/yt-cleancopy (pull request #268)
affected #:  1 file

diff -r 5e78fb4e3812e186e208866d9b7300a244eb6ee5 -r 5b0682498d834a77ec3779928f7d2d2611554c7f yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -456,6 +456,30 @@
         plot._axes.set_xlabel(self.label)
         plot._axes.set_ylabel(self.label)
 
+class TimeCallback(PlotCallback):
+    _type_name = "time"
+    def __init__(self, format_code='10.7e'):
+        """
+        This annotates the plot with the current simulation time.
+        For now, the time is displayed in seconds.
+        *format_code* can be optionally set, allowing a custom 
+        c-style format code for the time display.
+        """
+        self.format_code = format_code
+        PlotCallback.__init__(self)
+    
+    def __call__(self, plot):
+        current_time = plot.pf.current_time/plot.pf['Time']
+        timestring = format(current_time,self.format_code)
+        base = timestring[:timestring.find('e')]
+        exponent = timestring[timestring.find('e')+1:]
+        if exponent[0] == '+':
+            exponent = exponent[1:]
+        timestring = r'$t\/=\/'+base+''+r'\times\,10^{'+exponent+r'}\, \rm{s}$'
+        from mpl_toolkits.axes_grid1.anchored_artists import AnchoredText
+        at = AnchoredText(timestring, prop=dict(size=12), frameon=True, loc=4)
+        plot._axes.add_artist(at)
+
 def get_smallest_appropriate_unit(v, pf):
     max_nu = 1e30
     good_u = None

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