Index: guiframe/local_perspectives/plotting/AnnulusSlicer.py
===================================================================
--- guiframe/local_perspectives/plotting/AnnulusSlicer.py	(revision 6d920cd2a2b96abc4845a5766911d8ef7fe5adc5)
+++ guiframe/local_perspectives/plotting/AnnulusSlicer.py	(revision eba08f1a43992e4ce1b52d3a3dd206926fdeb56a)
@@ -16,5 +16,8 @@
 class AnnulusInteractor(_BaseInteractor):
     """
-         Select an annulus through a 2D plot
+         Select an annulus through a 2D plot.
+         This interactor is used to average 2D data  with the region 
+         defined by 2 radius.
+         this class is defined by 2 Ringinterators.
     """
     def __init__(self,base,axes,color='black', zorder=3):
@@ -26,6 +29,5 @@
         self.qmax = min(math.fabs(self.base.data2D.xmax),math.fabs(self.base.data2D.xmin))  #must be positive
         self.connect = self.base.connect
-        
-
+    
         ## Number of points on the plot
         self.nbins = 20
@@ -35,6 +37,4 @@
         self.xmind=self.base.data2D.xmin
 
-        #self.sign=1
-        
         if (self.xmaxd+self.xmind)>0:
             self.sign=1
@@ -57,4 +57,9 @@
 
     def _onEVT_SLICER_PARS(self, event):
+        """
+            receive an event containing parameters values to reset the slicer
+            @param event: event of type SlicerParameterEvent with params as 
+            attribute
+        """
         wx.PostEvent(self.base, StatusEvent(status="AnnulusSlicer._onEVT_SLICER_PARS"))
         event.Skip()
@@ -63,34 +68,27 @@
             self.base.update()
 
-    def update_and_post(self):
-        self.update()
-        self._post_data()
-
-    def save_data(self, path, image, x, y):
-        output = open(path, 'w')
-        
-        data_x, data_y = self.get_data(image, x, y)
-        
-        output.write("<phi>  <average>\n")
-        for i in range(len(data_x)):
-            output.write("%g  %g\n" % (data_x[i], data_y[i]))
-        output.close()
-
     def set_layer(self, n):
+        """
+             Allow adding plot to the same panel
+             @param n: the number of layer
+        """
         self.layernum = n
         self.update()
         
     def clear(self):
+        """
+            Clear the slicer and all connected events related to this slicer
+        """
         self.clear_markers()
         self.outer_circle.clear()
         self.inner_circle.clear()
         self.base.connect.clearall()
-      
         self.base.Unbind(EVT_SLICER_PARS)
         
+        
     def update(self):
         """
-        Respond to changes in the model by recalculating the profiles and
-        resetting the widgets.
+            Respond to changes in the model by recalculating the profiles and
+            resetting the widgets.
         """
         # Update locations        
@@ -98,10 +96,9 @@
         self.outer_circle.update()
         
-  
 
     def save(self, ev):
         """
-        Remember the roughness for this layer and the next so that we
-        can restore on Esc.
+            Remember the roughness for this layer and the next so that we
+            can restore on Esc.
         """
         self.base.freeze_axes()
@@ -110,5 +107,9 @@
 
     def _post_data(self,nbins=None):
-         # Compute data
+        """
+            Uses annulus parameters to plot averaged data into 1D data.
+            @param nbins: the number of points to plot 
+        """
+        #Data to average
         data = self.base.data2D
         # If we have no data, just return
@@ -117,16 +118,18 @@
         
         from DataLoader.manipulations import SectorPhi
-        #radius = self.qmax#math.sqrt(math.pow(self.qmax,2)+math.pow(self.qmax,2))
+    
         rmin= min(math.fabs(self.inner_circle.get_radius()),
                   math.fabs(self.outer_circle.get_radius()))
         rmax = max(math.fabs(self.inner_circle.get_radius()),
                    math.fabs(self.outer_circle.get_radius()))
-        #print "rmin, rmax", rmin, rmax
+        #if the user does not specify the numbers of points to plot 
+        # the default number will be nbins= 20
         if nbins==None:
-            nbins = 20
+            self.nbins= 20
+        else:
+            self.nbins = nbins
+        ## create the data1D Q average of data2D    
         sect = SectorPhi(r_min=rmin , r_max= rmax,
-                          phi_min=0, phi_max=2*math.pi , nbins=nbins)
-        
-        
+                          phi_min=0, phi_max=2*math.pi , nbins=self.nbins)
         sector = sect(self.base.data2D)
         
@@ -144,10 +147,8 @@
         new_plot.name = "SectorPhi" +"("+ self.base.data2D.name+")"
         
-       
-        
         new_plot.source=self.base.data2D.source
         #new_plot.info=self.base.data2D.info
+        
         new_plot.interactive = True
-        #print "loader output.detector",output.source
         new_plot.detector =self.base.data2D.detector
         # If the data file does not tell us what the axes are, just assume...
@@ -162,15 +163,18 @@
         
          
-        
-        
     def moveend(self, ev):
+        """
+            Called when any dragging motion ends.
+            Post an event (type =SlicerParameterEvent)
+            to plotter 2D with a copy  slicer parameters
+            Call  _post_data method
+        """
         self.base.thaw_axes()
-        
-        # Post paramters
+        # Post parameters to plotter 2D
         event = SlicerParameterEvent()
         event.type = self.__class__.__name__
         event.params = self.get_params()
-        #wx.PostEvent(self.base.parent, event)
         wx.PostEvent(self.base, event)
+        # create a 1D data plot
         self._post_data()
             
@@ -192,4 +196,8 @@
         
     def get_params(self):
+        """
+            Store a copy of values of parameters of the slicer into a dictionary.
+            @return params: the dictionary created
+        """
         params = {}
         params["inner_radius"] = math.fabs(self.inner_circle._inner_mouse_x)
@@ -199,10 +207,17 @@
     
     def set_params(self, params):
-        
+        """
+            Receive a dictionary and reset the slicer with values contained 
+            in the values of the dictionary.
+            @param params: a dictionary containing name of slicer parameters and 
+            values the user assigned to the slicer.
+        """
         inner = math.fabs(params["inner_radius"] )
         outer = math.fabs(params["outer_radius"] )
         self.nbins = int(params["nbins"])
+        ## Update the picture
         self.inner_circle.set_cursor(inner, self.inner_circle._inner_mouse_y)
         self.outer_circle.set_cursor(outer, self.outer_circle._inner_mouse_y)
+        ## Post the data given the nbins entered by the user 
         self._post_data(self.nbins)
         
@@ -219,5 +234,8 @@
 class RingInteractor(_BaseInteractor):
     """
-         Select an annulus through a 2D plot
+         Draw a ring Given a radius 
+         @param: the color of the line that defined the ring
+         @param r: the radius of the ring
+         @param sign: the direction of motion the the marker 
     """
     def __init__(self,base,axes,color='black', zorder=5, r=1.0,sign=1):
@@ -226,15 +244,17 @@
         self.markers = []
         self.axes = axes
+        # Current radius of the ring
         self._inner_mouse_x = r
+        #Value of the center of the ring
         self._inner_mouse_y = 0
+        # previous value of that radius
         self._inner_save_x  = r
+        #Save value of the center of the ring
         self._inner_save_y  = 0
-        self.scale = 10.0
+        #Class instantiating RingIterator class
         self.base= base
+        #the direction of the motion of the marker
         self.sign=sign
-         
-        
-        #print "sign",self.sign,self.sign*math.fabs(self._inner_mouse_x)
-                                                    
+        ## Create a marker 
         try:
             # Inner circle marker
@@ -254,12 +274,12 @@
             message += "Get the SVN version that is at least as recent as June 1, 2007"
             
-            #raise "Version error", message
-            
-        # Inner circle
-
-           
+            owner=self.base.base.parent
+            wx.PostEvent(owner, StatusEvent(status="AnnulusSlicer: %s"%message))
+            
+        # Draw a circle 
         [self.inner_circle] = self.axes.plot([],[],
                                       linestyle='-', marker='',
                                       color=self.color)
+        # the number of points that make the ring line
         self.npts = 40
             
@@ -268,8 +288,15 @@
 
     def set_layer(self, n):
+        """
+             Allow adding plot to the same panel
+             @param n: the number of layer
+        """
         self.layernum = n
         self.update()
         
     def clear(self):
+        """
+            Clear the slicer and all connected events related to this slicer
+        """
         self.clear_markers()
         try:
@@ -284,9 +311,12 @@
         
     def get_radius(self):
+        """
+            @return self._inner_mouse_x: the current radius of the ring
+        """
         return self._inner_mouse_x
         
     def update(self):
         """
-        Draw the new roughness on the graph.
+            Draw the new roughness on the graph.
         """
         # Plot inner circle
@@ -315,4 +345,7 @@
 
     def moveend(self, ev):
+        """
+            Called after a dragging motion
+        """
         self.base.moveend(ev)
             
@@ -333,4 +366,7 @@
         
     def set_cursor(self, x, y):
+        """
+            draw the ring given x, y value 
+        """
         self.move(x, y, None)
         self.update()
@@ -338,4 +374,8 @@
         
     def get_params(self):
+        """
+            Store a copy of values of parameters of the slicer into a dictionary.
+            @return params: the dictionary created
+        """
         params = {}
         params["radius"] = math.fabs(self._inner_mouse_x)
@@ -343,5 +383,10 @@
     
     def set_params(self, params):
-
+        """
+            Receive a dictionary and reset the slicer with values contained 
+            in the values of the dictionary.
+            @param params: a dictionary containing name of slicer parameters and 
+            values the user assigned to the slicer.
+        """
         x = params["radius"] 
         self.set_cursor(x, self._inner_mouse_y)
