Index: guiframe/local_perspectives/plotting/BoxParameters.py
===================================================================
--- guiframe/local_perspectives/plotting/BoxParameters.py	(revision 92c2345cf1edfe8401d0b7ce54d43eec01e8ca56)
+++ guiframe/local_perspectives/plotting/BoxParameters.py	(revision 92c2345cf1edfe8401d0b7ce54d43eec01e8ca56)
@@ -0,0 +1,138 @@
+"""
+    Panel class to show the slicer parameters 
+"""
+
+import wx
+import wx.lib.newevent
+from copy import deepcopy
+
+(SlicerEvent, EVT_SLICER)   = wx.lib.newevent.NewEvent()
+(SlicerParameterEvent, EVT_SLICER_PARS)   = wx.lib.newevent.NewEvent()
+
+
+def format_number(value, high=False):
+    """
+        Return a float in a standardized, human-readable formatted string 
+    """
+    try: 
+        value = float(value)
+    except:
+        return "NaN"
+    
+    if high:
+        return "%-6.4g" % value
+    else:
+        return "%-5.3g" % value
+
+class SlicerParameterPanel(wx.Dialog):
+    #TODO: show units
+    #TODO: order parameters properly
+    
+    def __init__(self, parent, *args, **kwargs):
+        wx.Dialog.__init__(self, parent, *args, **kwargs)
+        self.params = {}
+        self.parent = parent
+        self.type = None
+        self.listeners = []
+        self.parameters = []
+        self.bck = wx.GridBagSizer(5,5)
+        self.SetSizer(self.bck)
+               
+        title = wx.StaticText(self, -1, "Right-click on 2D plot for slicer options", style=wx.ALIGN_LEFT)
+        self.bck.Add(title, (0,0), (1,2), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=15)
+        
+        # Bindings
+        self.parent.Bind(EVT_SLICER, self.onEVT_SLICER)
+        self.parent.Bind(EVT_SLICER_PARS, self.onParamChange)
+
+    def onEVT_SLICER(self, event):
+        """
+            Process EVT_SLICER events
+            When the slicer changes, update the panel
+            
+            @param event: EVT_SLICER event
+        """
+        event.Skip()
+        if event.obj_class==None:
+            self.set_slicer(None, None)
+        else:
+            self.set_slicer(event.type, event.params)
+        
+    def set_slicer(self, type, params):
+        """
+            Rebuild the panel
+        """
+        self.bck.Clear(True)  
+        self.type = type  
+        
+        if type==None:
+            title = wx.StaticText(self, -1, "Right-click on 2D plot for slicer options", style=wx.ALIGN_LEFT)
+            self.bck.Add(title, (0,0), (1,2), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=15)
+
+        else:
+            title = wx.StaticText(self, -1, "Slicer Parameters", style=wx.ALIGN_LEFT)
+            self.bck.Add(title, (0,0), (1,2), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=15)
+            ix = 0
+            iy = 0
+            self.parameters = []
+            #params = slicer.get_params()
+            keys = params.keys()
+            keys.sort()
+            
+            for item in keys:
+                iy += 1
+                ix = 0
+                text = wx.StaticText(self, -1, item, style=wx.ALIGN_LEFT)
+                #self.bck.Add(text, (iy,ix), flag = wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border = 15)
+                self.bck.Add(text, (iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+                ctl = wx.TextCtrl(self, -1, size=(80,20), style=wx.TE_PROCESS_ENTER)
+                
+                ctl.SetToolTipString("Modify the value of %s to change the 2D slicer" % item)
+                
+                ix = 1
+                ctl.SetValue(format_number(str(params[item])))
+                self.Bind(wx.EVT_TEXT_ENTER, self.onTextEnter)
+                ctl.Bind(wx.EVT_KILL_FOCUS, self.onTextEnter)
+                self.parameters.append([item, ctl])
+                #self.bck.Add(ctl, (iy,ix), flag=wx.TOP|wx.BOTTOM, border = 0)
+                self.bck.Add(ctl, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+                
+                ix =3
+                self.bck.Add((20,20), (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+            iy +=1
+            ix = 1
+            self.bck.Add((20,20),(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        self.bck.Layout()
+        self.bck.Fit(self)
+        self.parent.GetSizer().Layout()
+
+    def onParamChange(self, evt):
+        evt.Skip()
+        if evt.type == "UPDATE":
+            for item in self.parameters:              
+                if item[0] in evt.params:
+                    item[1].SetValue("%-5.3g" %evt.params[item[0]])
+                    item[1].Refresh()
+        
+    def onTextEnter(self, evt): 
+        """
+            Parameters have changed
+        """ 
+        params = {}
+        has_error = False
+        for item in self.parameters:
+            try:
+                params[item[0]] = float(item[1].GetValue())
+                item[1].SetBackgroundColour(
+                        wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW))
+                item[1].Refresh()
+            except:
+                has_error = True
+                item[1].SetBackgroundColour("pink")
+                item[1].Refresh()
+
+        if has_error==False:
+            # Post parameter event
+            event = SlicerParameterEvent(type=self.type, params=params)
+            wx.PostEvent(self.parent, event)
+        
Index: guiframe/local_perspectives/plotting/Plotter2D.py
===================================================================
--- guiframe/local_perspectives/plotting/Plotter2D.py	(revision 4b91fd188e6d810c9b318a762936a0fc1d18905e)
+++ guiframe/local_perspectives/plotting/Plotter2D.py	(revision 92c2345cf1edfe8401d0b7ce54d43eec01e8ca56)
@@ -208,5 +208,5 @@
         slicerpop.Append(id, '&Annulus [Phi view ]')
         wx.EVT_MENU(self, id, self.onSectorPhi) 
-        
+       
         id = wx.NewId()
         slicerpop.Append(id, '&Box Sum')
@@ -216,12 +216,13 @@
         slicerpop.Append(id, '&Box averaging')
         wx.EVT_MENU(self, id, self.onBoxavg) 
-        
-        id = wx.NewId()
-        slicerpop.Append(id, '&Clear slicer')
-        wx.EVT_MENU(self, id,  self.onClearSlicer) 
-        
-        id = wx.NewId()
-        slicerpop.Append(id, '&Edit Slicer Parameters')
-        wx.EVT_MENU(self, id, self._onEditSlicer) 
+        if self.slicer !=None:
+            id = wx.NewId()
+            slicerpop.Append(id, '&Clear slicer')
+            wx.EVT_MENU(self, id,  self.onClearSlicer) 
+        
+        
+            id = wx.NewId()
+            slicerpop.Append(id, '&Edit Slicer Parameters')
+            wx.EVT_MENU(self, id, self._onEditSlicer) 
         
         slicerpop.AppendSeparator()
@@ -310,6 +311,12 @@
         event = self._getEmptySlicerEvent()
         event.type = self.slicer.__class__.__name__
+        print "event.type",event.type
         event.obj_class = self.slicer.__class__
         event.params = self.slicer.get_params()
+        try:
+            event.result= self.slicer.get_result()
+        except:
+            event.result= None
+        print "event.result", event.result
         wx.PostEvent(self.parent, event)
 
@@ -369,5 +376,4 @@
             Perform sector averaging on Q
         """
-        
         from SectorSlicer import SectorInteractor
         self.onClearSlicer(event)
@@ -386,4 +392,15 @@
         self.onClearSlicer(event)
         wx.PostEvent(self.parent, InternalEvent(slicer= BoxSum))
+        from BoxParameters import SlicerParameterPanel
+       
+        dialog = SlicerParameterPanel(self.parent, -1, "Slicer Parameters")
+       
+        if dialog.ShowModal() == wx.ID_OK:
+            dialog.Destroy()
+            
+    def onBoxavg(self,event):
+        from boxSlicer import BoxInteractor
+        self.onClearSlicer(event)
+        wx.PostEvent(self.parent, InternalEvent(slicer= BoxInteractor))
         """
         self.onClearSlicer(event)
@@ -398,21 +415,4 @@
         wx.PostEvent(self.parent, InternalEvent(slicer= BoxInteractor))
         print "onboxavg",self.slicer
-        """ 
-    def onBoxavg(self,event):
-        from boxSlicer import BoxInteractor
-        self.onClearSlicer(event)
-        wx.PostEvent(self.parent, InternalEvent(slicer= BoxInteractor))
-        """
-        self.onClearSlicer(event)
-        self.slicer=BoxInteractor
-        from SlicerParameters import SlicerParameterPanel
-       
-        dialog = SlicerParameterPanel(self.parent, -1, "Slicer Parameters")
-        dialog.set_slicer(self.slicer.__name__,
-                        self.slicer.get_params())
-        if dialog.ShowModal() == wx.ID_OK:
-            dialog.Destroy()
-        wx.PostEvent(self.parent, InternalEvent(slicer= BoxInteractor))
-        print "onboxavg",self.slicer
         """
         
Index: guiframe/local_perspectives/plotting/boxDialog.py
===================================================================
--- guiframe/local_perspectives/plotting/boxDialog.py	(revision 38224f10e4ed8289b03ee51a242f885249dc2c12)
+++ 	(revision )
@@ -1,138 +1,0 @@
-"""
-    Panel class to show the slicer parameters 
-"""
-
-import wx
-import wx.lib.newevent
-from copy import deepcopy
-
-(SlicerEvent, EVT_SLICER)   = wx.lib.newevent.NewEvent()
-(SlicerParameterEvent, EVT_SLICER_PARS)   = wx.lib.newevent.NewEvent()
-
-
-def format_number(value, high=False):
-    """
-        Return a float in a standardized, human-readable formatted string 
-    """
-    try: 
-        value = float(value)
-    except:
-        return "NaN"
-    
-    if high:
-        return "%-6.4g" % value
-    else:
-        return "%-5.3g" % value
-
-class SlicerParameterPanel(wx.Dialog):
-    #TODO: show units
-    #TODO: order parameters properly
-    
-    def __init__(self, parent, *args, **kwargs):
-        wx.Dialog.__init__(self, parent, *args, **kwargs)
-        self.params = {}
-        self.parent = parent
-        self.type = None
-        self.listeners = []
-        self.parameters = []
-        self.bck = wx.GridBagSizer(5,5)
-        self.SetSizer(self.bck)
-               
-        title = wx.StaticText(self, -1, "Right-click on 2D plot for slicer options", style=wx.ALIGN_LEFT)
-        self.bck.Add(title, (0,0), (1,2), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=15)
-        
-        # Bindings
-        self.parent.Bind(EVT_SLICER, self.onEVT_SLICER)
-        self.parent.Bind(EVT_SLICER_PARS, self.onParamChange)
-
-    def onEVT_SLICER(self, event):
-        """
-            Process EVT_SLICER events
-            When the slicer changes, update the panel
-            
-            @param event: EVT_SLICER event
-        """
-        event.Skip()
-        if event.obj_class==None:
-            self.set_slicer(None, None)
-        else:
-            self.set_slicer(event.type, event.params)
-        
-    def set_slicer(self, type, params):
-        """
-            Rebuild the panel
-        """
-        self.bck.Clear(True)  
-        self.type = type  
-        
-        if type==None:
-            title = wx.StaticText(self, -1, "Right-click on 2D plot for slicer options", style=wx.ALIGN_LEFT)
-            self.bck.Add(title, (0,0), (1,2), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=15)
-
-        else:
-            title = wx.StaticText(self, -1, "Slicer Parameters", style=wx.ALIGN_LEFT)
-            self.bck.Add(title, (0,0), (1,2), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=15)
-            ix = 0
-            iy = 0
-            self.parameters = []
-            #params = slicer.get_params()
-            keys = params.keys()
-            keys.sort()
-            
-            for item in keys:
-                iy += 1
-                ix = 0
-                text = wx.StaticText(self, -1, item, style=wx.ALIGN_LEFT)
-                #self.bck.Add(text, (iy,ix), flag = wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border = 15)
-                self.bck.Add(text, (iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-                ctl = wx.TextCtrl(self, -1, size=(80,20), style=wx.TE_PROCESS_ENTER)
-                
-                ctl.SetToolTipString("Modify the value of %s to change the 2D slicer" % item)
-                
-                ix = 1
-                ctl.SetValue(format_number(str(params[item])))
-                self.Bind(wx.EVT_TEXT_ENTER, self.onTextEnter)
-                ctl.Bind(wx.EVT_KILL_FOCUS, self.onTextEnter)
-                self.parameters.append([item, ctl])
-                #self.bck.Add(ctl, (iy,ix), flag=wx.TOP|wx.BOTTOM, border = 0)
-                self.bck.Add(ctl, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-                
-                ix =3
-                self.bck.Add((20,20), (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-            iy +=1
-            ix = 1
-            self.bck.Add((20,20),(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-        self.bck.Layout()
-        self.bck.Fit(self)
-        self.parent.GetSizer().Layout()
-
-    def onParamChange(self, evt):
-        evt.Skip()
-        if evt.type == "UPDATE":
-            for item in self.parameters:              
-                if item[0] in evt.params:
-                    item[1].SetValue("%-5.3g" %evt.params[item[0]])
-                    item[1].Refresh()
-        
-    def onTextEnter(self, evt): 
-        """
-            Parameters have changed
-        """ 
-        params = {}
-        has_error = False
-        for item in self.parameters:
-            try:
-                params[item[0]] = float(item[1].GetValue())
-                item[1].SetBackgroundColour(
-                        wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW))
-                item[1].Refresh()
-            except:
-                has_error = True
-                item[1].SetBackgroundColour("pink")
-                item[1].Refresh()
-
-        if has_error==False:
-            # Post parameter event
-            event = SlicerParameterEvent(type=self.type, params=params)
-            wx.PostEvent(self.parent, event)
-        
Index: guiframe/local_perspectives/plotting/boxSum.py
===================================================================
--- guiframe/local_perspectives/plotting/boxSum.py	(revision 9b05b2fc1bde8039c57495ffb29c0d4e6412c632)
+++ guiframe/local_perspectives/plotting/boxSum.py	(revision 92c2345cf1edfe8401d0b7ce54d43eec01e8ca56)
@@ -74,5 +74,5 @@
                       
         self.update()
-        #self._post_data()
+        self._post_data()
         
         # Bind to slice parameter events
@@ -84,5 +84,5 @@
         event.Skip()
         if event.type == self.__class__.__name__:
-            #self.set_params(event.params)
+            self.set_params(event.params)
             self.base.update()
 
@@ -180,9 +180,7 @@
         y_max= self.top_line.y
         box =  Boxavg (x_min=x_min, x_max=x_max, y_min=y_min, y_max=y_max)
-       
-        self.count, self.error= box(self.base.data2D)
-        
-        
-              
+        self.count, self.error = box(self.base.data2D)
+        print "count, error",self.count, self.error
+        
                                        
     def moveend(self, ev):
@@ -192,5 +190,7 @@
         event = SlicerParameters.SlicerParameterEvent()
         event.type = self.__class__.__name__
-        #event.params = self.get_params()
+        print "event type boxsum: ", event.type
+        event.params = self.get_params()
+        
         wx.PostEvent(self.base.parent, event)
 
@@ -209,5 +209,5 @@
         """
         print "in move"
-        if self.xmin <= x and x<= self.xmax:
+        if self.xmin <= x and x <= self.xmax:
             print "has move whole", x
         
@@ -221,25 +221,35 @@
         params["y_min"] = self.bottom_line.y
         params["y_max"] = self.top_line.y
-        params["count"] = self.count
-        params["error"] = self.error
-        params["center_x"] = self.center_x
-        params["center_y"] = self.center_y
+       
         return params
     
+    
+    def get_result(self):
+        """
+            return the result of box summation
+        """
+        result={}
+        result["count"] = self.count
+        result["error"] = self.error
+        return result
+        
+        
     def set_params(self, params):
         
-        x_min = params["x_min"] 
-        x_max = params["x_max"] 
-        y_min = params["y_min"]
-        y_max = params["y_max"] 
-        theta = params["theta"]
-        center_x = params["center_x"]
-        center_y = params["center_y"]
-        
+        x_min = -math.fabs(params["x_min"] )
+        x_max = math.fabs(params["x_max"] )
+        y_min = -math.fabs(params["y_min"])
+        y_max = math.fabs(params["y_max"]) 
+        
+        self.left_line.update(ymin= y_min ,ymax= y_max , x= x_min)
+        self.right_line.update(ymin= y_min ,ymax= y_max, x= x_max)
+        self.top_line.update( xmin= x_min ,xmax= x_max, y= y_max)
+        self.bottom_line.update(xmin= x_min ,xmax= x_max, y=y_min)
+        """
         self.left_line.update(mline= [center_x, center_y],ymin= y_min ,ymax= y_max)
         self.right_line.update(mline= [center_x, center_y],ymin= y_min ,ymax= y_max)
         self.top_line.update(mline= [center_x, center_y], xmin= x_min ,xmax= xmax)
         self.bottom_line.update(mline= [center_x, center_y],xmin= xmin ,xmax= xmax)
-        
+        """
         
         self._post_data()
@@ -363,4 +373,5 @@
         params["radius"] = self.xmin
         params["theta"] = self.xmax
+        
         return params
     
