Index: guiframe/local_perspectives/plotting/boxSum.py
===================================================================
--- guiframe/local_perspectives/plotting/boxSum.py	(revision 1f3655a09820a0d7ddfb8549f0b3ed9783b574ad)
+++ guiframe/local_perspectives/plotting/boxSum.py	(revision ee69839b77b16a9950ce412a8ee20c6ac528fb95)
@@ -27,5 +27,5 @@
         self.markers = []
         self.axes = axes
-        self.qmax = self.base.data2D.xmax
+        self.qmax = min(self.base.data2D.xmax, self.base.data2D.xmin)
         self.connect = self.base.connect
         self.xmin= -1* 0.5*min(math.fabs(self.base.data2D.xmax),math.fabs( self.base.data2D.xmin))
@@ -150,12 +150,12 @@
         data = self.base.data2D
         from DataLoader.manipulations import  Boxavg
-        radius = math.sqrt(math.pow(self.qmax,2)+math.pow(self.qmax,2))
-        x_min= self.vertical_lines.x2 
-        x_max= self.vertical_lines.x1 
+        #radius = math.sqrt(math.pow(self.qmax,2)+math.pow(self.qmax,2))
+        x_min= self.horizontal_lines.x2 
+        x_max= self.horizontal_lines.x1 
         y_min= self.vertical_lines.y2
         y_max= self.vertical_lines.y1
         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)
-        print "count, error",self.count, self.error
+        #print "count, error",self.count, self.error
                           
     def moveend(self, ev):
@@ -163,11 +163,5 @@
         # Post paramters
         self._post_data()
-        """
-        event = SlicerParameters.SlicerParameterEvent()
-        event.type = self.__class__.__name__
-        print "event type boxsum: ", event.type
-        event.params = self.get_params()
-        wx.PostEvent(self.base, event)
-        """
+       
         self.type= self.__class__.__name__
         params= self.get_params()
@@ -195,6 +189,6 @@
         params = {}
        
-        params["x"] = math.fabs(self.horizontal_lines.half_width)
-        params["y"] = math.fabs(self.vertical_lines.half_height) 
+        params["Width"] = math.fabs(self.vertical_lines.half_width)*2
+        params["Height"] = math.fabs(self.horizontal_lines.half_height)*2 
         
         params["center_x"] = self.center.x
@@ -218,10 +212,10 @@
     def set_params(self, params):
         
-        x_max = math.fabs(params["x"] )
-        y_max = math.fabs(params["y"] )
+        x_max = math.fabs(params["Width"] )/2
+        y_max = math.fabs(params["Height"] )/2
         
         self.center_x=params["center_x"] 
         self.center_y=params["center_y"]
-        
+        """
         self.center.update(center_x=self.center_x,center_y=self.center_y)
        
@@ -235,5 +229,5 @@
         self._post_data()
         
-        
+        """
         
     def freeze_axes(self):
@@ -410,6 +404,6 @@
         self.save_half_height= math.fabs(y)
         
-        self.half_width= math.fabs(x)
-        self.save_half_width=math.fabs(x)
+        self.half_width= math.fabs(self.x1- self.x2)/2
+        self.save_half_width=math.fabs(self.x1- self.x2)/2
         
         try:
@@ -470,4 +464,5 @@
         Draw the new roughness on the graph.
         """
+        print "self.half_height",self.half_height,self.half_width
         if width!=None:
             self.half_width= width
@@ -477,5 +472,5 @@
             self.center_x= center.x
             self.center_y= center.y
-            
+            print "vertical width",self.half_width ,self.center_x
             self.x1 = self.half_width + self.center_x
             self.x2= -self.half_width + self.center_x
@@ -516,5 +511,6 @@
         
         self.save_half_height= self.half_height
-        self.save_half_width =  self.half_width
+        #self.save_half_width = math.fabs(self.x1-self.x2)/2
+        self.save_half_width = self.half_width
         self.base.freeze_axes()
 
@@ -535,4 +531,5 @@
         
         self.half_height= self.save_half_height
+        #self.half_width= math.fabs(self.x1-self.x2)/2
         self.half_width= self.save_half_width
        
@@ -545,5 +542,6 @@
         self.x2= self.center_x - delta
         
-        self.half_width= math.fabs(self.x1)-self.center_x
+        self.half_width= math.fabs(self.x1-self.x2)/2
+        print "Move vert: vertical width",self.half_width ,self.center_x
         self.has_move=True
         self.base.base.update()
@@ -660,4 +658,5 @@
         Draw the new roughness on the graph.
         """
+        print "self.half_width",self.half_width
         if width!=None:
             self.half_width= width
