[Yt-svn] yt: Updated Celeritas pan and scan to use logging in the fields....

hg at spacepope.org hg at spacepope.org
Wed Mar 24 16:37:44 PDT 2010


hg Repository: yt
details:   yt/rev/3b3d5cfe2ce8
changeset: 1477:3b3d5cfe2ce8
user:      Matthew Turk <matthewturk at gmail.com>
date:
Wed Mar 24 16:37:34 2010 -0700
description:
Updated Celeritas pan and scan to use logging in the fields.  Writing out the
received image inside the client and plotting that now display the right thing,
so I think it's solid -- but C/F ordering might have to be dealt with at some
point in the future.

diffstat:

 yt/extensions/image_panner/vm_panner.py |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (34 lines):

diff -r f7a45b5105fc -r 3b3d5cfe2ce8 yt/extensions/image_panner/vm_panner.py
--- a/yt/extensions/image_panner/vm_panner.py	Wed Mar 24 13:01:39 2010 -0700
+++ b/yt/extensions/image_panner/vm_panner.py	Wed Mar 24 16:37:34 2010 -0700
@@ -291,11 +291,12 @@
 class PanningCeleritasStreamer(object):
     _initialized = False
     def __init__(self, tile_id, cmap = "algae", port = 9988,
-                 zlim = (0.0, 1.0)):
+                 zlim = (0.0, 1.0), take_log = True):
         self.tile_id = tile_id
         self._port = port
         self.cmap = cmap
         self.zlim = zlim
+        self.take_log = True
 
     def initialize(self, shape):
         if isinstance(self.cmap, types.StringTypes):
@@ -313,10 +314,13 @@
 
     def __call__(self, val):
         if not self._initialized: self.initialize(val.shape)
-        vv = val.copy()
+        if self.take_log:
+            vv = na.log10(val)
+        else:
+            vv = val.copy()
         na.subtract(vv, self.zlim[0], vv)
         na.divide(vv, (self.zlim[1]-self.zlim[0]), vv)
-        new_buf = self.cmap(vv)
+        new_buf = self.cmap(vv)[:,:,:3]
         na.multiply(new_buf, 255.0, new_buf)
-        new_buf = new_buf[:,:,:3].astype('uint8')
+        new_buf = new_buf.astype('uint8')
         self.cs.readFromRGBMemAndSend(new_buf)



More information about the yt-svn mailing list