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

Bitbucket commits-noreply at bitbucket.org
Thu Jun 28 03:34:29 PDT 2012


2 new commits in yt:


https://bitbucket.org/yt_analysis/yt/changeset/5578e7f19a83/
changeset:   5578e7f19a83
branch:      yt
user:        MatthewTurk
date:        2012-06-28 05:02:05
summary:     First pass at a 'pending results' widget, but right now it seems to increment
without decrementing.
affected #:  7 files

diff -r 7ec625f67ddd097914b07d1ad82939ef698b3714 -r 5578e7f19a83f97e8cefd30eedfec974a828ad03 yt/gui/reason/extdirect_repl.py
--- a/yt/gui/reason/extdirect_repl.py
+++ b/yt/gui/reason/extdirect_repl.py
@@ -96,22 +96,16 @@
                 if self.repl.stopped: return
                 continue
             print "Received the task", task
-            if task['type'] == 'code':
-                self.execute_one(task['code'], task['hide'])
-                self.queue.task_done()
-            elif task['type'] == 'add_widget':
-                #print "Adding new widget"
-                self.queue.task_done()
-                new_code = self.repl._add_widget(
-                    task['name'], task['widget_data_name'])
-                #print "Got this command:", new_code
-                self.execute_one(new_code, hide=True)
-                #print "Executed!"
+            if task['type'] != 'code':
+                raise NotImplementedError
+            print task
+            self.execute_one(task['code'], task['hide'], task['result_id'])
+            self.queue.task_done()
 
     def wait(self):
         self.queue.join()
 
-    def execute_one(self, code, hide):
+    def execute_one(self, code, hide, result_id):
         self.repl.executed_cell_texts.append(code)
         result = ProgrammaticREPL.execute(self.repl, code)
         if self.repl.debug:
@@ -120,14 +114,15 @@
             print "====================                ===================="
             print result
             print "========================================================"
-        if not hide:
-            self.payload_handler.add_payload(
-                {'type': 'cell',
-                 'output': result,
-                 'input': highlighter(code),
-                 'image_data': '',
-                 'raw_input': code},
-                )
+        self.payload_handler.add_payload(
+            {'type': 'cell',
+             'output': result,
+             'input': highlighter(code),
+             'image_data': '',
+             'result_id': result_id,
+             'hide': hide,
+             'raw_input': code},
+            )
         objs = get_list_of_datasets()
         self.payload_handler.add_payload(
             {'type': 'dataobjects',
@@ -141,7 +136,7 @@
         Pyro4.config.HMAC_KEY = hmac_key
         self.executor = Pyro4.Proxy(uri)
 
-    def execute_one(self, code, hide):
+    def execute_one(self, code, hide, result_id):
         self.repl.executed_cell_texts.append(code)
         print code
         result = self.executor.execute(code)
@@ -150,6 +145,7 @@
                 {'type': 'cell',
                  'output': result,
                  'input': highlighter(code),
+                 'result_id': result_id,
                  'raw_input': code},
                 )
         ph = self.executor.deliver()
@@ -261,6 +257,7 @@
     def exception_handler(self, exc):
         result = {'type': 'cell',
                   'input': 'ERROR HANDLING IN REASON',
+                  'result_id': None,
                   'output': traceback.format_exc()}
         return result
 
@@ -344,10 +341,12 @@
         response.headers['Content-Type'] = "text/css"
         return highlighter_css
 
-    def execute(self, code, hide = False):
+    def execute(self, code, hide = False, result_id = None):
         task = {'type': 'code',
                 'code': code,
-                'hide': hide}
+                'hide': hide,
+                'result_id': result_id,
+                }
         self.execution_thread.queue.put(task)
         return dict(status = True)
 


diff -r 7ec625f67ddd097914b07d1ad82939ef698b3714 -r 5578e7f19a83f97e8cefd30eedfec974a828ad03 yt/gui/reason/html/app.js
--- a/yt/gui/reason/html/app.js
+++ b/yt/gui/reason/html/app.js
@@ -45,6 +45,7 @@
 
     launch: function() {
         reason = this;
+        this.numberOfRequests = 0;
         rdebug = this.getController("Debugger");
         this.server = this.getController("ServerCommunication");
         Ext.create('Ext.container.Viewport', {
@@ -71,10 +72,19 @@
                     maxSize: 400,
                     collapsible: true,
                     layout: {
-                        type: 'anchor',
+                        type: 'vbox',
+                        pack: 'start',
+                        align: 'stretch',
                     },
                     items: [
-                        { xtype: 'dataobjecttree', },
+                        { xtype: 'dataobjecttree', 
+                          flex: 1.0},
+                        { xtype: 'panel',
+                          tpl: 'Pending Requests: {0}',
+                          data: [0],
+                          height: 30,
+                          id: 'pending',
+                        }
                     ],
               }, {
                 xtype: 'tabpanel',
@@ -96,6 +106,7 @@
               }
             ]
         });
+        this.pending = Ext.getCmp("pending");
         this.fireEvent("allowinput");
     },
     controllers : [


diff -r 7ec625f67ddd097914b07d1ad82939ef698b3714 -r 5578e7f19a83f97e8cefd30eedfec974a828ad03 yt/gui/reason/html/app/controller/Notebook.js
--- a/yt/gui/reason/html/app/controller/Notebook.js
+++ b/yt/gui/reason/html/app/controller/Notebook.js
@@ -31,7 +31,7 @@
 
 Ext.define('Reason.controller.Notebook', {
     extend: 'Ext.app.Controller',
-    stores: [ 'CellValues' ],
+    stores: [ 'CellValues' , 'Requests'],
     views: ['Notebook', 'CellView'],
     refs: [
         { ref: 'inputLine',
@@ -72,15 +72,32 @@
         this.callParent(arguments);
     },
 
+    addRequest: function(request_id) {
+        this.getRequestsStore().add({
+            request_id: request_id, pending: true,
+        });
+    },
+
     addCell: function(cell) {
         this.application.fireEvent("wipeinput");
         this.application.fireEvent("allowinput");
+        if (cell['result_id'] != null) {
+            var ind = this.getRequestsStore().find(
+                'request_id', cell['result_id']);
+            if (ind != -1) {
+                var rec = this.getRequestsStore().getAt(ind);
+                rec.data.pending = false;
+            }
+            reason.pending.update([this.getRequestsStore().count()]);
+        }
+        if (cell['hide'] == true) { return; }
         this.getCellValuesStore().add({
             input: cell['input'],
             output: cell['output'],
             raw_input: cell['raw_input'],
             image_data: cell['image_data'],
             executiontime: cell['executiontime'],
+            result_id: cell['result_id'],
         });
         this.application.fireEvent("scrolltobottom");
     },


diff -r 7ec625f67ddd097914b07d1ad82939ef698b3714 -r 5578e7f19a83f97e8cefd30eedfec974a828ad03 yt/gui/reason/html/app/controller/ServerCommunication.js
--- a/yt/gui/reason/html/app/controller/ServerCommunication.js
+++ b/yt/gui/reason/html/app/controller/ServerCommunication.js
@@ -104,7 +104,15 @@
         else { fn = this.returnFromRPC; }
         if (hide == null) { hide = false; }
         reason.fireEvent("disableinput");
-        yt_rpc.ExtDirectREPL.execute({code: code, hide:hide}, fn);
+        result_id = reason.numberOfRequests + 1;
+        reason.numberOfRequests += 1;
+        console.log("Number of requests: " + reason.numberOfRequests);
+        reason.getController("Notebook").addRequest(result_id);
+        yt_rpc.ExtDirectREPL.execute({
+            code: code,
+            hide:hide,
+            result_id: result_id
+        }, fn);
     },
 
     returnFromRPC: function(result, e) {


diff -r 7ec625f67ddd097914b07d1ad82939ef698b3714 -r 5578e7f19a83f97e8cefd30eedfec974a828ad03 yt/gui/reason/html/app/store/CellValues.js
--- a/yt/gui/reason/html/app/store/CellValues.js
+++ b/yt/gui/reason/html/app/store/CellValues.js
@@ -33,7 +33,8 @@
     extend: 'Ext.data.Store',
     id: 'cellvalues',
     fields: ['input', 'output', 'raw_input', 'executiontime', 
-        { name: 'image_data', type: 'string', defaultValue: '' }
+        { name: 'image_data', type: 'string', defaultValue: '' },
+        'result_id',
     ],
     data: [],
 });


diff -r 7ec625f67ddd097914b07d1ad82939ef698b3714 -r 5578e7f19a83f97e8cefd30eedfec974a828ad03 yt/gui/reason/html/app/store/Requests.js
--- /dev/null
+++ b/yt/gui/reason/html/app/store/Requests.js
@@ -0,0 +1,41 @@
+/**********************************************************************
+A store for outstanding requests
+
+Author: Cameron Hummels <chummels at gmail.com>
+Affiliation: Columbia
+Author: Jeffrey S. Oishi <jsoishi at gmail.com>
+Affiliation: KIPAC/SLAC/Stanford
+Author: Britton Smith <brittonsmith at gmail.com>
+Affiliation: MSU
+Author: Matthew Turk <matthewturk at gmail.com>
+Affiliation: Columbia University
+Homepage: http://yt-project.org/
+License:
+  Copyright (C) 2011 Matthew Turk.  All Rights Reserved.
+
+  This file is part of yt.
+
+  yt is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+***********************************************************************/
+
+Ext.define('Reason.store.Requests', {
+    extend: 'Ext.data.Store',
+    id: 'requestsstore',
+    fields: ['request_id',
+             { name: 'pending', type: 'bool' }
+    ],
+    filters: [ { property: 'pending', value: true, } ],
+    data: [],
+});
+


diff -r 7ec625f67ddd097914b07d1ad82939ef698b3714 -r 5578e7f19a83f97e8cefd30eedfec974a828ad03 yt/gui/reason/utils.py
--- a/yt/gui/reason/utils.py
+++ b/yt/gui/reason/utils.py
@@ -53,6 +53,7 @@
                'output': '',
                'input': '',
                'raw_input': '',
+               'result_id': None,
                'image_data':img_data}
     ph.add_payload(payload)
 



https://bitbucket.org/yt_analysis/yt/changeset/08085707319e/
changeset:   08085707319e
branch:      yt
user:        MatthewTurk
date:        2012-06-28 12:34:22
summary:     RZ/rz typo
affected #:  1 file

diff -r 5578e7f19a83f97e8cefd30eedfec974a828ad03 -r 08085707319e370ca65caf0ebded46b0d20e1c95 yt/analysis_modules/halo_finding/halo_objects.py
--- a/yt/analysis_modules/halo_finding/halo_objects.py
+++ b/yt/analysis_modules/halo_finding/halo_objects.py
@@ -525,7 +525,7 @@
         # find the t1 angle needed to rotate about z axis to align e0 to x
         t1 = na.arctan(e0_vector[1] / e0_vector[0])
         RZ = get_rotation_matrix(-t1, (0, 0, 1)).transpose()
-        r1 = (e0_vector * rz).sum(axis = 1)
+        r1 = (e0_vector * RZ).sum(axis = 1)
         # find the t2 angle needed to rotate about y axis to align e0 to x
         t2 = na.arctan(-r1[2] / r1[0])
         RY = get_rotation_matrix(-t2, (0, 1, 0)).transpose()

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