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

Bitbucket commits-noreply at bitbucket.org
Wed Feb 15 04:46:56 PST 2012


7 new commits in yt:


https://bitbucket.org/yt_analysis/yt/changeset/f3662bbaea16/
changeset:   f3662bbaea16
branch:      yt
user:        MatthewTurk
date:        2012-02-15 12:48:32
summary:     Change field transforms to be class instances for Plot Window.  Also, use log10
instead of log.  Ticks, names, and transformations all occur as part of the
transform class.
affected #:  2 files

diff -r f96f0096469af66d338293c221c74aba96eb721a -r f3662bbaea16df9ec028dd9798b8f9833a39dc1d yt/gui/reason/extdirect_repl.py
--- a/yt/gui/reason/extdirect_repl.py
+++ b/yt/gui/reason/extdirect_repl.py
@@ -130,7 +130,6 @@
 
     def execute_one(self, code, hide):
         self.repl.executed_cell_texts.append(code)
-
         result = ProgrammaticREPL.execute(self.repl, code)
         if self.repl.debug:
             print "==================== Cell Execution ===================="


diff -r f96f0096469af66d338293c221c74aba96eb721a -r f3662bbaea16df9ec028dd9798b8f9833a39dc1d yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -61,6 +61,22 @@
         return f(*args, **kwargs)
     return newfunc
 
+class FieldTransform(object):
+    def __init__(self, name, func, locator):
+        self.name = name
+        self.func = func
+        self.locator = locator
+
+    def __call__(self, *args, **kwargs):
+        return self.func(*args, **kwargs)
+
+    def ticks(self, mi, ma):
+        print mi, ma
+        return self.locator(mi, ma)
+
+log_transform = FieldTransform('log10', na.log10, LogLocator())
+linear_transform = FieldTransform('linear', lambda x: x, LinearLocator())
+
 class PlotWindow(object):
     def __init__(self, data_source, bounds, buff_size=(800,800), antialias = True, periodic = True):
         r"""
@@ -247,14 +263,14 @@
         self._field_transform = {}
         for field in self._frb.data.keys():
             if self._frb.pf.field_info[field].take_log:
-                self._field_transform[field] = na.log
+                self._field_transform[field] = log_transform
             else:
-                self._field_transform[field] = lambda x: x
+                self._field_transform[field] = linear_transform
 
         if setup: self._setup_plots()
 
     @invalidate_plot
-    def set_log(self,field,log):
+    def set_log(self, field, log):
         """set a field to log or linear.
         
         Parameters
@@ -266,11 +282,13 @@
 
         """
         if log:
-            self._field_transform[field] = na.log
+            self._field_transform[field] = log_transform
         else:
-            self._field_transform[field] = lambda x: x
+            self._field_transform[field] = linear_transform
 
     def set_transform(self, field, func):
+        if not isinstance(FieldTransform, func):
+            raise RuntimeError
         self._field_transform[field] = func
 
     @invalidate_plot
@@ -350,9 +368,7 @@
             x_width = self.xlim[1] - self.xlim[0]
             zoom_fac = na.log10(x_width*self._frb.pf['unitary'])/na.log10(min_zoom)
             zoom_fac = 100.0*max(0.0, zoom_fac)
-            ticks = self.get_ticks(self._frb[field].min(),
-                                   self._frb[field].max(), 
-                                   take_log = self._frb.pf.field_info[field].take_log)
+            ticks = self.get_ticks(field)
             payload = {'type':'png_string',
                        'image_data':img_data,
                        'metadata_string': self.get_metadata(field),
@@ -361,26 +377,17 @@
             payload.update(addl_keys)
             ph.add_payload(payload)
 
-    def get_ticks(self, mi, ma, height = 400, take_log = False):
+    def get_ticks(self, field, height = 400):
         # This will eventually change to work with non-logged fields
         ticks = []
-        if take_log and mi > 0.0 and ma > 0.0:
-            ll = LogLocator() 
-            tick_locs = ll(mi, ma)
-            mi = na.log10(mi)
-            ma = na.log10(ma)
-            for v1,v2 in zip(tick_locs, na.log10(tick_locs)):
-                if v2 < mi or v2 > ma: continue
-                p = height - height * (v2 - mi)/(ma - mi)
-                ticks.append((p,v1,v2))
-                #print v1, v2, mi, ma, height, p
-        else:
-            ll = LinearLocator()
-            tick_locs = ll(mi, ma)
-            for v in tick_locs:
-                p = height - height * (v - mi)/(ma-mi)
-                ticks.append((p,v,"%0.3e" % (v)))
-
+        transform = self._field_transform[field]
+        mi, ma = self._frb[field].min(), self._frb[field].max()
+        tick_locs = transform.ticks(mi, ma)
+        mi, ma = transform((mi, ma))
+        for v1,v2 in zip(tick_locs, transform(tick_locs)):
+            if v2 < mi or v2 > ma: continue
+            p = height - height * (v2 - mi)/(ma - mi)
+            ticks.append((p,v1,v2))
         return ticks
 
     def _get_cbar_image(self, height = 400, width = 40):
@@ -441,9 +448,9 @@
         self._current_field = field
         self._frb[field]
         if self._frb.pf.field_info[field].take_log:
-            self._field_transform[field] = na.log
+            self._field_transform[field] = log_transform
         else:
-            self._field_transform[field] = lambda x: x
+            self._field_transform[field] = linear_transform
 
     def get_field_units(self, field, strip_mathml = True):
         ds = self._frb.data_source



https://bitbucket.org/yt_analysis/yt/changeset/6983eedf608a/
changeset:   6983eedf608a
branch:      yt
user:        MatthewTurk
date:        2012-02-15 13:09:36
summary:     Adding ability to switch between transforms in reason.  Note that silent
failures will occur with logging negative or zero values.  However, these can
be recovered quite easily by the user.
affected #:  3 files

diff -r f3662bbaea16df9ec028dd9798b8f9833a39dc1d -r 6983eedf608aa5ed95d95b7063dc9aa7862ef4dd yt/gui/reason/extdirect_repl.py
--- a/yt/gui/reason/extdirect_repl.py
+++ b/yt/gui/reason/extdirect_repl.py
@@ -561,10 +561,12 @@
         _tfield_list = list(set(_tpf.h.field_list + _tpf.h.derived_field_list))
         _tfield_list.sort()
         _tcb = _tpw._get_cbar_image()
+        _ttrans = _tpw._field_transform[_tpw._current_field].name
         _twidget_data = {'fields': _tfield_list,
                          'initial_field': _tfield,
                          'title': "%%s Slice" %% (_tpf),
-                         'colorbar': _tcb}
+                         'colorbar': _tcb,
+                         'initial_transform' : _ttrans}
         """ % dict(pfname = pfname,
                    center_string = center_string,
                    axis = inv_axis_names[axis],


diff -r f3662bbaea16df9ec028dd9798b8f9833a39dc1d -r 6983eedf608aa5ed95d95b7063dc9aa7862ef4dd yt/gui/reason/html/js/widget_plotwindow.js
--- a/yt/gui/reason/html/js/widget_plotwindow.js
+++ b/yt/gui/reason/html/js/widget_plotwindow.js
@@ -451,6 +451,28 @@
                           title: 'Plot Editor',
                           id: 'plot_edit',
                           flex: 1,
+                          items : [
+                             {
+                               text: 'Display',
+                               x: 20,
+                               y: 20,
+                               width : 100,
+                               xtype: 'combo',
+                               editable: false,
+                               triggerAction: 'all',
+                               validateOnBlur: false,
+                               store: ['log10', 'linear'],
+                               value: widget_data['initial_transform'],
+                               listeners: {select: function(combo, record, index){ 
+                                   var newValue = '"' + record.data['field1'] + '"';
+                                   yt_rpc.ExtDirectREPL.execute(
+                                       {code:python_varname + '.set_transform('
+                                         + python_varname + '._current_field, '
+                                         + newValue + ')', hide:false},
+                                         cell_finished);
+                               }}
+                             }
+                          ]
                         }]
                 }
             ]


diff -r f3662bbaea16df9ec028dd9798b8f9833a39dc1d -r 6983eedf608aa5ed95d95b7063dc9aa7862ef4dd yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -45,27 +45,32 @@
 def invalidate_data(f):
     @wraps(f)
     def newfunc(*args, **kwargs):
-        f(*args, **kwargs)
+        rv = f(*args, **kwargs)
         args[0]._data_valid = False
         args[0]._plot_valid = False
         args[0]._recreate_frb()
         if args[0]._initfinished:
             args[0]._setup_plots()
+        return rv
     return newfunc
 
 def invalidate_plot(f):
     @wraps(f)
     def newfunc(*args, **kwargs):
+        rv = f(*args, **kwargs)
         args[0]._plot_valid = False
         args[0]._setup_plots()
-        return f(*args, **kwargs)
+        return rv
     return newfunc
 
+field_transforms = {}
+
 class FieldTransform(object):
     def __init__(self, name, func, locator):
         self.name = name
         self.func = func
         self.locator = locator
+        field_transforms[name] = self
 
     def __call__(self, *args, **kwargs):
         return self.func(*args, **kwargs)
@@ -286,10 +291,11 @@
         else:
             self._field_transform[field] = linear_transform
 
-    def set_transform(self, field, func):
-        if not isinstance(FieldTransform, func):
-            raise RuntimeError
-        self._field_transform[field] = func
+    @invalidate_plot
+    def set_transform(self, field, name):
+        if name not in field_transforms: 
+            raise KeyError(name)
+        self._field_transform[field] = field_transforms[name]
 
     @invalidate_plot
     def set_cmap(self):
@@ -361,6 +367,7 @@
             addl_keys = {}
         min_zoom = 200*self._frb.pf.h.get_smallest_dx() * self._frb.pf['unitary']
         for field in fields:
+            print "GENERATING NEW FRB", field, self._field_transform[field].name
             to_plot = apply_colormap(self._frb[field], func = self._field_transform[field])
             pngs = write_png_to_string(to_plot)
             img_data = base64.b64encode(pngs)



https://bitbucket.org/yt_analysis/yt/changeset/3f4f0fab8c8b/
changeset:   3f4f0fab8c8b
branch:      yt
user:        MatthewTurk
date:        2012-02-15 13:15:06
summary:     Minor styling tweaks for plot editor.
affected #:  1 file

diff -r 6983eedf608aa5ed95d95b7063dc9aa7862ef4dd -r 3f4f0fab8c8bde62cd8247561c30273fdb37d24c yt/gui/reason/html/js/widget_plotwindow.js
--- a/yt/gui/reason/html/js/widget_plotwindow.js
+++ b/yt/gui/reason/html/js/widget_plotwindow.js
@@ -450,13 +450,21 @@
                           xtype: 'panel',
                           title: 'Plot Editor',
                           id: 'plot_edit',
+                          style: {fontFamily: '"Inconsolata", monospace'},
+                          layout: 'absolute',
                           flex: 1,
                           items : [
                              {
+                               x: 10,
+                               y: 20,
+                               width: 70,
+                               xtype: 'label',
                                text: 'Display',
-                               x: 20,
+                             },
+                             {
+                               x: 80,
                                y: 20,
-                               width : 100,
+                               width : 80,
                                xtype: 'combo',
                                editable: false,
                                triggerAction: 'all',



https://bitbucket.org/yt_analysis/yt/changeset/c6e24ef31fe2/
changeset:   c6e24ef31fe2
branch:      yt
user:        MatthewTurk
date:        2012-02-15 13:15:49
summary:     Switching capital/lowercase zoom keys.
affected #:  1 file

diff -r 3f4f0fab8c8bde62cd8247561c30273fdb37d24c -r c6e24ef31fe27edf5d28b2a8f37f9f50cf0f732a yt/gui/reason/html/js/widget_plotwindow.js
--- a/yt/gui/reason/html/js/widget_plotwindow.js
+++ b/yt/gui/reason/html/js/widget_plotwindow.js
@@ -46,25 +46,25 @@
         {key: 'z',
          shift: false,
          fn: function(){
-               control_panel.get("zoom10x").handler();
+               control_panel.get("zoom2x").handler();
             }
         },
         {key: 'Z',
          shift: true,
          fn: function(){
-               control_panel.get("zoom2x").handler();
+               control_panel.get("zoom10x").handler();
             }
         },
         {key: 'x',
          shift: false,
          fn: function(){
-               control_panel.get("zoomout10x").handler();
+               control_panel.get("zoomout2x").handler();
             }
         },
         {key: 'X',
          shift: true,
          fn: function(){
-               control_panel.get("zoomout2x").handler();
+               control_panel.get("zoomout10x").handler();
             }
         },
         {key: 'k',



https://bitbucket.org/yt_analysis/yt/changeset/07dcd0286384/
changeset:   07dcd0286384
branch:      yt
user:        MatthewTurk
date:        2012-02-15 13:33:34
summary:     Adding ability to switch between colormaps, although the colorbar itself still
needs to be updated when colormap changes.
affected #:  3 files

diff -r c6e24ef31fe27edf5d28b2a8f37f9f50cf0f732a -r 07dcd0286384d117ddb831e1affef57e5700744e yt/gui/reason/html/js/widget_plotwindow.js
--- a/yt/gui/reason/html/js/widget_plotwindow.js
+++ b/yt/gui/reason/html/js/widget_plotwindow.js
@@ -479,6 +479,48 @@
                                          + newValue + ')', hide:false},
                                          cell_finished);
                                }}
+                             },
+                             {
+                               x: 10,
+                               y: 60,
+                               width: 70,
+                               xtype: 'label',
+                               text: 'Colormap',
+                             },
+                             {
+                               x: 80,
+                               y: 60,
+                               width : 140,
+                               xtype: 'combo',
+                               editable: false,
+                               triggerAction: 'all',
+                               validateOnBlur: false,
+                               store: ['algae', 'RdBu', 'gist_stern',  
+                                       'hot', 'jet', 'kamae', 
+                                        'B-W LINEAR', 'BLUE',
+                                        'GRN-RED-BLU-WHT', 'RED TEMPERATURE',
+                                        'BLUE', 'STD GAMMA-II', 'PRISM',
+                                        'RED-PURPLE', 'GREEN', 'GRN',
+                                        'GREEN-PINK', 'BLUE-RED', '16 LEVEL',
+                                        'RAINBOW', 'STEPS', 'STERN SPECIAL',
+                                        'Haze', 'Blue - Pastel - Red',
+                                        'Pastels', 'Hue Sat Lightness 1',
+                                        'Hue Sat Lightness 2', 'Hue Sat Value 1',
+                                        'Hue Sat Value 2', 'Purple-Red + Stripes',
+                                        'Beach', 'Mac Style', 'Eos A', 'Eos B',
+                                        'Hardcandy', 'Nature', 'Ocean', 'Peppermint',
+                                        'Plasma', 'Blue-Red', 'Rainbow', 'Blue Waves',
+                                        'Volcano', 'Waves', 'Rainbow18',
+                                        'Rainbow + white', 'Rainbow + black'],
+                               value: 'algae',
+                               listeners: {select: function(combo, record, index){ 
+                                   var newValue = '"' + record.data['field1'] + '"';
+                                   yt_rpc.ExtDirectREPL.execute(
+                                       {code:python_varname + '.set_cmap('
+                                         + python_varname + '._current_field, '
+                                         + newValue + ')', hide:false},
+                                         cell_finished);
+                               }}
                              }
                           ]
                         }]


diff -r c6e24ef31fe27edf5d28b2a8f37f9f50cf0f732a -r 07dcd0286384d117ddb831e1affef57e5700744e yt/visualization/_colormap_data.py
--- a/yt/visualization/_colormap_data.py
+++ b/yt/visualization/_colormap_data.py
@@ -7757,3 +7757,44 @@
          1.0, 1.0, 1.0, 1.0, 1.0, 1.0]),
    )
 
+color_map_luts['B-W LINEAR'] = color_map_luts['idl00']
+color_map_luts['BLUE'] = color_map_luts['idl01']
+color_map_luts['GRN-RED-BLU-WHT'] = color_map_luts['idl02']
+color_map_luts['RED TEMPERATURE'] = color_map_luts['idl03']
+color_map_luts['BLUE'] = color_map_luts['idl04']
+color_map_luts['STD GAMMA-II'] = color_map_luts['idl05']
+color_map_luts['PRISM'] = color_map_luts['idl06']
+color_map_luts['RED-PURPLE'] = color_map_luts['idl07']
+color_map_luts['GREEN'] = color_map_luts['idl08']
+color_map_luts['GRN'] = color_map_luts['idl09']
+color_map_luts['GREEN-PINK'] = color_map_luts['idl10']
+color_map_luts['BLUE-RED'] = color_map_luts['idl11']
+color_map_luts['16 LEVEL'] = color_map_luts['idl12']
+color_map_luts['RAINBOW'] = color_map_luts['idl13']
+color_map_luts['STEPS'] = color_map_luts['idl14']
+color_map_luts['STERN SPECIAL'] = color_map_luts['idl15']
+color_map_luts['Haze'] = color_map_luts['idl16']
+color_map_luts['Blue - Pastel - Red'] = color_map_luts['idl17']
+color_map_luts['Pastels'] = color_map_luts['idl18']
+color_map_luts['Hue Sat Lightness 1'] = color_map_luts['idl19']
+color_map_luts['Hue Sat Lightness 2'] = color_map_luts['idl20']
+color_map_luts['Hue Sat Value 1'] = color_map_luts['idl21']
+color_map_luts['Hue Sat Value 2'] = color_map_luts['idl22']
+color_map_luts['Purple-Red + Stripes'] = color_map_luts['idl23']
+color_map_luts['Beach'] = color_map_luts['idl24']
+color_map_luts['Mac Style'] = color_map_luts['idl25']
+color_map_luts['Eos A'] = color_map_luts['idl26']
+color_map_luts['Eos B'] = color_map_luts['idl27']
+color_map_luts['Hardcandy'] = color_map_luts['idl28']
+color_map_luts['Nature'] = color_map_luts['idl29']
+color_map_luts['Ocean'] = color_map_luts['idl30']
+color_map_luts['Peppermint'] = color_map_luts['idl31']
+color_map_luts['Plasma'] = color_map_luts['idl32']
+color_map_luts['Blue-Red'] = color_map_luts['idl33']
+color_map_luts['Rainbow'] = color_map_luts['idl34']
+color_map_luts['Blue Waves'] = color_map_luts['idl35']
+color_map_luts['Volcano'] = color_map_luts['idl36']
+color_map_luts['Waves'] = color_map_luts['idl37']
+color_map_luts['Rainbow18'] = color_map_luts['idl38']
+color_map_luts['Rainbow + white'] = color_map_luts['idl39']
+color_map_luts['Rainbow + black'] = color_map_luts['idl40']


diff -r c6e24ef31fe27edf5d28b2a8f37f9f50cf0f732a -r 07dcd0286384d117ddb831e1affef57e5700744e yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -266,6 +266,7 @@
         setup = kwargs.pop("setup", True)
         PlotWindow.__init__(self, *args,**kwargs)
         self._field_transform = {}
+        self._colormaps = defaultdict(lambda: 'algae')
         for field in self._frb.data.keys():
             if self._frb.pf.field_info[field].take_log:
                 self._field_transform[field] = log_transform
@@ -298,8 +299,8 @@
         self._field_transform[field] = field_transforms[name]
 
     @invalidate_plot
-    def set_cmap(self):
-        pass
+    def set_cmap(self, field, cmap_name):
+        self._colormaps[field] = cmap_name
 
     @invalidate_plot
     def set_zlim(self):
@@ -352,7 +353,6 @@
     _ext_widget_id = None
     _current_field = None
     _widget_name = "plot_window"
-    cmap = 'algae'
 
     def _setup_plots(self):
         from yt.gui.reason.bottle_mods import PayloadHandler
@@ -368,7 +368,9 @@
         min_zoom = 200*self._frb.pf.h.get_smallest_dx() * self._frb.pf['unitary']
         for field in fields:
             print "GENERATING NEW FRB", field, self._field_transform[field].name
-            to_plot = apply_colormap(self._frb[field], func = self._field_transform[field])
+            to_plot = apply_colormap(self._frb[field],
+                func = self._field_transform[field],
+                cmap_name = self._colormaps[field])
             pngs = write_png_to_string(to_plot)
             img_data = base64.b64encode(pngs)
             # We scale the width between 200*min_dx and 1.0
@@ -397,12 +399,12 @@
             ticks.append((p,v1,v2))
         return ticks
 
-    def _get_cbar_image(self, height = 400, width = 40):
-        # Right now there's just the single 'cmap', but that will eventually
-        # change.  I think?
+    def _get_cbar_image(self, height = 400, width = 40, field = None):
+        if field is None: field = self._current_field
+        cmap_name = self._colormaps[field]
         vals = na.mgrid[1:0:height * 1j] * na.ones(width)[:,None]
         vals = vals.transpose()
-        to_plot = apply_colormap(vals)
+        to_plot = apply_colormap(vals, cmap_name = cmap_name)
         pngs = write_png_to_string(to_plot)
         img_data = base64.b64encode(pngs)
         return img_data
@@ -507,7 +509,6 @@
 class Yt2DPlot(YtPlot):
     zmin = None
     zmax = None
-    cmap = 'algae'
     zlabel = None
 
     # def __init__(self, data):
@@ -518,17 +519,14 @@
         self.zmin = zmin
         self.zmax = zmax
 
-    @invalidate_plot
-    def set_cmap(self,cmap):
-        self.cmap = cmap
-
 class YtWindowPlot(Yt2DPlot):
     def __init__(self, data, size=(10,8)):
         YtPlot.__init__(self, data, size)
         self.__init_image(data)
 
     def __init_image(self, data):
-        self.image = self.axes.imshow(data,cmap=self.cmap)
+        #self.image = self.axes.imshow(data, cmap=self.cmap)
+        pass
 
 class YtProfilePlot(Yt2DPlot):
     def __init__(self):



https://bitbucket.org/yt_analysis/yt/changeset/ebcefd288ff8/
changeset:   ebcefd288ff8
branch:      yt
user:        MatthewTurk
date:        2012-02-15 13:45:58
summary:     The colorbar now updates in reason.
affected #:  3 files

diff -r 07dcd0286384d117ddb831e1affef57e5700744e -r ebcefd288ff8996afaaabe6a7f8d363ceba32cf0 yt/gui/reason/html/js/functions.js
--- a/yt/gui/reason/html/js/functions.js
+++ b/yt/gui/reason/html/js/functions.js
@@ -65,7 +65,6 @@
                 repl_input.get("input_line").setValue("");
             }
             if (OutputContainer.items.length > 1) {
-                examine = cell;
                 OutputContainer.body.dom.scrollTop = 
                 OutputContainer.body.dom.scrollHeight -
                 cell.body.dom.scrollHeight - 20;
@@ -142,7 +141,6 @@
             iconCls: 'pf_icon'}));
         this_pf = treePanel.root.lastChild
         Ext.each(pf.objects, function(obj, obj_index) {
-            examine = this_pf;
             this_pf.appendChild(new Ext.tree.TreeNode(
                 {text: obj.name,
                  leaf: true,


diff -r 07dcd0286384d117ddb831e1affef57e5700744e -r ebcefd288ff8996afaaabe6a7f8d363ceba32cf0 yt/gui/reason/html/js/widget_plotwindow.js
--- a/yt/gui/reason/html/js/widget_plotwindow.js
+++ b/yt/gui/reason/html/js/widget_plotwindow.js
@@ -538,6 +538,7 @@
     this.image_panel = this.panel.get("image_panel_"+python_varname);
     this.ticks = this.panel.get("ticks_"+python_varname);
     var ticks = this.ticks;
+    var colorbar = this.panel.get("colorbar_"+python_varname);
     this.metadata_panel = this.panel.get("rhs_panel_" + python_varname).get("metadata_" + python_varname);
     this.zoom_scroll = this.panel.get("slider_" + python_varname);
     var image_dom = this.image_panel.el.dom;
@@ -552,7 +553,6 @@
         metadata_string = payload['metadata_string'];
         ticks.removeAll();
         Ext.each(payload['ticks'], function(tick, index) {
-            console.log(tick);
             ticks.add({xtype:'panel',
                        width: 10, height:1,
                        style: 'background-color: #000000;',
@@ -565,9 +565,11 @@
                               'font-size: 12px;',
                        html: '' + tick[2] + '',
                        x:12, y: 4 + tick[0]});
-            examine = tick;
         });
-        examine = payload['ticks'];
+        if (payload['colorbar_image'] != null) {
+            colorbar.el.dom.src = "data:image/png;base64," +
+                payload['colorbar_image'];
+        }
         ticks.doLayout();
     }
 


diff -r 07dcd0286384d117ddb831e1affef57e5700744e -r ebcefd288ff8996afaaabe6a7f8d363ceba32cf0 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -83,6 +83,8 @@
 linear_transform = FieldTransform('linear', lambda x: x, LinearLocator())
 
 class PlotWindow(object):
+    _plot_valid = False
+    _colorbar_valid = False
     def __init__(self, data_source, bounds, buff_size=(800,800), antialias = True, periodic = True):
         r"""
         PlotWindow(data_source, bounds, buff_size=(800,800), antialias = True)
@@ -300,6 +302,7 @@
 
     @invalidate_plot
     def set_cmap(self, field, cmap_name):
+        self._colorbar_valid = False
         self._colormaps[field] = cmap_name
 
     @invalidate_plot
@@ -365,6 +368,10 @@
         else:
             fields = self._frb.data.keys()
             addl_keys = {}
+        if self._colorbar_valid == False:
+            print "ADDITIONAL KEYS BEING ADDED"
+            addl_keys['colorbar_image'] = self._get_cbar_image()
+            self._colorbar_valid = True
         min_zoom = 200*self._frb.pf.h.get_smallest_dx() * self._frb.pf['unitary']
         for field in fields:
             print "GENERATING NEW FRB", field, self._field_transform[field].name



https://bitbucket.org/yt_analysis/yt/changeset/2421b03080eb/
changeset:   2421b03080eb
branch:      yt
user:        MatthewTurk
date:        2012-02-15 13:46:27
summary:     Removing debugging statements.
affected #:  1 file

diff -r ebcefd288ff8996afaaabe6a7f8d363ceba32cf0 -r 2421b03080eb1df86b9f0669aa4e25a619dde0cc yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -369,12 +369,10 @@
             fields = self._frb.data.keys()
             addl_keys = {}
         if self._colorbar_valid == False:
-            print "ADDITIONAL KEYS BEING ADDED"
             addl_keys['colorbar_image'] = self._get_cbar_image()
             self._colorbar_valid = True
         min_zoom = 200*self._frb.pf.h.get_smallest_dx() * self._frb.pf['unitary']
         for field in fields:
-            print "GENERATING NEW FRB", field, self._field_transform[field].name
             to_plot = apply_colormap(self._frb[field],
                 func = self._field_transform[field],
                 cmap_name = self._colormaps[field])

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