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

Bitbucket commits-noreply at bitbucket.org
Tue Jan 15 06:58:35 PST 2013


4 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/ede211156351/
changeset:   ede211156351
branch:      yt
user:        xarthisius
date:        2013-01-15 14:03:47
summary:     Introduce 'native' as a possible origin option for PlotWindow, that allows to use simulation coordinate system
affected #:  1 file

diff -r f9473ac8c30bbdc1221be0c407fe8ebe7994809c -r ede211156351d6cf6ed63e08db3779e02e449432 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -779,6 +779,8 @@
             elif self.origin == 'left-domain':
                 xc = self.pf.domain_left_edge[x_dict[axis_index]]
                 yc = self.pf.domain_left_edge[y_dict[axis_index]]
+            elif self.origin == 'native':
+                xc, yc = 0.0, 0.0
             else:
                 raise RuntimeError(
                     'origin keyword: \"%(k)s\" not recognized' % {'k': self.origin})
@@ -1029,10 +1031,11 @@
              units, and only show the axes name.
         origin : string
              The location of the origin of the plot coordinate system.
-             Currently, can be set to three options: 'left-domain', corresponding
+             Currently, can be set to following options: 'left-domain', corresponding
              to the bottom-left hand corner of the simulation domain, 'center-domain',
-             corresponding the center of the simulation domain, or 'center-window' for 
-             the center of the plot window.
+             corresponding the center of the simulation domain, 'center-window' for
+             the center of the plot window or 'native' corresponding to the center of
+             simulation coordinate system.
         fontsize : integer
              The size of the fonts for the axis, colorbar, and tick labels.
         field_parameters : dictionary
@@ -1118,12 +1121,13 @@
              Defaults to None, which automatically picks an appropriate unit.
              If axes_unit is '1', 'u', or 'unitary', it will not display the 
              units, and only show the axes name.
-        origin : A string
+        origin : string
              The location of the origin of the plot coordinate system.
-             Currently, can be set to three options: 'left-domain', corresponding
+             Currently, can be set to following options: 'left-domain', corresponding
              to the bottom-left hand corner of the simulation domain, 'center-domain',
-             corresponding the center of the simulation domain, or 'center-window' for 
-             the center of the plot window.
+             corresponding the center of the simulation domain, 'center-window' for
+             the center of the plot window or 'native' corresponding to the center of
+             simulation coordinate system.
         weight_field : string
              The name of the weighting field.  Set to None for no weight.
         max_level: int


https://bitbucket.org/yt_analysis/yt/commits/9014d0e15e5c/
changeset:   9014d0e15e5c
branch:      yt
user:        xarthisius
date:        2013-01-15 14:25:52
summary:     Revert previous commit
affected #:  1 file

diff -r ede211156351d6cf6ed63e08db3779e02e449432 -r 9014d0e15e5c6c78c0326839bcfd6787bfe8d415 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -779,8 +779,6 @@
             elif self.origin == 'left-domain':
                 xc = self.pf.domain_left_edge[x_dict[axis_index]]
                 yc = self.pf.domain_left_edge[y_dict[axis_index]]
-            elif self.origin == 'native':
-                xc, yc = 0.0, 0.0
             else:
                 raise RuntimeError(
                     'origin keyword: \"%(k)s\" not recognized' % {'k': self.origin})
@@ -1031,11 +1029,10 @@
              units, and only show the axes name.
         origin : string
              The location of the origin of the plot coordinate system.
-             Currently, can be set to following options: 'left-domain', corresponding
+             Currently, can be set to three options: 'left-domain', corresponding
              to the bottom-left hand corner of the simulation domain, 'center-domain',
-             corresponding the center of the simulation domain, 'center-window' for
-             the center of the plot window or 'native' corresponding to the center of
-             simulation coordinate system.
+             corresponding the center of the simulation domain, or 'center-window' for 
+             the center of the plot window.
         fontsize : integer
              The size of the fonts for the axis, colorbar, and tick labels.
         field_parameters : dictionary
@@ -1121,13 +1118,12 @@
              Defaults to None, which automatically picks an appropriate unit.
              If axes_unit is '1', 'u', or 'unitary', it will not display the 
              units, and only show the axes name.
-        origin : string
+        origin : A string
              The location of the origin of the plot coordinate system.
-             Currently, can be set to following options: 'left-domain', corresponding
+             Currently, can be set to three options: 'left-domain', corresponding
              to the bottom-left hand corner of the simulation domain, 'center-domain',
-             corresponding the center of the simulation domain, 'center-window' for
-             the center of the plot window or 'native' corresponding to the center of
-             simulation coordinate system.
+             corresponding the center of the simulation domain, or 'center-window' for 
+             the center of the plot window.
         weight_field : string
              The name of the weighting field.  Set to None for no weight.
         max_level: int


https://bitbucket.org/yt_analysis/yt/commits/a78ef74c99e1/
changeset:   a78ef74c99e1
branch:      yt
user:        MatthewTurk
date:        2012-12-19 00:50:37
summary:     Re-inserting the centering / origin code from Anthony.  I removed it by
mistake.
affected #:  1 file

diff -r 9014d0e15e5c6c78c0326839bcfd6787bfe8d415 -r a78ef74c99e1bfac949ba1bf57546ded7e22ced9 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -758,6 +758,62 @@
         if self._plot_type is None:
             self._plot_type = kwargs.pop("plot_type")
         PWViewer.__init__(self, *args, **kwargs)
+        
+    def _setup_origin(self):
+        origin = self.origin
+        axis_index = self.data_source.axis
+        if isinstance(origin, basestring):
+            origin = tuple(origin.split('-'))[:3]
+        if 1 == len(origin):
+            origin = ('lower', 'left') + origin
+        elif 2 == len(origin) and origin[0] in set(['left','right','center']):
+            o0map = {'left': 'lower', 'right': 'upper', 'center': 'center'}
+            origin = (o0map[origin[0]],) + origin
+        elif 2 == len(origin) and origin[0] in set(['lower','upper','center']):
+            origin = (origin[0], 'center', origin[-1])
+        assert origin[-1] in ['window', 'domain']
+
+        if origin[2] == 'window':
+            xllim, xrlim = self.xlim
+            yllim, yrlim = self.ylim
+        elif origin[2] == 'domain':
+            xllim = self.pf.domain_left_edge[x_dict[axis_index]]
+            xrlim = self.pf.domain_right_edge[x_dict[axis_index]]
+            yllim = self.pf.domain_left_edge[y_dict[axis_index]]
+            yrlim = self.pf.domain_right_edge[y_dict[axis_index]]
+        else:
+            mylog.warn("origin = {0}".format(origin))
+            msg = ('origin keyword "{0}" not recognized, must declare "domain" '
+                   'or "center" as the last term in origin.').format(self.origin)
+            raise RuntimeError(msg)
+
+        if origin[0] == 'lower':
+            yc = yllim
+        elif origin[0] == 'upper':
+            yc = yrlim
+        elif origin[0] == 'center':
+            yc = (yllim + yrlim)/2.0
+        else:
+            mylog.warn("origin = {0}".format(origin))
+            msg = ('origin keyword "{0}" not recognized, must declare "lower" '
+                   '"upper" or "center" as the first term in origin.')
+            msg = msg.format(self.origin)
+            raise RuntimeError(msg)
+
+        if origin[1] == 'left':
+            xc = xllim
+        elif origin[1] == 'right':
+            xc = xrlim
+        elif origin[1] == 'center':
+            xc = (xllim + xrlim)/2.0
+        else:
+            mylog.warn("origin = {0}".format(origin))
+            msg = ('origin keyword "{0}" not recognized, must declare "left" '
+                   '"right" or "center" as the second term in origin.')
+            msg = msg.format(self.origin)
+            raise RuntimeError(msg)
+
+        return xc, yc
 
     def _setup_plots(self):
         if self._current_field is not None:
@@ -768,20 +824,7 @@
         for f in self.fields:
             axis_index = self.data_source.axis
 
-            if self.origin == 'center-window':
-                xc = (self.xlim[0]+self.xlim[1])/2
-                yc = (self.ylim[0]+self.ylim[1])/2
-            elif self.origin == 'center-domain':
-                xc = (self.pf.domain_left_edge[x_dict[axis_index]]+
-                      self.pf.domain_right_edge[x_dict[axis_index]])/2
-                yc = (self.pf.domain_left_edge[y_dict[axis_index]]+
-                      self.pf.domain_right_edge[y_dict[axis_index]])/2
-            elif self.origin == 'left-domain':
-                xc = self.pf.domain_left_edge[x_dict[axis_index]]
-                yc = self.pf.domain_left_edge[y_dict[axis_index]]
-            else:
-                raise RuntimeError(
-                    'origin keyword: \"%(k)s\" not recognized' % {'k': self.origin})
+            xc, yc = self._setup_origin()
 
             if self._axes_unit_names is None:
                 unit = get_smallest_appropriate_unit(self.xlim[1] - self.xlim[0], self.pf)
@@ -1027,12 +1070,32 @@
              Defaults to None, which automatically picks an appropriate unit.
              If axes_unit is '1', 'u', or 'unitary', it will not display the 
              units, and only show the axes name.
-        origin : string
-             The location of the origin of the plot coordinate system.
-             Currently, can be set to three options: 'left-domain', corresponding
-             to the bottom-left hand corner of the simulation domain, 'center-domain',
-             corresponding the center of the simulation domain, or 'center-window' for 
-             the center of the plot window.
+        origin : string or length 1, 2, or 3 sequence of strings
+             The location of the origin of the plot coordinate system.  This is 
+             represented by '-' separated string or a tuple of strings.  In the
+             first index the y-location is given by 'lower', 'upper', or 'center'.
+             The second index is the x-location, given as 'left', 'right', or 
+             'center'.  Finally, the whether the origin is applied in 'domain' space
+             or plot 'window' space is given. For example, both 'upper-right-domain'
+             and ['upper', 'right', 'domain'] both place the origin in the upper
+             right hand corner of domain space. If x or y are not given, a value is 
+             inffered.  For instance, 'left-domain' corresponds to the lower-left 
+             hand corner of the simulation domain, 'center-domain' corresponds to the 
+             center of the simulation domain, or 'center-window' for the center of 
+             the plot window.  Further examples:
+
+             ==================================     ============================
+             format                                 example                
+             ==================================     ============================
+             '{space}'                              'domain'
+             '{xloc}-{space}'                       'left-window'
+             '{yloc}-{space}'                       'upper-domain'
+             '{yloc}-{xloc}-{space}'                'lower-right-window'
+             ('{space}',)                           ('window',)
+             ('{xloc}', '{space}')                  ('right', 'domain')
+             ('{yloc}', '{space}')                  ('lower', 'window')
+             ('{yloc}', '{xloc}', '{space}')        ('lower', 'right', 'window')
+             ==================================     ============================
         fontsize : integer
              The size of the fonts for the axis, colorbar, and tick labels.
         field_parameters : dictionary
@@ -1118,12 +1181,33 @@
              Defaults to None, which automatically picks an appropriate unit.
              If axes_unit is '1', 'u', or 'unitary', it will not display the 
              units, and only show the axes name.
-        origin : A string
-             The location of the origin of the plot coordinate system.
-             Currently, can be set to three options: 'left-domain', corresponding
-             to the bottom-left hand corner of the simulation domain, 'center-domain',
-             corresponding the center of the simulation domain, or 'center-window' for 
-             the center of the plot window.
+        origin : string or length 1, 2, or 3 sequence of strings
+             The location of the origin of the plot coordinate system.  This is 
+             represented by '-' separated string or a tuple of strings.  In the
+             first index the y-location is given by 'lower', 'upper', or 'center'.
+             The second index is the x-location, given as 'left', 'right', or 
+             'center'.  Finally, the whether the origin is applied in 'domain' space
+             or plot 'window' space is given. For example, both 'upper-right-domain'
+             and ['upper', 'right', 'domain'] both place the origin in the upper
+             right hand corner of domain space. If x or y are not given, a value is 
+             inffered.  For instance, 'left-domain' corresponds to the lower-left 
+             hand corner of the simulation domain, 'center-domain' corresponds to the 
+             center of the simulation domain, or 'center-window' for the center of 
+             the plot window.Further examples:
+
+             ==================================     ============================
+             format                                 example
+             ==================================     ============================ 
+             '{space}'                              'domain'
+             '{xloc}-{space}'                       'left-window'
+             '{yloc}-{space}'                       'upper-domain'
+             '{yloc}-{xloc}-{space}'                'lower-right-window'
+             ('{space}',)                           ('window',)
+             ('{xloc}', '{space}')                  ('right', 'domain')
+             ('{yloc}', '{space}')                  ('lower', 'window')
+             ('{yloc}', '{xloc}', '{space}')        ('lower', 'right', 'window')
+             ==================================     ============================
+             
         weight_field : string
              The name of the weighting field.  Set to None for no weight.
         max_level: int


https://bitbucket.org/yt_analysis/yt/commits/c3e7e785d511/
changeset:   c3e7e785d511
branch:      yt
user:        xarthisius
date:        2013-01-15 15:30:45
summary:     Rentroduce 'native' as a possible origin option for PlotWindow, that allows to use simulation coordinate system
affected #:  1 file

diff -r a78ef74c99e1bfac949ba1bf57546ded7e22ced9 -r c3e7e785d51185a82787940a21e0a94e58d5f3d3 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -771,7 +771,7 @@
             origin = (o0map[origin[0]],) + origin
         elif 2 == len(origin) and origin[0] in set(['lower','upper','center']):
             origin = (origin[0], 'center', origin[-1])
-        assert origin[-1] in ['window', 'domain']
+        assert origin[-1] in ['window', 'domain', 'native']
 
         if origin[2] == 'window':
             xllim, xrlim = self.xlim
@@ -781,6 +781,8 @@
             xrlim = self.pf.domain_right_edge[x_dict[axis_index]]
             yllim = self.pf.domain_left_edge[y_dict[axis_index]]
             yrlim = self.pf.domain_right_edge[y_dict[axis_index]]
+        elif origin[2] == 'native':
+            return 0.0, 0.0
         else:
             mylog.warn("origin = {0}".format(origin))
             msg = ('origin keyword "{0}" not recognized, must declare "domain" '
@@ -1075,14 +1077,14 @@
              represented by '-' separated string or a tuple of strings.  In the
              first index the y-location is given by 'lower', 'upper', or 'center'.
              The second index is the x-location, given as 'left', 'right', or 
-             'center'.  Finally, the whether the origin is applied in 'domain' space
-             or plot 'window' space is given. For example, both 'upper-right-domain'
-             and ['upper', 'right', 'domain'] both place the origin in the upper
-             right hand corner of domain space. If x or y are not given, a value is 
-             inffered.  For instance, 'left-domain' corresponds to the lower-left 
-             hand corner of the simulation domain, 'center-domain' corresponds to the 
-             center of the simulation domain, or 'center-window' for the center of 
-             the plot window.  Further examples:
+             'center'.  Finally, the whether the origin is applied in 'domain' space,
+             plot 'window' space or 'native' simulation coordinate system is given.
+             For example, both 'upper-right-domain' and ['upper', 'right', 'domain']
+             both place the origin in the upper right hand corner of domain space.
+             If x or y are not given, a value is inffered.  For instance, 'left-domain'
+             corresponds to the lower-left hand corner of the simulation domain,
+             'center-domain' corresponds to the center of the simulation domain,
+             or 'center-window' for the center of the plot window. Further examples:
 
              ==================================     ============================
              format                                 example                
@@ -1186,14 +1188,14 @@
              represented by '-' separated string or a tuple of strings.  In the
              first index the y-location is given by 'lower', 'upper', or 'center'.
              The second index is the x-location, given as 'left', 'right', or 
-             'center'.  Finally, the whether the origin is applied in 'domain' space
-             or plot 'window' space is given. For example, both 'upper-right-domain'
-             and ['upper', 'right', 'domain'] both place the origin in the upper
-             right hand corner of domain space. If x or y are not given, a value is 
-             inffered.  For instance, 'left-domain' corresponds to the lower-left 
-             hand corner of the simulation domain, 'center-domain' corresponds to the 
-             center of the simulation domain, or 'center-window' for the center of 
-             the plot window.Further examples:
+             'center'.  Finally, the whether the origin is applied in 'domain' space,
+             plot 'window' space or 'native' simulation coordinate system is given.
+             For example, both 'upper-right-domain' and ['upper', 'right', 'domain']
+             both place the origin in the upper right hand corner of domain space.
+             If x or y are not given, a value is inffered.  For instance, 'left-domain'
+             corresponds to the lower-left hand corner of the simulation domain,
+             'center-domain' corresponds to the center of the simulation domain,
+             or 'center-window' for the center of the plot window. Further examples:
 
              ==================================     ============================
              format                                 example

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