Index: plottools/src/danse/common/plottools/BaseInteractor.py
===================================================================
--- plottools/src/danse/common/plottools/BaseInteractor.py	(revision 82a54b89c2fb14de05cf41239d597f5e7cb6df9b)
+++ plottools/src/danse/common/plottools/BaseInteractor.py	(revision 10bfeb307197dbe02c1ab9ca2e868b076c0cd128)
@@ -22,5 +22,5 @@
         update() - draw the interactors
         
-    The following are provided by the base class: 
+    The following are provided by the base class:
     
         connect_markers(markers) - register callbacks for all markers
@@ -53,6 +53,8 @@
         Clear old markers and interfaces.
         '''
-        for h in self.markers: h.remove()
-        if self.markers: self.base.connect.clear(*self.markers)
+        for h in self.markers:
+            h.remove()
+        if self.markers:
+            self.base.connect.clear(*self.markers)
         self.markers = []
 
@@ -127,5 +129,5 @@
         the mouse leaves the window.
         """
-        inside, prop = self.axes.contains(ev)
+        inside, _ = self.axes.contains(ev)
         if inside:
             self.clickx, self.clicky = ev.xdata, ev.ydata
@@ -147,8 +149,12 @@
         elif ev.key in ['up', 'down', 'right', 'left']:
             dx, dy = self.dpixel(self.clickx, self.clicky, nudge=ev.control)
-            if ev.key == 'up': self.clicky += dy
-            elif ev.key == 'down': self.clicky -= dy
-            elif ev.key == 'right': self.clickx += dx
-            else: self.clickx -= dx
+            if ev.key == 'up':
+                self.clicky += dy
+            elif ev.key == 'down':
+                self.clicky -= dy
+            elif ev.key == 'right':
+                self.clickx += dx
+            else:
+                self.clickx -= dx
             self.move(self.clickx, self.clicky, ev)
         else:
@@ -172,3 +178,2 @@
         dx, dy = nx-x, ny-y
         return dx, dy
-
Index: plottools/src/danse/common/plottools/LabelDialog.py
===================================================================
--- plottools/src/danse/common/plottools/LabelDialog.py	(revision 82a54b89c2fb14de05cf41239d597f5e7cb6df9b)
+++ plottools/src/danse/common/plottools/LabelDialog.py	(revision 10bfeb307197dbe02c1ab9ca2e868b076c0cd128)
Index: plottools/src/danse/common/plottools/PlotPanel.py
===================================================================
--- plottools/src/danse/common/plottools/PlotPanel.py	(revision 6e75ed00993b61a2a3512eed9133a3721ced22b5)
+++ plottools/src/danse/common/plottools/PlotPanel.py	(revision 10bfeb307197dbe02c1ab9ca2e868b076c0cd128)
@@ -13,16 +13,9 @@
 from matplotlib.figure import Figure
 import os
-import fittings
 import transform
-from matplotlib.widgets import RectangleSelector
-from pylab import  gca, gcf
 from plottables import Data1D
 #TODO: make the plottables interactive
 from binder import BindArtist
 from matplotlib.font_manager import FontProperties
-
-#from matplotlib import cm
-#from matplotlib.ticker import LinearLocator, FixedLocator, FormatStrFormatter
-
 DEBUG = False
 
@@ -33,10 +26,12 @@
 import operator
 
-import math, pylab, re
+import math
+import pylab
 DEFAULT_CMAP = pylab.cm.jet
 import copy
 import numpy
 
-def show_tree(obj,d=0):
+
+def show_tree(obj, d=0):
     """Handy function for displaying a tree of graph objects"""
     print "%s%s" % ("-"*d, obj.__class__.__name__)
@@ -44,5 +39,6 @@
         for a in obj.get_children(): show_tree(a, d+1)
      
-from unitConverter import UnitConvertion as convertUnit   
+from unitConverter import UnitConvertion as convertUnit
+
 
 def _rescale(lo, hi, step, pt=None, bal=None, scale='linear'):
@@ -60,12 +56,12 @@
         loprev = lo
         hiprev = hi
-        ptprev = pt
         if scale == 'log':
             assert lo > 0
-            if lo > 0 :
+            if lo > 0:
                 lo = math.log10(lo)
-            if hi > 0 :
+            if hi > 0:
                 hi = math.log10(hi)
-            if pt is not None: pt = math.log10(pt)
+            if pt is not None:
+                pt = math.log10(pt)
         
         # Compute delta from axis range * %, or 1-% if persent is negative
@@ -94,16 +90,15 @@
 
 def CopyImage(canvas):
-     """
-     0: matplotlib plot
-     1: wx.lib.plot
-     2: other
-     
-     """
-     bmp = wx.BitmapDataObject()
-     bmp.SetBitmap(canvas.bitmap)
-
-     wx.TheClipboard.Open()
-     wx.TheClipboard.SetData(bmp)
-     wx.TheClipboard.Close()
+    """
+    0: matplotlib plot
+    1: wx.lib.plot
+    2: other
+    """
+    bmp = wx.BitmapDataObject()
+    bmp.SetBitmap(canvas.bitmap)
+    
+    wx.TheClipboard.Open()
+    wx.TheClipboard.SetData(bmp)
+    wx.TheClipboard.Close()
 
 
@@ -116,5 +111,5 @@
     """
     def __init__(self, parent, id=-1, xtransform=None,
-                  ytransform=None, scale='log_{10}', 
+                  ytransform=None, scale='log_{10}',
                   color=None, dpi=None, **kwargs):
         """
@@ -123,16 +118,16 @@
         self.parent = parent
         self.dimension = 1
-        self.gotLegend = 0  #to begin, legend is not picked. 
+        self.gotLegend = 0  # to begin, legend is not picked.
         self.legend_pos_loc = None
         self.legend = None
-        self.line_collections_list = [] 
+        self.line_collections_list = []
         self.figure = Figure(None, dpi, linewidth=2.0)
-        self.color = '#b3b3b3'  
+        self.color = '#b3b3b3'
         from canvas import FigureCanvas
-        self.canvas = FigureCanvas(self, -1, self.figure) 
+        self.canvas = FigureCanvas(self, -1, self.figure)
         self.SetColor(color)
         #self.SetBackgroundColour(parent.GetBackgroundColour())
         self._resizeflag = True
-        self._SetSize() 
+        self._SetSize()
         self.subplot = self.figure.add_subplot(111)
         self.figure.subplots_adjust(left=0.2, bottom=.2)
@@ -171,5 +166,5 @@
         if xtransform != None:
             self.xLabel = xtransform
-        else:   
+        else:
             self.xLabel = "log10(x)"
         if ytransform != None:
@@ -203,5 +198,5 @@
         #self.selected_plottable = None
         
-        # new data for the fit 
+        # new data for the fit
         self.fit_result = Data1D(x=[], y=[], dy=None)
         self.fit_result.symbol = 13
@@ -239,5 +234,5 @@
         self.zmax_2D = None
         
-        #index array 
+        #index array
         self.index_x = None
         self.index_y = None
@@ -275,9 +270,9 @@
         
         # Default locations
-        self._default_save_location = os.getcwd()    
+        self._default_save_location = os.getcwd()
         # let canvas know about axes
         self.canvas.set_panel(self)
         
-        #Bind focus to change the border color      
+        #Bind focus to change the border color
         self.canvas.Bind(wx.EVT_SET_FOCUS, self.on_set_focus)
         self.canvas.Bind(wx.EVT_KILL_FOCUS, self.on_kill_focus)
@@ -288,6 +283,6 @@
         pixels = self.parent.GetClientSize()
         self.canvas.SetSize(pixels)
-        self.figure.set_size_inches( (pixels[0])/self.figure.get_dpi(),
-         (pixels[1])/self.figure.get_dpi(), forward=True )   
+        self.figure.set_size_inches(pixels[0] / self.figure.get_dpi(),
+         pixels[1] / self.figure.get_dpi(), forward=True)
           
     def On_Paint(self, event):
@@ -295,10 +290,5 @@
         """
         self.canvas.SetBackgroundColour(self.color)
-        #dc = wx.PaintDC(self.canvas)
-        #dc.SetPen(wx.Pen(self.color))
-        #x, y = self.GetSize()
-        #dc.DrawRectangle(0, 0, x, y)
-        #dc.DrawRectangle(1, 1, x-1, y-1)
-        #self.draw()
+
     def on_set_focus(self, event):
         """
@@ -323,11 +313,11 @@
         Set the resizing (True/False)
         """
-        pass # Not implemented
+        pass  # Not implemented
     
-    def schedule_full_draw(self, func='append'):    
+    def schedule_full_draw(self, func='append'):
         """
         Put self in schedule to full redraw list
         """
-        pass # Not implemented
+        pass  # Not implemented
     
     def add_toolbar(self):
@@ -359,5 +349,5 @@
         self.toolbar.update()
         
-    def onLeftDown(self, event): 
+    def onLeftDown(self, event):
         """
         left button down and ready to drag
@@ -371,27 +361,24 @@
                 self.xInit, self.yInit = event.xdata, event.ydata
                 try:
-                    pos_x = float(event.xdata)# / size_x
-                    pos_y = float(event.ydata)# / size_y
-                    pos_x = "%8.3g"% pos_x
-                    pos_y = "%8.3g"% pos_y
+                    pos_x = float(event.xdata)  # / size_x
+                    pos_y = float(event.ydata)  # / size_y
+                    pos_x = "%8.3g" % pos_x
+                    pos_y = "%8.3g" % pos_y
                     self.position = str(pos_x), str(pos_y)
                     wx.PostEvent(self.parent, StatusEvent(status=self.position))
                 except:
-                    self.position = None  
-        #size_x, size_y =  self.GetClientSizeTuple()
-
-     
-    def onLeftUp(self, event): 
+                    self.position = None
+
+    def onLeftUp(self, event):
         """
         Dragging is done
-        
         """
         # Check that the LEFT button was released
         if event.button == 1:
             self.leftdown = False
-            self.mousemotion = False 
+            self.mousemotion = False
             self.leftup = True
             
-        #release the legend    
+        #release the legend
         if self.gotLegend == 1:
             self.gotLegend = 0
@@ -405,5 +392,5 @@
             self.legend.legendPatch.set_alpha(alpha)
         
-    def onPick(self, event):    
+    def onPick(self, event):
         """
         On pick legend
@@ -412,17 +399,16 @@
         if event.artist == legend:
             #gets the box of the legend.
-            bbox = self.legend.get_window_extent()  
+            bbox = self.legend.get_window_extent()
             #get mouse coordinates at time of pick.
-            self.mouse_x = event.mouseevent.x  
+            self.mouse_x = event.mouseevent.x
             self.mouse_y = event.mouseevent.y
             #get legend coordinates at time of pick.
-            self.legend_x = bbox.xmin          
+            self.legend_x = bbox.xmin
             self.legend_y = bbox.ymin
             #indicates we picked up the legend.
-            self.gotLegend = 1   
+            self.gotLegend = 1
             self.set_legend_alpha(0.5)
-  
-            
-    def _on_legend_motion(self, event): 
+    
+    def _on_legend_motion(self, event):
         """
         On legend in motion
@@ -435,5 +421,5 @@
         lo_y, hi_y = ax.get_ylim()
         # How much the mouse moved.
-        x = mouse_diff_x = self.mouse_x - event.x  
+        x = mouse_diff_x = self.mouse_x - event.x
         y = mouse_diff_y = self.mouse_y - event.y
         # Put back inside
@@ -444,5 +430,5 @@
         if y < lo_y:
             y = lo_y
-        if y> hi_y:
+        if y > hi_y:
             y = hi_y
         # Move the legend from its previous location by that same amount
@@ -456,10 +442,10 @@
         self.resizing = True
         self.canvas.set_resizing(self.resizing)
-        self.canvas.draw() 
+        self.canvas.draw()
            
-    def onMouseMotion(self, event): 
+    def onMouseMotion(self, event):
         """
         check if the left button is press and the mouse in moving.
-        computer delta for x and y coordinates and then calls draghelper 
+        computer delta for x and y coordinates and then calls draghelper
         to perform the drag
         
@@ -471,8 +457,8 @@
             #Disable dragging without the toolbar to allow zooming with toolbar
             return
-        self.mousemotion = True 
+        self.mousemotion = True
         if self.leftdown == True and self.mousemotion == True:
             ax = event.inaxes
-            if ax != None:#the dragging is perform inside the figure
+            if ax != None:  # the dragging is perform inside the figure
                 self.xFinal, self.yFinal = event.xdata, event.ydata
                 # Check whether this is the first point
@@ -489,12 +475,10 @@
                     ydelta = math.log10(self.yFinal) - math.log10(self.yInit)
                 self._dragHelper(xdelta, ydelta)
-            else:# no dragging is perform elsewhere
-                self._dragHelper(0,0)
-
-                
+            else:  # no dragging is perform elsewhere
+                self._dragHelper(0, 0)
+
     def _offset_graph(self):
         """
-        Zoom and offset the graph to the last known settings 
-        
+        Zoom and offset the graph to the last known settings
         """
         for ax in self.axes:
@@ -580,5 +564,5 @@
             # Event occurred inside a plotting area
             lo, hi = ax.get_xlim()
-            lo, hi = _rescale(lo, hi, step, 
+            lo, hi = _rescale(lo, hi, step,
                              pt=event.xdata, scale=ax.get_xscale())
             if not self.xscale == 'log' or lo > 0:
@@ -593,5 +577,5 @@
                 self._scale_ylo = lo
                 self._scale_yhi = hi
-                ax.set_ylim((lo,hi))
+                ax.set_ylim((lo, hi))
         else:
             # Check if zoom happens in the axes
@@ -602,13 +586,11 @@
                 insidex, _ = ax.xaxis.contains(event)
                 if insidex:
-                    xdata, _ = ax.transAxes.inverted().transform_point((x, y)) 
-                    #xdata,_ = ax.transAxes.inverse_xy_tup((x,y))
+                    xdata, _ = ax.transAxes.inverted().transform_point((x, y))
                 insidey, _ = ax.yaxis.contains(event)
                 if insidey:
-                    _, ydata = ax.transAxes.inverted().transform_point((x, y)) 
-                    #_,ydata = ax.transAxes.inverse_xy_tup((x,y))
+                    _, ydata = ax.transAxes.inverted().transform_point((x, y))
             if xdata is not None:
                 lo, hi = ax.get_xlim()
-                lo, hi = _rescale(lo, hi, step, 
+                lo, hi = _rescale(lo, hi, step,
                                   bal=xdata, scale=ax.get_xscale())
                 if not self.xscale == 'log' or lo > 0:
@@ -618,7 +600,7 @@
             if ydata is not None:
                 lo, hi = ax.get_ylim()
-                lo, hi = _rescale(lo, hi, step, bal=ydata, 
+                lo, hi = _rescale(lo, hi, step, bal=ydata,
                                   scale=ax.get_yscale())
-                if not self.yscale=='log' or lo>0:
+                if not self.yscale == 'log' or lo > 0:
                     self._scale_ylo = lo
                     self._scale_yhi = hi
@@ -630,8 +612,8 @@
         Return values and labels used by Fit Dialog
         """
-        return self.xLabel,self.yLabel, self.Avalue, self.Bvalue,\
+        return self.xLabel, self.yLabel, self.Avalue, self.Bvalue,\
                 self.ErrAvalue, self.ErrBvalue, self.Chivalue
     
-    def setTrans(self, xtrans, ytrans): 
+    def setTrans(self, xtrans, ytrans):
         """
         
@@ -643,5 +625,5 @@
         self.prevYtrans = ytrans
    
-    def onFitting(self, event): 
+    def onFitting(self, event):
         """
         when clicking on linear Fit on context menu , display Fitting Dialog
@@ -660,16 +642,16 @@
         from fitDialog import LinearFit
         
-        if len(list.keys())>0:
+        if len(list.keys()) > 0:
             first_item = list.keys()[0]
-            dlg = LinearFit(parent=None, plottable=first_item, 
+            dlg = LinearFit(parent=None, plottable=first_item,
                             push_data=self.onFitDisplay,
-                            transform=self.returnTrans, 
+                            transform=self.returnTrans,
                             title='Linear Fit')
            
             if (self.xmin != 0.0)and (self.xmax != 0.0)\
                 and(self.xminView != 0.0)and (self.xmaxView != 0.0):
-                dlg.setFitRange(self.xminView, self.xmaxView, 
+                dlg.setFitRange(self.xminView, self.xmaxView,
                                 self.xmin, self.xmax)
-            dlg.ShowModal() 
+            dlg.ShowModal()
             
     def set_selected_from_menu(self, menu, id):
@@ -688,7 +670,7 @@
                 break
             
-    def linear_plottable_fit(self, plot): 
-        """
-            when clicking on linear Fit on context menu , display Fitting Dialog
+    def linear_plottable_fit(self, plot):
+        """
+            when clicking on linear Fit on context menu, display Fitting Dialog
             
             :param plot: PlotPanel owning the graph
@@ -706,5 +688,5 @@
         self._fit_dialog.register_close(self._linear_fit_close)
         # Show a non-model dialog
-        self._fit_dialog.Show() 
+        self._fit_dialog.Show()
 
     def _linear_fit_close(self):
@@ -714,10 +696,9 @@
         self._fit_dialog = None
         
-
     def _onProperties(self, event):
         """
         when clicking on Properties on context menu ,
         The Property dialog is displayed
-        The user selects a transformation for x or y value and 
+        The user selects a transformation for x or y value and
         a new plot is displayed
         """
@@ -734,5 +715,5 @@
                 dial.setValues(self.prevXtrans, self.prevYtrans, self.viewModel)
                 if dial.ShowModal() == wx.ID_OK:
-                    self.xLabel, self.yLabel,self.viewModel = dial.getValues()
+                    self.xLabel, self.yLabel, self.viewModel = dial.getValues()
                     if self.viewModel == "Guinier lny vs x^(2)":
                         self.xLabel = "x^(2)"
@@ -809,5 +790,5 @@
             self.draw()
 
-    def _SetSize(self, pixels = None):
+    def _SetSize(self, pixels=None):
         """
         This method can be called to force the Plot to be a desired size,
@@ -818,6 +799,6 @@
             pixels = tuple(self.GetClientSize())
         self.canvas.SetSize(pixels)
-        self.figure.set_size_inches( float( pixels[0] )/self.figure.get_dpi(),
-                                     float( pixels[1] )/self.figure.get_dpi() ) 
+        self.figure.set_size_inches(float(pixels[0]) / self.figure.get_dpi(),
+                                    float(pixels[1]) / self.figure.get_dpi())
 
     def draw(self):
@@ -828,8 +809,9 @@
         self.figure.canvas.draw_idle()
         
-       
-    #pick up the legend patch
     def legend_picker(self, legend, event):
-        return self.legend.legendPatch.contains(event)      
+        """
+            Pick up the legend patch
+        """
+        return self.legend.legendPatch.contains(event)
         
     def get_loc_label(self):
@@ -880,9 +862,9 @@
         
         id = wx.NewId()
-        slicerpop.Append(id,'&Printer setup', 'Set image size')
+        slicerpop.Append(id, '&Printer setup', 'Set image size')
         wx.EVT_MENU(self, id, self.onPrinterSetup)
         
         id = wx.NewId()
-        slicerpop.Append(id,'&Printer Preview', 'Set image size')
+        slicerpop.Append(id, '&Printer Preview', 'Set image size')
         wx.EVT_MENU(self, id, self.onPrinterPreview)
     
@@ -968,12 +950,12 @@
             handles2, labels2 = zip(*hl)
             self.line_collections_list = handles2
-            self.legend = self.subplot.legend(handles2, labels2, 
+            self.legend = self.subplot.legend(handles2, labels2,
                                 prop=FontProperties(size=10), numpoints=1,
                                 handletextsep=.05, loc=self.legendLoc)
             if self.legend != None:
-                self.legend.set_picker(self.legend_picker) 
-                self.legend.set_axes(self.subplot) 
-        
-        self.subplot.figure.canvas.draw_idle()       
+                self.legend.set_picker(self.legend_picker)
+                self.legend.set_axes(self.subplot)
+        
+        self.subplot.figure.canvas.draw_idle()
         self.legend_on = not self.legend_on
     
@@ -984,5 +966,5 @@
         menu = event.GetEventObject()
         id = event.GetId()
-        label =  menu.GetLabel(id)
+        label = menu.GetLabel(id)
         
         self.legendLoc = label
@@ -994,12 +976,11 @@
         handles2, labels2 = zip(*hl)
         self.line_collections_list = handles2
-        self.legend = self.subplot.legend(handles2, labels2, 
-                            prop=FontProperties(size=10),  numpoints=1,
+        self.legend = self.subplot.legend(handles2, labels2,
+                            prop=FontProperties(size=10), numpoints=1,
                             handletextsep=.05, loc=self.legendLoc)
         if self.legend != None:
-                self.legend.set_picker(self.legend_picker) 
-                self.legend.set_axes(self.subplot) 
-        self.subplot.figure.canvas.draw_idle()  
-        #self._onEVT_FUNC_PROPERTY()
+                self.legend.set_picker(self.legend_picker)
+                self.legend.set_axes(self.subplot)
+        self.subplot.figure.canvas.draw_idle()
         
     def remove_legend(self, ax=None):
@@ -1007,11 +988,10 @@
         Remove legend for ax or the current axes.
         """
-        from pylab import gca, draw
+        from pylab import gca
         if ax is None:
             ax = gca()
         ax.legend_ = None
-        #draw()
-        
-    def _on_addtext(self, event): 
+        
+    def _on_addtext(self, event):
         """
         Allows you to add text to the plot
@@ -1038,13 +1018,13 @@
                 colour = textdial.getColor()
                 if len(label) > 0 and xpos > 0 and ypos > 0:
-                    new_text = self.subplot.text(str(xpos), str(ypos), label, 
+                    new_text = self.subplot.text(str(xpos), str(ypos), label,
                                                    fontproperties=font,
                                                    color=colour)
                     self.textList.append(new_text)
-                    self.subplot.figure.canvas.draw_idle()  
+                    self.subplot.figure.canvas.draw_idle()
             except:
                 if self.parent != None:
                     from sans.guiframe.events import StatusEvent 
-                    msg= "Add Text: Error. Check your property values..."
+                    msg = "Add Text: Error. Check your property values..."
                     wx.PostEvent(self.parent, StatusEvent(status = msg ))
                 else:
@@ -1055,5 +1035,5 @@
         #based on this and plot it at user designated coordinates
 
-    def onGridOnOff(self, event): 
+    def onGridOnOff(self, event):
         """
         Allows ON/OFF Grid
@@ -1065,5 +1045,5 @@
         self.subplot.figure.canvas.draw_idle()
         
-    def _on_xaxis_label(self, event): 
+    def _on_xaxis_label(self, event):
         """
         Allows you to add text to the plot
@@ -1090,5 +1070,5 @@
             self._check_zoom_plot()
     
-    def _check_zoom_plot(self): 
+    def _check_zoom_plot(self):
         """
         Check the zoom range and plot (1D only)
@@ -1102,8 +1082,8 @@
         if self.is_zoomed or toolbar_zoomed:
             # Recover the x,y limits
-            self.subplot.set_xlim((xlo, xhi))     
-            self.subplot.set_ylim((ylo, yhi)) 
+            self.subplot.set_xlim((xlo, xhi))
+            self.subplot.set_ylim((ylo, yhi))
                    
-    def _on_yaxis_label(self, event): 
+    def _on_yaxis_label(self, event):
         """
         Allows you to add text to the plot
@@ -1130,5 +1110,4 @@
             self._check_zoom_plot()
             
-        
     def _on_axis_label(self, axis='x'):
         """
@@ -1138,5 +1117,5 @@
         """
         is_ok = True
-        title = 'Modify %s axis label'% axis
+        title = 'Modify %s axis label' % axis
         font = 'serif'
         colour = 'black'
@@ -1147,5 +1126,5 @@
             label = self.yaxis_label
             unit = self.yaxis_unit
-        textdial = TextDialog(None, -1, title, label, unit) 
+        textdial = TextDialog(None, -1, title, label, unit)
         if textdial.ShowModal() == wx.ID_OK:
             try:
@@ -1160,17 +1139,17 @@
                 is_tick = textdial.getTickLabel()
                 label_temp = textdial.getText()
-                if label_temp.count("\%s"% "\\") > 0:
+                if label_temp.count("\%s" % "\\") > 0:
                     if self.parent != None:
                         from sans.guiframe.events import StatusEvent 
-                        msg= "Add Label: Error. Can not use double '\\' "
+                        msg = "Add Label: Error. Can not use double '\\' "
                         msg += "characters..."
-                        wx.PostEvent(self.parent, StatusEvent(status = msg ))
+                        wx.PostEvent(self.parent, StatusEvent(status=msg))
                 else:
                     label = label_temp
             except:
                 if self.parent != None:
-                    from sans.guiframe.events import StatusEvent 
-                    msg= "Add Label: Error. Check your property values..."
-                    wx.PostEvent(self.parent, StatusEvent(status = msg ))
+                    from sans.guiframe.events import StatusEvent
+                    msg = "Add Label: Error. Check your property values..."
+                    wx.PostEvent(self.parent, StatusEvent(status=msg))
                 else:
                     pass
@@ -1189,7 +1168,7 @@
         if num_text < 1:
             if self.parent != None:
-                from sans.guiframe.events import StatusEvent 
+                from sans.guiframe.events import StatusEvent
                 msg= "Remove Text: Nothing to remove.  "
-                wx.PostEvent(self.parent, StatusEvent(status = msg ))
+                wx.PostEvent(self.parent, StatusEvent(status=msg))
             else:
                 raise
@@ -1200,17 +1179,17 @@
             txt.remove()
             if self.parent != None:
-                from sans.guiframe.events import StatusEvent 
+                from sans.guiframe.events import StatusEvent
                 msg= "Removed Text: '%s'. " % text_remove
-                wx.PostEvent(self.parent, StatusEvent(status = msg ))
+                wx.PostEvent(self.parent, StatusEvent(status=msg))
         except:
             if self.parent != None:
-                from sans.guiframe.events import StatusEvent 
+                from sans.guiframe.events import StatusEvent
                 msg= "Remove Text: Error occurred. "
-                wx.PostEvent(self.parent, StatusEvent(status = msg ))
+                wx.PostEvent(self.parent, StatusEvent(status=msg))
             else:
                 raise
         self.textList.remove(txt)
             
-        self.subplot.figure.canvas.draw_idle() 
+        self.subplot.figure.canvas.draw_idle()
 
     def properties(self, prop):
@@ -1220,5 +1199,5 @@
         
         """
-        # The particulars of how they are stored and manipulated (e.g., do 
+        # The particulars of how they are stored and manipulated (e.g., do
         # we want an inventory internally) is not settled.  I've used a
         # property dictionary for now.
@@ -1231,7 +1210,4 @@
         self.subplot.set_ylabel(r"$%s$" % prop["ylabel"])
         self.subplot.set_title(prop["title"])
-
-        # Properties defined by user
-        #self.axes.grid(True)
 
     def clear(self):
@@ -1245,5 +1221,5 @@
         """Commit the plot after all objects are drawn"""
         # TODO: this is when the backing store should be swapped in.
-        if self.legend_on:          
+        if self.legend_on:
             ax = self.subplot
             ax.texts = self.textList
@@ -1255,14 +1231,15 @@
                 handles2, labels2 = zip(*hl)
                 self.line_collections_list = handles2
-                self.legend = ax.legend(handles2, labels2,  numpoints=1,
-                                prop=FontProperties(size=10), 
+                self.legend = ax.legend(handles2, labels2, numpoints=1,
+                                prop=FontProperties(size=10),
                                 handletextsep=.05, loc=self.legendLoc)
                 if self.legend != None:
                     self.legend.set_picker(self.legend_picker)
-                    self.legend.set_axes(self.subplot) 
+                    self.legend.set_axes(self.subplot)
                 
             except:
-                self.legend = ax.legend(prop=FontProperties(size=10),  numpoints=1,
-                                handletextsep=.05, loc=self.legendLoc)
+                self.legend = ax.legend(prop=FontProperties(size=10),
+                                        numpoints=1, handletextsep=.05,
+                                        loc=self.legendLoc)
                  
     def xaxis(self, label, units, font=None, color='black', t_font=None):
@@ -1276,5 +1253,5 @@
         
         """
-        if units != "": 
+        if units != "":
             label = label + " (" + units + ")"
         if label.count("{") > 0 and label.count("$") < 2:
@@ -1284,9 +1261,8 @@
             if t_font != None:
                 for tick in self.subplot.xaxis.get_major_ticks():
-                    tick.label.set_fontproperties(t_font) 
+                    tick.label.set_fontproperties(t_font)
                 for line in self.subplot.xaxis.get_ticklines():
                     size = t_font.get_size()
                     line.set_markersize(size / 3)
-                    #line.set_markeredgewidth(int(size / 24 + 1))
         else:
             self.subplot.set_xlabel(label, color=color)
@@ -1295,5 +1271,5 @@
     def yaxis(self, label, units, font=None, color='black', t_font=None):
         """yaxis label and units."""
-        if units != "": 
+        if units != "":
             label = label + " (" + units + ")"
         if label.count("{") > 0 and label.count("$") < 2:
@@ -1311,5 +1287,5 @@
         pass
 
-    def _connect_to_xlim(self,callback):
+    def _connect_to_xlim(self, callback):
         """Bind the xlim change notification to the callback"""
         def process_xlim(axes):
@@ -1317,11 +1293,8 @@
             callback(lo, hi)
         self.subplot.callbacks.connect('xlim_changed', process_xlim)
-    
-    #def connect(self,trigger,callback):
-    #    print "PlotPanel.connect???"
-    #    if trigger == 'xlim': self._connect_to_xlim(callback)
 
     def interactive_points(self, x, y, dx=None, dy=None, name='', color=0,
-                           symbol=0, markersize=5, id=None, label=None, hide_error=False):
+                           symbol=0, markersize=5, id=None, label=None,
+                           hide_error=False):
         """Draw markers with error bars"""
         self.subplot.set_yscale('linear')
@@ -1336,9 +1309,9 @@
                  hide_error=hide_error)
         
-        self.subplot.set_yscale(self.yscale,nonposy='clip')
+        self.subplot.set_yscale(self.yscale, nonposy='clip')
         self.subplot.set_xscale(self.xscale)
        
-    
-    def interactive_curve(self,x,y,dy=None,name='',color=0,symbol=0,id=None,label=None):
+    def interactive_curve(self, x, y, dy=None, name='', color=0,
+                          symbol=0, id=None, label=None):
         """Draw markers with error bars"""
         self.subplot.set_yscale('linear')
@@ -1350,8 +1323,7 @@
         p.curve(x, y, dy=dy, color=color, symbol=symbol, label=label)
         
-        self.subplot.set_yscale(self.yscale,nonposy='clip')
+        self.subplot.set_yscale(self.yscale, nonposy='clip')
         self.subplot.set_xscale(self.xscale)
         
-
     def plottable_selected(self, id):
         """
@@ -1362,8 +1334,7 @@
 
     def points(self, x, y, dx=None, dy=None,
-               color=0, symbol=0, marker_size=5, label=None,id=None,  hide_error=False):
+               color=0, symbol=0, marker_size=5, label=None,
+               id=None, hide_error=False):
         """Draw markers with error bars"""
-        #self.subplot.set_yscale('linear')
-        #self.subplot.set_xscale('linear')
         
         # Convert tuple (lo,hi) to array [(x-lo),(hi-x)]
@@ -1377,16 +1348,15 @@
                                    linestyle='',
                                    label=label)
-            
         else:
             col = self._color(color)
             if hide_error:
                 h = self.subplot.plot(x, y, color=col,
-                                   marker=self._symbol(symbol), markersize=marker_size,
+                                   marker=self._symbol(symbol),
+                                   markersize=marker_size,
                                    linestyle='',
                                    label=label)
-                
             else:
-                h= self.subplot.errorbar(x, y, yerr=dy, xerr=None,
-                                  ecolor=col, capsize=2, linestyle='', 
+                h = self.subplot.errorbar(x, y, yerr=dy, xerr=None,
+                                  ecolor=col, capsize=2, linestyle='',
                                   barsabove=False,
                                   mec=col, mfc=col,
@@ -1423,13 +1393,14 @@
                 zmax_2D_temp = math.log10(self.zmax_2D)
                  
-        self.image(data=self.data, qx_data=self.qx_data, 
-                   qy_data=self.qy_data, xmin=self.xmin_2D, 
+        self.image(data=self.data, qx_data=self.qx_data,
+                   qy_data=self.qy_data, xmin=self.xmin_2D,
                    xmax=self.xmax_2D,
-                   ymin=self.ymin_2D, ymax=self.ymax_2D, 
+                   ymin=self.ymin_2D, ymax=self.ymax_2D,
                    cmap=self.cmap, zmin=zmin_2D_temp,
                    zmax=zmax_2D_temp)
       
-    def image(self, data, qx_data, qy_data, xmin, xmax, ymin, ymax, 
-              zmin, zmax, color=0, symbol=0, markersize=0, label='data2D', cmap=DEFAULT_CMAP):
+    def image(self, data, qx_data, qy_data, xmin, xmax, ymin, ymax,
+              zmin, zmax, color=0, symbol=0, markersize=0,
+              label='data2D', cmap=DEFAULT_CMAP):
         """
         Render the current data
@@ -1443,5 +1414,5 @@
         self.ymin_2D = ymin
         self.ymax_2D = ymax
-        self.zmin_2D = zmin 
+        self.zmin_2D = zmin
         self.zmax_2D = zmax
         c = self._color(color)
@@ -1449,5 +1420,5 @@
         if self.data == None:
             return
-        if self.data.ndim == 1:    
+        if self.data.ndim == 1:
             output = self._build_matrix()
         else:
@@ -1456,13 +1427,13 @@
         if self.scale == 'log_{10}':
             try:
-                if  self.zmin_2D  <= 0  and  len(output[output > 0]) > 0:
-                    zmin_temp = self.zmin_2D 
+                if  self.zmin_2D <= 0  and len(output[output > 0]) > 0:
+                    zmin_temp = self.zmin_2D
                     output[output>0] = numpy.log10(output[output>0])
                     #In log scale Negative values are not correct in general
                     #output[output<=0] = math.log(numpy.min(output[output>0]))
-                elif self.zmin_2D  <= 0:
+                elif self.zmin_2D <= 0:
                     zmin_temp = self.zmin_2D
-                    output[output>0] = numpy.zeros(len(output))  
-                    output[output<=0] = -32       
+                    output[output>0] = numpy.zeros(len(output))
+                    output[output<=0] = -32
                 else: 
                     zmin_temp = self.zmin_2D
@@ -1481,8 +1452,8 @@
             self.subplot.figure.subplots_adjust(left=0.2, right=.8, bottom=.2)
             
-            im = self.subplot.imshow(output, interpolation='nearest', 
+            im = self.subplot.imshow(output, interpolation='nearest',
                                      origin='lower',
                                      vmin=zmin_temp, vmax=self.zmax_2D,
-                                     cmap=self.cmap, 
+                                     cmap=self.cmap,
                                      extent=(self.xmin_2D, self.xmax_2D,
                                                 self.ymin_2D, self.ymax_2D))
@@ -1494,5 +1465,5 @@
             self.subplot.figure.clear()
 
-            self.subplot.figure.subplots_adjust(left=0.1, right=.8, bottom=.1)  
+            self.subplot.figure.subplots_adjust(left=0.1, right=.8, bottom=.1)
 
             X = self.x_bins[0:-1]
@@ -1514,5 +1485,5 @@
                     logging.error("PlotPanel could not import Axes3D")
                 self.subplot.figure.clear()
-                ax =  Axes3D(self.subplot.figure)
+                ax = Axes3D(self.subplot.figure)
                 if len(X) > 60:
                     ax.cla()
@@ -1521,13 +1492,11 @@
             im = ax.plot_surface(X, Y, output, rstride=1, cstride=1, cmap=cmap,
                                    linewidth=0, antialiased=False)
-            #ax.set_zlim3d(zmin_temp, self.zmax_2D)
-            #ax.set_frame_on(False)
-            self.subplot.set_axis_off()  
+            self.subplot.set_axis_off()
             
         if cbax == None:
             ax.set_frame_on(False)
-            cb =self.subplot.figure.colorbar(im, shrink=0.8, aspect=20)
+            cb = self.subplot.figure.colorbar(im, shrink=0.8, aspect=20)
         else:
-            cb =self.subplot.figure.colorbar(im, cax=cbax)
+            cb = self.subplot.figure.colorbar(im, cax=cbax)
         cb.update_bruteforce(im)
         cb.set_label('$' + self.scale + '$')
@@ -1538,8 +1507,8 @@
     
     def _build_matrix(self):
-        """ 
+        """
         Build a matrix for 2d plot from a vector
         Returns a matrix (image) with ~ square binning
-        Requirement: need 1d array formats of 
+        Requirement: need 1d array formats of
         self.data, self.qx_data, and self.qy_data
         where each one corresponds to z, x, or y axis values
@@ -1561,25 +1530,25 @@
         #Note: Can not use scipy.interpolate.Rbf:
         # 'cause too many data points (>10000)<=JHC.
-        # 1d array to use for weighting the data point averaging 
-        #when they fall into a same bin.          
-        weights_data  = numpy.ones([self.data.size])
-        # get histogram of ones w/len(data); this will provide 
+        # 1d array to use for weighting the data point averaging
+        #when they fall into a same bin.
+        weights_data = numpy.ones([self.data.size])
+        # get histogram of ones w/len(data); this will provide
         #the weights of data on each bins
-        weights, xedges, yedges = numpy.histogram2d(x=self.qy_data, 
+        weights, xedges, yedges = numpy.histogram2d(x=self.qy_data,
                                                     y=self.qx_data,
-                                                bins=[self.y_bins, self.x_bins],
-                                                    weights=weights_data)
+                                            bins=[self.y_bins, self.x_bins],
+                                            weights=weights_data)
         # get histogram of data, all points into a bin in a way of summing
-        image, xedges, yedges = numpy.histogram2d(x=self.qy_data, 
+        image, xedges, yedges = numpy.histogram2d(x=self.qy_data,
                                                   y=self.qx_data,
-                                                bins=[self.y_bins, self.x_bins],
-                                                weights=self.data)
+                                            bins=[self.y_bins, self.x_bins],
+                                            weights=self.data)
         # Now, normalize the image by weights only for weights>1: 
         # If weight == 1, there is only one data point in the bin so
         # that no normalization is required.
-        image[weights>1] = image[weights>1]/weights[weights>1]
+        image[weights > 1] = image[weights>1]/weights[weights>1]
         # Set image bins w/o a data point (weight==0) as None (was set to zero
         # by histogram2d.)
-        image[weights==0] = None
+        image[weights == 0] = None
 
         # Fill empty bins with 8 nearest neighbors only when at least
@@ -1587,8 +1556,8 @@
         loop = 0
         
-        # do while loop until all vacant bins are filled up up 
+        # do while loop until all vacant bins are filled up up
         #to loop = max_loop
         while(not(numpy.isfinite(image[weights == 0])).all()):
-            if loop >= max_loop: # this protects never-ending loop
+            if loop >= max_loop:  # this protects never-ending loop
                 break
             image = self._fillup_pixels(image=image, weights=weights)
@@ -1597,13 +1566,12 @@
         return image
     
-    def _get_bins(self): 
+    def _get_bins(self):
         """
         get bins
-        set x_bins and y_bins into self, 1d arrays of the index with 
+        set x_bins and y_bins into self, 1d arrays of the index with
         ~ square binning
-        Requirement: need 1d array formats of 
+        Requirement: need 1d array formats of
         self.qx_data, and self.qy_data
         where each one corresponds to  x, or y axis values
-        
         """
         # No qx or qy given in a vector format
@@ -1624,9 +1592,9 @@
         y_size = ymax - ymin
         
-        # estimate the # of pixels on each axes  
+        # estimate the # of pixels on each axes
         npix_y = int(math.floor(math.sqrt(len(self.qy_data))))
         npix_x = int(math.floor(len(self.qy_data) / npix_y))
 
-        # bin size: x- & y-directions     
+        # bin size: x- & y-directions
         xstep = x_size / (npix_x - 1)
         ystep = y_size / (npix_y - 1)
@@ -1640,13 +1608,13 @@
         # store x and y bin centers in q space
         x_bins = numpy.arange(xmin, xmax + xstep / 10, xstep)
-        y_bins = numpy.arange(ymin, ymax + ystep / 10, ystep) 
+        y_bins = numpy.arange(ymin, ymax + ystep / 10, ystep)
       
         #set x_bins and y_bins
-        self.x_bins = x_bins 
-        self.y_bins = y_bins 
-
-    def _fillup_pixels(self, image=None, weights=None): 
-        """
-        Fill z values of the empty cells of 2d image matrix 
+        self.x_bins = x_bins
+        self.y_bins = y_bins
+
+    def _fillup_pixels(self, image=None, weights=None):
+        """
+        Fill z values of the empty cells of 2d image matrix
         with the average over up-to next nearest neighbor points
         
@@ -1691,5 +1659,4 @@
                     # go 4 next nearest neighbors when no non-zero
                     # neighbor exists
-                    #if weight[n_y][n_x] == 0:
                     if n_y != 0 and n_x != 0 and\
                          numpy.isfinite(image[n_y-1][n_x-1]):
@@ -1721,6 +1688,6 @@
         self.subplot.set_xscale('linear')
         
-        hlist = self.subplot.plot(x, y, color=c, marker='', 
-                                  linestyle='-', label=label)
+        self.subplot.plot(x, y, color=c, marker='',
+                          linestyle='-', label=label)
         self.subplot.set_yscale(self.yscale)
         self.subplot.set_xscale(self.xscale)
@@ -1728,9 +1695,9 @@
     def _color(self, c):
         """Return a particular colour"""
-        return self.colorlist[c%len(self.colorlist)]
+        return self.colorlist[c % len(self.colorlist)]
 
     def _symbol(self, s):
         """Return a particular symbol"""
-        return self.symbollist[s%len(self.symbollist)]
+        return self.symbollist[s % len(self.symbollist)]
    
     def _replot(self, remove_fit=False):
@@ -1753,6 +1720,6 @@
         Receive the x and y transformation from myDialog,
         Transforms x and y in View
-        and set the scale    
-        """ 
+        and set the scale
+        """
         # The logic should be in the right order
         # Delete first, and then get the whole list...
@@ -1763,7 +1730,7 @@
         list = self.graph.returnPlottable()
         # Changing the scale might be incompatible with
-        # currently displayed data (for instance, going 
+        # currently displayed data (for instance, going
         # from ln to log when all plotted values have
-        # negative natural logs). 
+        # negative natural logs).
         # Go linear and only change the scale at the end.
         self.set_xscale("linear")
@@ -1789,5 +1756,5 @@
                 self.xaxis_label = xname
                 self.xaxis_unit = xunits
-            # Goes through all possible scales    
+            # Goes through all possible scales
             if(self.xLabel == "x"):
                 item.transformX(transform.toX, transform.errToX)
@@ -1795,13 +1762,13 @@
             if(self.xLabel == "x^(2)"):
                 item.transformX(transform.toX2, transform.errToX2)
-                xunits = convertUnit(2,xunits) 
+                xunits = convertUnit(2, xunits)
                 self.graph._xaxis_transformed("%s^{2}" % xname, "%s" % xunits)
             if(self.xLabel == "x^(4)"):
                 item.transformX(transform.toX4, transform.errToX4)
-                xunits = convertUnit(4,xunits) 
+                xunits = convertUnit(4, xunits)
                 self.graph._xaxis_transformed("%s^{4}" % xname, "%s" % xunits)
             if(self.xLabel == "ln(x)"):
-                item.transformX(transform.toLogX,transform.errToLogX)
-                self.graph._xaxis_transformed("\ln\\ %s" % xname, "%s" % xunits) 
+                item.transformX(transform.toLogX, transform.errToLogX)
+                self.graph._xaxis_transformed("\ln\\ %s" % xname, "%s" % xunits)
             if(self.xLabel == "log10(x)"):
                 item.transformX(transform.toX_pos, transform.errToX_pos)
@@ -1810,5 +1777,5 @@
             if(self.xLabel == "log10(x^(4))"):
                 item.transformX(transform.toX4, transform.errToX4)
-                xunits = convertUnit(4,xunits) 
+                xunits = convertUnit(4, xunits)
                 self.graph._xaxis_transformed("%s^{4}" % xname, "%s" % xunits)
                 _xscale = 'log'
@@ -1819,11 +1786,11 @@
                 item.transformY(transform.toX, transform.errToX)
                 self.graph._yaxis_transformed("%s" % yname, "%s" % yunits)
-            if(self.yLabel == "log10(y)"): 
+            if(self.yLabel == "log10(y)"):
                 item.transformY(transform.toX_pos, transform.errToX_pos)
-                _yscale = 'log'  
+                _yscale = 'log'
                 self.graph._yaxis_transformed("%s" % yname, "%s" % yunits)
             if(self.yLabel == "y^(2)"):
-                item.transformY(transform.toX2, transform.errToX2)    
-                yunits = convertUnit(2, yunits) 
+                item.transformY(transform.toX2, transform.errToX2)
+                yunits = convertUnit(2, yunits)
                 self.graph._yaxis_transformed("%s^{2}" % yname, "%s" % yunits)
             if(self.yLabel == "1/y"):
@@ -1833,45 +1800,46 @@
             if(self.yLabel == "y*x^(4)"):
                 item.transformY(transform.toYX4, transform.errToYX4)
-                xunits = convertUnit(4, self.xaxis_unit) 
-                self.graph._yaxis_transformed("%s \ \ %s^{4}" % (yname,xname), 
-                                               "%s%s" % (yunits,xunits))
+                xunits = convertUnit(4, self.xaxis_unit)
+                self.graph._yaxis_transformed("%s \ \ %s^{4}" % (yname, xname),
+                                               "%s%s" % (yunits, xunits))
             if(self.yLabel == "1/sqrt(y)"):
                 item.transformY(transform.toOneOverSqrtX,
-                                transform.errOneOverSqrtX )
+                                transform.errOneOverSqrtX)
                 yunits = convertUnit(-0.5, yunits)
-                self.graph._yaxis_transformed("1/\sqrt{%s}" %yname, "%s" % yunits)
+                self.graph._yaxis_transformed("1/\sqrt{%s}" % yname,
+                                              "%s" % yunits)
             if(self.yLabel == "ln(y*x)"):
                 item.transformY(transform.toLogXY, transform.errToLogXY)
-                self.graph._yaxis_transformed("\ln (%s \ \ %s)" % (yname,xname),
-                                                "%s%s" % (yunits, self.xaxis_unit))
+                self.graph._yaxis_transformed("\ln (%s \ \ %s)" % (yname, xname),
+                                            "%s%s" % (yunits, self.xaxis_unit))
             if(self.yLabel == "ln(y*x^(2))"):
                 item.transformY( transform.toLogYX2, transform.errToLogYX2) 
-                xunits = convertUnit(2, self.xaxis_unit) 
-                self.graph._yaxis_transformed("\ln (%s \ \ %s^{2})" % (yname,xname), 
-                                               "%s%s" % (yunits,xunits))
+                xunits = convertUnit(2, self.xaxis_unit)
+                self.graph._yaxis_transformed("\ln (%s \ \ %s^{2})" % (yname, xname),
+                                               "%s%s" % (yunits, xunits))
             if(self.yLabel == "ln(y*x^(4))"):
                 item.transformY(transform.toLogYX4, transform.errToLogYX4)
-                xunits = convertUnit(4, self.xaxis_unit) 
-                self.graph._yaxis_transformed("\ln (%s \ \ %s^{4})" % (yname,xname), 
-                                               "%s%s" % (yunits,xunits))
+                xunits = convertUnit(4, self.xaxis_unit)
+                self.graph._yaxis_transformed("\ln (%s \ \ %s^{4})" % (yname, xname),
+                                               "%s%s" % (yunits, xunits))
             if(self.yLabel == "log10(y*x^(4))"):
                 item.transformY(transform.toYX4, transform.errToYX4)
-                xunits = convertUnit(4, self.xaxis_unit) 
-                _yscale = 'log' 
-                self.graph._yaxis_transformed("%s \ \ %s^{4}" % (yname,xname), 
-                                               "%s%s" % (yunits,xunits))
+                xunits = convertUnit(4, self.xaxis_unit)
+                _yscale = 'log'
+                self.graph._yaxis_transformed("%s \ \ %s^{4}" % (yname, xname),
+                                               "%s%s" % (yunits, xunits))
             if(self.viewModel == "Guinier lny vs x^(2)"):
                 item.transformX(transform.toX2, transform.errToX2)
-                xunits = convertUnit(2, xunits) 
-                self.graph._xaxis_transformed("%s^{2}" % xname,  "%s" % xunits)
-                item.transformY(transform.toLogX,transform.errToLogX )
-                self.graph._yaxis_transformed("\ln\ \ %s" % yname,  "%s" % yunits)
+                xunits = convertUnit(2, xunits)
+                self.graph._xaxis_transformed("%s^{2}" % xname, "%s" % xunits)
+                item.transformY(transform.toLogX,transform.errToLogX)
+                self.graph._yaxis_transformed("\ln\ \ %s" % yname, "%s" % yunits)
             if(self.viewModel == "Porod y*x^(4) vs x^(4)"):
                 item.transformX(transform.toX4, transform.errToX4)
-                xunits = convertUnit(4, self.xaxis_unit) 
+                xunits = convertUnit(4, self.xaxis_unit)
                 self.graph._xaxis_transformed("%s^{4}" % xname, "%s" % xunits)
                 item.transformY(transform.toYX4, transform.errToYX4)
-                self.graph._yaxis_transformed("%s \ \ %s^{4}" % (yname,xname), 
-                                               "%s%s" % (yunits,xunits))
+                self.graph._yaxis_transformed("%s \ \ %s^{4}" % (yname, xname),
+                                               "%s%s" % (yunits, xunits))
             item.transformView()
   
@@ -1881,24 +1849,20 @@
         xname = self.graph.prop["xlabel"]
         xunits = ''
-        #self.yaxis_label = yname
-        #self.yaxis_unit = yunits
-        #self.xaxis_label = xname
-        #self.xaxis_unit = xunits
                 
-        self.resetFitView()   
-        self.prevXtrans = self.xLabel 
-        self.prevYtrans = self.yLabel  
+        self.resetFitView()
+        self.prevXtrans = self.xLabel
+        self.prevYtrans = self.yLabel
         self.graph.render(self)
         self.set_xscale(_xscale)
         self.set_yscale(_yscale)
         
-        self.xaxis(xname, xunits, self.xaxis_font, 
+        self.xaxis(xname, xunits, self.xaxis_font,
                    self.xaxis_color, self.xaxis_tick)
-        self.yaxis(yname, yunits, self.yaxis_font, 
+        self.yaxis(yname, yunits, self.yaxis_font,
                    self.yaxis_color, self.yaxis_tick)
         self.subplot.texts = self.textList
         self.subplot.figure.canvas.draw_idle()
         
-    def onFitDisplay(self, tempx, tempy, xminView, 
+    def onFitDisplay(self, tempx, tempy, xminView,
                      xmaxView, xmin, xmax, func):
         """
@@ -1928,14 +1892,14 @@
             item.onFitRange(None, None)
         # Create new data plottable with result
-        self.fit_result.x = [] 
+        self.fit_result.x = []
         self.fit_result.y = []
-        self.fit_result.x = tempx  
-        self.fit_result.y = tempy     
+        self.fit_result.x = tempx
+        self.fit_result.y = tempy
         self.fit_result.dx = None
         self.fit_result.dy = None
         #Load the view with the new values
         self.fit_result.reset_view()
-        # Add the new plottable to the graph 
-        self.graph.add(self.fit_result) 
+        # Add the new plottable to the graph
+        self.graph.add(self.fit_result)
         self.graph.render(self)
         self._offset_graph()
@@ -1952,9 +1916,9 @@
         dial = LabelDialog(None, -1, 'Modify Window Title', old_caption)
         if dial.ShowModal() == wx.ID_OK:
-            new_caption = dial.getText() 
+            new_caption = dial.getText()
           
             # send to guiframe to change the panel caption
-            caption = self.parent.on_change_caption(self.window_name, 
-                                                    old_caption, new_caption) 
+            caption = self.parent.on_change_caption(self.window_name,
+                                                    old_caption, new_caption)
             
             # also set new caption in plot_panels list
@@ -1967,5 +1931,5 @@
     def onResetGraph(self, event):
         """
-        Reset the graph by plotting the full range of data 
+        Reset the graph by plotting the full range of data
         """
         list = []
@@ -2012,7 +1976,6 @@
             print "Error in copy Image"
 
-
-            
-#---------------------------------------------------------------        
+ 
+#---------------------------------------------------------------
 class NoRepaintCanvas(FigureCanvasWxAgg):
     """
@@ -2036,7 +1999,5 @@
             self.realize()
         if self._drawn < 2:
-            self.draw(repaint = False)
+            self.draw(repaint=False)
             self._drawn += 1
         self.gui_repaint(drawDC=wx.PaintDC(self))
-           
-
Index: plottools/src/danse/common/plottools/PropertyDialog.py
===================================================================
--- plottools/src/danse/common/plottools/PropertyDialog.py	(revision b4da6dff237ad0ddb8058807b5fcbb4332c65147)
+++ plottools/src/danse/common/plottools/PropertyDialog.py	(revision 10bfeb307197dbe02c1ab9ca2e868b076c0cd128)
@@ -1,5 +1,2 @@
-#!/usr/bin/python
-
-# myDialog.py
 """
 """
@@ -15,5 +12,5 @@
         """
         self.parent = parent
-        vbox  = wx.BoxSizer(wx.VERTICAL)
+        vbox = wx.BoxSizer(wx.VERTICAL)
         sizer = wx.GridBagSizer(5,5)
 
@@ -42,5 +39,5 @@
         x_size += self.view.GetSize()[0]
         self.view.SetMinSize((160, 30))
-        sizer.Add(self.view, (iy,ix), (1,1), 
+        sizer.Add(self.view, (iy,ix), (1,1),
                   wx.EXPAND|wx.RIGHT|wx.ADJUST_MINSIZE, 10)
         self.SetMinSize((x_size, 50))
@@ -52,6 +49,6 @@
         sizer_button.Add((20, 20), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
         sizer_button.Add(btOk, 0, wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10)
-        sizer_button.Add(btCancel, 0, wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10)        
-        vbox.Add(sizer_button, 0, 
+        sizer_button.Add(btCancel, 0, wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10)
+        vbox.Add(sizer_button, 0,
                  wx.EXPAND|wx.TOP|wx.BOTTOM|wx.ADJUST_MINSIZE, 10)
         # scale value for x
@@ -77,5 +74,5 @@
         self.yvalue.Insert("ln(y*x^(4))", 9)
         self.yvalue.Insert("log10(y*x^(4))", 10)
-        # type of view or model used 
+        # type of view or model used
         self.view.SetValue("--")
         self.view.Insert("--", 0)
@@ -83,5 +80,5 @@
         self.view.Insert("Porod y*x^(4) vs x^(4)", 2)
         self.SetSizer(vbox)
-        self.Fit()        
+        self.Fit()
         self.Centre()
            
@@ -97,11 +94,2 @@
         return self.xvalue.GetValue(), self.yvalue.GetValue(),\
                             self.view.GetValue()
-        
-
-if __name__ == "__main__": 
-    app = wx.App()
-    dialog = Properties(None, -1, 'Properties')
-    dialog.ShowModal()
-    app.MainLoop()
-
-
Index: plottools/src/danse/common/plottools/SizeDialog.py
===================================================================
--- plottools/src/danse/common/plottools/SizeDialog.py	(revision 82a54b89c2fb14de05cf41239d597f5e7cb6df9b)
+++ plottools/src/danse/common/plottools/SizeDialog.py	(revision 10bfeb307197dbe02c1ab9ca2e868b076c0cd128)
@@ -1,3 +1,4 @@
 import wx
+
 
 class SizeDialog(wx.Dialog):
@@ -5,6 +6,4 @@
         wx.Dialog.__init__(self, parent, id, title, size=(300, 175))
 
-        #panel = wx.Panel(self, -1)
-        
         mainbox = wx.BoxSizer(wx.VERTICAL)
         vbox = wx.BoxSizer(wx.VERTICAL)
@@ -12,9 +11,9 @@
         hbox = wx.BoxSizer(wx.HORIZONTAL)
         text1 = "Enter in a custom size (float values > 0 accepted)"
-        msg = wx.StaticText(self, -1, text1,(30,15), style=wx.ALIGN_CENTRE)
+        msg = wx.StaticText(self, -1, text1, (30,15), style=wx.ALIGN_CENTRE)
         msg.SetLabel(text1)
         self.myTxtCtrl = wx.TextCtrl(self, -1, '', (100, 50))
         
-        textbox.Add(self.myTxtCtrl, flag=wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 
+        textbox.Add(self.myTxtCtrl, flag=wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE,
                  border=10, proportion=2)
         vbox.Add(msg, flag=wx.ALL, border=10, proportion=1)
@@ -23,14 +22,14 @@
         self.myTxtCtrl.SetValue(str(10))
         
-        okButton = wx.Button(self,wx.ID_OK, 'OK', size=(70, 25))
-        closeButton = wx.Button(self,wx.ID_CANCEL, 'Cancel', size=(70, 25))
+        okButton = wx.Button(self, wx.ID_OK, 'OK', size=(70, 25))
+        closeButton = wx.Button(self, wx.ID_CANCEL, 'Cancel', size=(70, 25))
 
         hbox.Add(okButton)
-        hbox.Add((20,20))
+        hbox.Add((20, 20))
         hbox.Add(closeButton)
         
         mainbox.Add(vbox, flag=wx.ALL, border=10)
         mainbox.Add(wx.StaticLine(self), 0, wx.ALL|wx.EXPAND, 5)
-        mainbox.Add(hbox, flag=wx.CENTER, 
+        mainbox.Add(hbox, flag=wx.CENTER,
                     border=10)
         self.SetSizer(mainbox)
@@ -41,3 +40,2 @@
         """
         return self.myTxtCtrl.GetValue()
-    
Index: plottools/src/danse/common/plottools/TextDialog.py
===================================================================
--- plottools/src/danse/common/plottools/TextDialog.py	(revision f80236f07fd27a5564be7dc22883b7989564c9b8)
+++ plottools/src/danse/common/plottools/TextDialog.py	(revision 10bfeb307197dbe02c1ab9ca2e868b076c0cd128)
@@ -10,7 +10,8 @@
 FAMILY = ['serif', 'sans-serif', 'fantasy', 'monospace']
 SIZE = [8, 9, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72]
-STYLE  = ['normal', 'italic']
+STYLE = ['normal', 'italic']
 WEIGHT = ['light', 'normal', 'bold']
 COLOR = ['black', 'blue', 'green', 'red', 'cyan', 'magenta', 'yellow']
+
 
 class TextDialog(wx.Dialog):
@@ -36,5 +37,5 @@
         _BOX_WIDTH = 60
         font_size = 12
-        font_description= wx.StaticBox(self, -1, 'Font', 
+        font_description= wx.StaticBox(self, -1, 'Font',
                                        size=(PNL_WIDTH-20, 70))
         font_box = wx.StaticBoxSizer(font_description, wx.VERTICAL)
@@ -73,10 +74,10 @@
             else:
                 enter_text += ":"
-        self.textString  = wx.TextCtrl(self, -1, size=(PNL_WIDTH-30, height ),\
+        self.textString = wx.TextCtrl(self, -1, size=(PNL_WIDTH-30, height ),\
                                                         style=styles)
         self.textString.SetValue(str(label))
         self.textString.SetToolTipString("The text that will be displayed.")
         #font family
-        self.fontFamily =  wx.ComboBox(self, -1, style=wx.CB_READONLY)
+        self.fontFamily = wx.ComboBox(self, -1, style=wx.CB_READONLY)
         wx.EVT_COMBOBOX(self.fontFamily, -1, self.on_family)
         self.fontFamily.SetMinSize((_BOX_WIDTH, -1))
@@ -85,5 +86,5 @@
         self.fontFamily.SetToolTipString("Font family of the text.")
         #font weight
-        self.fontWeight =  wx.ComboBox(self, -1, style=wx.CB_READONLY)
+        self.fontWeight = wx.ComboBox(self, -1, style=wx.CB_READONLY)
         wx.EVT_COMBOBOX(self.fontWeight, -1, self.on_weight)
         self.fontWeight.SetMinSize((_BOX_WIDTH, -1))
@@ -92,5 +93,5 @@
         self.fontWeight.SetToolTipString("Font weight of the text.")
         #font family
-        self.fontSize =  wx.ComboBox(self, -1, style=wx.CB_READONLY)
+        self.fontSize = wx.ComboBox(self, -1, style=wx.CB_READONLY)
         wx.EVT_COMBOBOX(self.fontSize, -1, self.on_size)
         self.fontSize.SetMinSize((_BOX_WIDTH, -1))
@@ -99,5 +100,5 @@
         self.fontSize.SetToolTipString("Font size of the text.")
         #font style
-        self.fontStyle =  wx.ComboBox(self, -1, style=wx.CB_READONLY)
+        self.fontStyle = wx.ComboBox(self, -1, style=wx.CB_READONLY)
         wx.EVT_COMBOBOX(self.fontStyle, -1, self.on_style)
         self.fontStyle.SetMinSize((_BOX_WIDTH, -1))
@@ -106,5 +107,5 @@
         self.fontStyle.SetToolTipString("Font style of the text.")
         #font color
-        self.fontColor =  wx.ComboBox(self, -1, style=wx.CB_READONLY)
+        self.fontColor = wx.ComboBox(self, -1, style=wx.CB_READONLY)
         wx.EVT_COMBOBOX(self.fontColor, -1, self.on_color)
         self.fontColor.SetMinSize((_BOX_WIDTH, -1))
@@ -115,9 +116,9 @@
         self.static_line_1 = wx.StaticLine(self, -1)
         self.okButton = wx.Button(self,wx.ID_OK, 'OK', size=(_BOX_WIDTH, 25))
-        self.closeButton = wx.Button(self,wx.ID_CANCEL, 'Cancel', 
+        self.closeButton = wx.Button(self,wx.ID_CANCEL, 'Cancel',
                                      size=(_BOX_WIDTH, 25))
         
         # Intro
-        explanation  = "Select font properties :"
+        explanation = "Select font properties :"
         vbox.Add(sizer)
         ix = 0
@@ -131,5 +132,5 @@
         family_box.Add(self.fontSize, -1, 0)
         if unit_box != None:
-            family_box.Add((_BOX_WIDTH/2,-1))
+            family_box.Add((_BOX_WIDTH/2, -1))
             family_box.Add(tick_label_text, -1, 0)
             family_box.Add(self.tick_label_check, -1, 0)
@@ -152,5 +153,5 @@
         sizer.Add(wx.StaticText(self, -1, enter_text), (iy, ix),
                  (1, 1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-        text_box.Add((15,10))
+        text_box.Add((15, 10))
         text_box.Add(self.textString)
         vbox.Add(text_box, 0, wx.EXPAND, 15)
@@ -161,5 +162,5 @@
             vbox.Add(unit_box, 0,wx.LEFT, 15)
         
-        vbox.Add((10,10))
+        vbox.Add((10, 10))
         vbox.Add(self.static_line_1, 0, wx.EXPAND, 10)
         sizer_button = wx.BoxSizer(wx.HORIZONTAL)
@@ -168,5 +169,5 @@
                          wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10)
         sizer_button.Add(self.closeButton, 0,
-                          wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10)        
+                          wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10)
         vbox.Add(sizer_button, 0, wx.EXPAND|wx.BOTTOM|wx.TOP, 10)
         self.SetSizer(vbox)
@@ -180,5 +181,5 @@
         list = FAMILY
         for idx in range(len(list)):
-            self.fontFamily.Append(list[idx],idx)  
+            self.fontFamily.Append(list[idx], idx)
                  
     def _set_size_list(self):
@@ -198,5 +199,5 @@
         list = WEIGHT
         for idx in range(len(list)):
-            self.fontWeight.Append(list[idx],idx) 
+            self.fontWeight.Append(list[idx], idx)
             
     def _set_style_list(self):
@@ -207,5 +208,5 @@
         list = STYLE
         for idx in range(len(list)):
-            self.fontStyle.Append(list[idx],idx)  
+            self.fontStyle.Append(list[idx], idx)
             
     def _set_color_list(self):
@@ -216,5 +217,5 @@
         list = COLOR
         for idx in range(len(list)):
-            self.fontColor.Append(list[idx],idx) 
+            self.fontColor.Append(list[idx], idx)
             
     def on_tick_label(self, event):
@@ -230,5 +231,5 @@
         """
         event.Skip()
-        self.family = self.fontFamily.GetValue() 
+        self.family = self.fontFamily.GetValue()
                  
     def on_style(self, event):
@@ -251,5 +252,5 @@
         """
         event.Skip()
-        self.size = self.fontSize.GetValue() 
+        self.size = self.fontSize.GetValue()
     
     def on_color(self, event):
@@ -258,5 +259,5 @@
         """
         event.Skip()
-        self.color = self.fontColor.GetValue() 
+        self.color = self.fontColor.GetValue()
            
     def getText(self):
@@ -294,5 +295,5 @@
         Returns font tyle for the text box
         """
-        return str(self.style)  
+        return str(self.style)
 
     def getWeight(self):
Index: plottools/src/danse/common/plottools/binder.py
===================================================================
--- plottools/src/danse/common/plottools/binder.py	(revision 0e553fd2808f3d9036eef66181f51921babd5081)
+++ plottools/src/danse/common/plottools/binder.py	(revision 10bfeb307197dbe02c1ab9ca2e868b076c0cd128)
@@ -2,4 +2,6 @@
 Extension to MPL to support the binding of artists to key/mouse events.
 """
+import sys
+
 
 class Selection:
@@ -12,4 +14,5 @@
     artist = None
     prop = {}
+    
     def __init__(self, artist=None, prop={}):
         self.artist, self.prop = artist, self.prop
@@ -23,4 +26,5 @@
     def __nonzero__(self):
         return self.artist is not None
+
 
 class BindArtist:
@@ -66,11 +70,4 @@
             ]
             
-
-        # Turn off picker if it hasn't already been done
-        #try:
-        #    canvas.mpl_disconnect(canvas.button_pick_id)
-        #    canvas.mpl_disconnect(canvas.scroll_pick_id)
-        #except: 
-        #    pass
         self._current = None
         self._actions = {}
@@ -121,7 +118,8 @@
         In case we need to disconnect from the canvas...
         """
-        try: 
+        try:
             for cid in self._connections: self.canvas.mpl_disconnect(cid)
-        except: 
+        except:
+            print "Error disconnection canvas: %s" % sys.exc_value
             pass
         self._connections = []
@@ -165,5 +163,5 @@
             shift,control,alt,meta are flags which are true if the
                 corresponding key is pressed at the time of the event.
-            details is a dictionary of artist specific details, such as the 
+            details is a dictionary of artist specific details, such as the
                 id(s) of the point that were clicked.
                 
@@ -182,5 +180,5 @@
         TODO: Attach multiple callbacks to the same event?
         TODO: Clean up interaction with toolbar modes
-        TODO: push/pushclear/pop context so that binding changes for 
+        TODO: push/pushclear/pop context so that binding changes for
              the duration
         TODO:   e.g., to support ? context sensitive help
@@ -193,9 +191,7 @@
         # Register the trigger callback
         self._actions[trigger][artist] = action
-        #print "==> added",artist,[artist],"to",trigger,":",
-        #self._actions[trigger].keys()
 
         # Maintain a list of all artists
-        if artist not in self._artists: 
+        if artist not in self._artists:
             self._artists.append(artist)
 
@@ -239,10 +235,8 @@
         # TODO: sort by zorder of axes then by zorder within axes
         self._artists.sort(cmp=lambda x, y: cmp(y.zorder, x.zorder))
-        # print "search"," ".join([str(h) for h in self._artists])
         found = Selection()
-        #print "searching in",self._artists
         for artist in self._artists:
             # TODO: should contains() return false if invisible?
-            if not artist.get_visible(): 
+            if not artist.get_visible():
                 continue
             # TODO: optimization - exclude artists not inaxes
@@ -255,5 +249,4 @@
                 found.artist, found.prop = artist, prop
                 break
-        #print "found",found.artist
         
         # TODO: how to check if prop is equal?
@@ -296,10 +289,8 @@
                 x, y = transform.inverse_xy_tup((x, y))
 
-               
             event.xdata, event.ydata = x, y
             self.trigger(self._hasclick, 'drag', event)
         else:
             found = self._find_current(event)
-            #print "found",found.artist
             self.trigger(found, 'motion', event)
 
@@ -312,7 +303,4 @@
         # Check for double-click
         event_time = time.time()
-        #print event_time,self._last_time,self.dclick_threshhold
-        #print (event_time > self._last_time + self.dclick_threshhold)
-        #print event.button,self._last_button
         if (event.button != self._last_button) or \
                 (event_time > self._last_time + self.dclick_threshhold):
@@ -376,5 +364,5 @@
         # TODO: Can we tab between items?
         # TODO: How do unhandled events get propogated to axes, figure and
-        # TODO: finally to application?  Do we need to implement a full tags 
+        # TODO: finally to application?  Do we need to implement a full tags
         # TODO: architecture a la Tk?
         # TODO: Do modifiers cause a grab?  Does the artist see the modifiers?
@@ -408,3 +396,2 @@
         found = self._find_current(event)
         self.trigger(found, 'scroll', event)
-
Index: plottools/src/danse/common/plottools/canvas.py
===================================================================
--- plottools/src/danse/common/plottools/canvas.py	(revision 4a4164c633bdb96dccfc304d13589ff77b7174e5)
+++ plottools/src/danse/common/plottools/canvas.py	(revision 10bfeb307197dbe02c1ab9ca2e868b076c0cd128)
@@ -1,4 +1,4 @@
 """
-This module implements a faster canvas for plotting. 
+This module implements a faster canvas for plotting.
 it ovewrites some matplolib methods to allow printing on sys.platform=='win32'
 """
@@ -27,11 +27,12 @@
     """
     pass
-#print "overriding select"
-def select(self): 
-    """
-    """
-    #print "in new select"
+
+
+def select(self):
+    """
+    """
     pass
 
+
 def unselect(self):
     """
@@ -39,10 +40,11 @@
     pass
 
+
 def OnPrintPage(self, page):
     """
-    override printPage of matplotlib 
+    override printPage of matplotlib
     """
     self.canvas.draw()
-    dc        = self.GetDC()
+    dc = self.GetDC()
     try:
         (ppw, pph) = self.GetPPIPrinter()      # printer's pixels per in
@@ -61,5 +63,5 @@
 
     # draw the bitmap, scaled appropriately
-    vscale    = float(ppw) / fig_dpi 
+    vscale = float(ppw) / fig_dpi
 
     # set figure resolution,bg color for printer
@@ -67,21 +69,22 @@
     self.canvas.figure.set_facecolor('#FFFFFF')
 
-    renderer  = RendererWx(self.canvas.bitmap, self.canvas.figure.dpi)
+    renderer = RendererWx(self.canvas.bitmap, self.canvas.figure.dpi)
     self.canvas.figure.draw(renderer)
-    self.canvas.bitmap.SetWidth(  int(self.canvas.bitmap.GetWidth() * vscale))
-    self.canvas.bitmap.SetHeight( int(self.canvas.bitmap.GetHeight()* vscale))
+    self.canvas.bitmap.SetWidth(int(self.canvas.bitmap.GetWidth() * vscale))
+    self.canvas.bitmap.SetHeight(int(self.canvas.bitmap.GetHeight() * vscale))
     self.canvas.draw()
 
     # page may need additional scaling on preview
     page_scale = 1.0
-    if self.IsPreview():   page_scale = float(dcw)/pgw
+    if self.IsPreview():
+        page_scale = float(dcw)/pgw
 
     # get margin in pixels = (margin in in) * (pixels/in)
-    top_margin  = int(self.margin * pph * page_scale)
+    top_margin = int(self.margin * pph * page_scale)
     left_margin = int(self.margin * ppw * page_scale)
 
     # set scale so that width of output is self.width inches
     # (assuming grw is size of graph in inches....)
-    user_scale = (self.width * fig_dpi * page_scale)/float(grw)
+    user_scale = (self.width * fig_dpi * page_scale) / float(grw)
     dc.SetDeviceOrigin(left_margin, top_margin)
     dc.SetUserScale(user_scale, user_scale)
@@ -108,9 +111,9 @@
 RendererBase.draw_image = draw_image
 
+
 class FigureCanvas(FigureCanvasWxAgg):
     """
     Add features to the wx agg canvas for better support of AUI and
     faster plotting.
-    
     """
 
@@ -136,5 +139,5 @@
     def set_panel(self, panel):
         """
-        Set axes 
+        Set axes
         """
         # set panel
@@ -158,10 +161,10 @@
         if False and wx.GetApp().Pending():
             self.idletimer.Restart(5, *args, **kwargs)
-        else:           
+        else:
             # Draw plot, changes resizing too
             self.draw(*args, **kwargs)
-            self.resizing = False  
+            self.resizing = False
             
-    def _get_axes_switch(self):    
+    def _get_axes_switch(self):
         """
         """
@@ -182,8 +185,8 @@
         self.set_resizing(False)
         
-    def set_resizing(self, resizing=False):  
-        """
-        Setting the resizing 
-        """  
+    def set_resizing(self, resizing=False):
+        """
+        Setting the resizing
+        """
         self.resizing = resizing
         self.panel.set_resizing(False)
@@ -222,5 +225,5 @@
 
         # Convert delta/rotation/rate into a floating point step size
-        delta = evt.GetWheelDelta() 
+        delta = evt.GetWheelDelta()
         rotation = evt.GetWheelRotation()
         rate = evt.GetLinesPerAction()
@@ -237,5 +240,4 @@
         scroll wheel event.  x,y are the canvas coords: 0,0 is lower,
         left.  button and key are as defined in MouseEvent
-        
         """
         button = 'up' if step >= 0 else 'down'
@@ -262,5 +264,5 @@
             # This solves the focusing on rightclick.
             # Todo: better design
-            self.panel.parent.set_plot_unfocus() 
+            self.panel.parent.set_plot_unfocus()
             self.panel.on_set_focus(None)
         
Index: plottools/src/danse/common/plottools/config.py
===================================================================
--- plottools/src/danse/common/plottools/config.py	(revision cd8d4a715a0595da7a91fee8576f089bc85f9c19)
+++ plottools/src/danse/common/plottools/config.py	(revision 10bfeb307197dbe02c1ab9ca2e868b076c0cd128)
@@ -52,3 +52,2 @@
     # if a backend has already been selected, make sure it is the correct one.
     raise ImportError("Matplotlib not using backend " + plot_backend)
-
Index: plottools/src/danse/common/plottools/fitDialog.py
===================================================================
--- plottools/src/danse/common/plottools/fitDialog.py	(revision 82a54b89c2fb14de05cf41239d597f5e7cb6df9b)
+++ plottools/src/danse/common/plottools/fitDialog.py	(revision 10bfeb307197dbe02c1ab9ca2e868b076c0cd128)
@@ -1,10 +1,7 @@
-#!/usr/bin/python
-
-# fitDialog.py
-
 import wx
-#from PlotPanel import PlotPanel
 from plottables import Theory1D
-import math, numpy, fittings
+import math
+import numpy
+import fittings
 import transform
 import sys
@@ -18,9 +15,10 @@
     PNL_WIDTH = 450
     
+    
 def format_number(value, high=False):
     """
-    Return a float in a standardized, human-readable formatted string 
+    Return a float in a standardized, human-readable formatted string
     """
-    try: 
+    try:
         value = float(value)
     except:
@@ -36,7 +34,6 @@
 
 
-
 class LinearFit(wx.Dialog):
-    def __init__(self, parent, plottable, push_data,transform, title):
+    def __init__(self, parent, plottable, push_data, transform, title):
         """
         Dialog window pops- up when select Linear fit on Context menu
@@ -107,5 +104,5 @@
         
         # Intro
-        explanation  = "Perform fit for y(x) = Ax + B"
+        explanation = "Perform fit for y(x) = Ax + B"
         vbox.Add(sizer)
         ix = 0
@@ -122,5 +119,5 @@
                   (iy, ix), (1, 1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
         ix += 1
-        sizer.Add(self.tcErrA, (iy, ix), (1, 1), 
+        sizer.Add(self.tcErrA, (iy, ix), (1, 1),
                   wx.EXPAND|wx.ADJUST_MINSIZE, 0)
         iy += 1
@@ -167,5 +164,5 @@
                    wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
         ix += 1
-        sizer.Add(self.xminFit, (iy, ix),(1,1),
+        sizer.Add(self.xminFit, (iy, ix), (1, 1),
                    wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0)
         ix += 2
@@ -179,5 +176,5 @@
         sizer_button.Add(self.btFit, 0, wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10)
         sizer_button.Add(self.btClose, 0,
-                          wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10)        
+                          wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10)
         vbox.Add(sizer_button, 0, wx.EXPAND|wx.BOTTOM|wx.TOP, 10)
         
@@ -190,6 +187,6 @@
         self.model = LineModel()
         #Display the fittings values
-        self.default_A = self.model.getParam('A') 
-        self.default_B = self.model.getParam('B') 
+        self.default_A = self.model.getParam('A')
+        self.default_B = self.model.getParam('B')
         self.cstA = fittings.Parameter(self.model, 'A', self.default_A)
         self.cstB = fittings.Parameter(self.model, 'B', self.default_B)
@@ -198,5 +195,5 @@
         if self.Avalue == None:
             self.tcA.SetValue(format_number(self.default_A))
-        else :
+        else:
             self.tcA.SetLabel(format_number(self.Avalue))
         if self.Bvalue == None:
@@ -231,6 +228,4 @@
             self.initXmin.SetValue(format_number(min(self.plottable.x)))
             self.initXmax.SetValue(format_number(max(self.plottable.x)))
-            #self.xminFit.SetLabel(format_number(self.mini))
-            #self.xmaxFit.SetLabel(format_number(self.maxi))
             self.mini = min(self.x)
             self.maxi = max(self.x)
@@ -251,5 +246,5 @@
     def _on_close(self, event):
         """
-        Close event. 
+        Close event.
         Notify registered owner if available.
         """
@@ -263,5 +258,5 @@
         the button Fit.Computes chisqr ,
         A and B parameters of the best linear fit y=Ax +B
-        Push a plottable to 
+        Push a plottable to
         """
         tempx = []
@@ -271,5 +266,5 @@
         # Check if View contains a x array .we online fit when x exits
         # makes transformation for y as a line to fit
-        if self.x != []: 
+        if self.x != []:
             if(self.checkFitValues(self.xminFit) == True):
                 #Check if the field of Fit Dialog contain values
@@ -278,5 +273,5 @@
                 #self.xmaxFit.GetValue())
                 if not self._checkVal(self.xminFit, self.xmaxFit):
-                    return 
+                    return
                 xminView = float(self.xminFit.GetValue())
                 xmaxView = float(self.xmaxFit.GetValue())
@@ -291,10 +286,10 @@
                         for i in range(len(self.x)):
                             if self.x[i] >= math.log10(xmin):
-                                tempy.append(math.log10(self.y[i])) 
+                                tempy.append(math.log10(self.y[i]))
                                 tempdy.append(transform.errToLogX(self.y[i],
                                                         0, self.dy[i], 0))
                     else:
                         for i in range(len(self.y)):
-                            tempy.append(math.log10(self.y[i])) 
+                            tempy.append(math.log10(self.y[i]))
                             tempdy.append(transform.errToLogX(self.y[i],
                                                             0, self.dy[i], 0))
@@ -306,11 +301,11 @@
                     for x_i in self.x:
                         if x_i >= math.log10(xmin):
-                            tempx.append(math.log10(x_i)) 
+                            tempx.append(math.log10(x_i))
                 else:
                     tempx = self.x
               
                 #Find the fitting parameters
-                # Always use the same defaults, so that fit history 
-                #doesn't play a role! 
+                # Always use the same defaults, so that fit history
+                #doesn't play a role!
                 self.cstA = fittings.Parameter(self.model, 'A', self.default_A)
                 self.cstB = fittings.Parameter(self.model, 'B', self.default_B)
@@ -328,5 +323,5 @@
                     tempdy = numpy.asarray(tempdy)
                     tempdy[tempdy == 0] = 1
-                    chisqr, out, cov = fittings.sansfit(self.model, 
+                    chisqr, out, cov = fittings.sansfit(self.model,
                                                         [self.cstA, self.cstB],
                                                         tempx, tempy, tempdy,
@@ -349,5 +344,5 @@
                     cstA = out[0]
                     cstB = out[1]
-                # Reset model with the right values of A and B 
+                # Reset model with the right values of A and B
                 self.model.setParam('A', float(cstA))
                 self.model.setParam('B', float(cstB))
@@ -380,5 +375,5 @@
                 if self.yLabel == "log10(y)":
                     tempy.append(math.pow(10, y_model))
-                else: 
+                else:
                     tempy.append(y_model)
                 #Set the fit parameter display when  FitDialog is opened again
@@ -396,6 +391,5 @@
     def _onsetValues(self, cstA, cstB, errA, errB, Chi):
         """
-        Display  the value on fit Dialog 
-        
+        Display  the value on fit Dialog
         """
         self.tcA.SetValue(format_number(cstA))
@@ -407,5 +401,5 @@
     def _ongetValues(self):
         """
-        Display  the value on fit Dialog 
+        Display  the value on fit Dialog
         """
         return self.Avalue, self.Bvalue, self.ErrAvalue, \
@@ -414,5 +408,5 @@
     def _checkVal(self, usermin, usermax):
         """
-        Ensure that fields parameter contains a min and a max value 
+        Ensure that fields parameter contains a min and a max value
         within x min and x max range
         """
@@ -420,5 +414,5 @@
         self.maxi = float(self.xmaxFit.GetValue())
         flag = True
-        try: 
+        try:
             mini = float(usermin.GetValue())
             maxi = float(usermax.GetValue())
@@ -446,5 +440,5 @@
         if(self.xLabel == "x"):
             return transform.toX(x)
-        if(self.xLabel == "x^(2)"): 
+        if(self.xLabel == "x^(2)"):
             return transform.toX2(x)
         if(self.xLabel == "ln(x)"):
@@ -463,5 +457,5 @@
         if(self.xLabel == "x"):
             return transform.toX(x)
-        if(self.xLabel == "x^(2)"): 
+        if(self.xLabel == "x^(2)"):
             return transform.toX2(x)
         if(self.xLabel == "ln(x)"):
@@ -471,9 +465,9 @@
                 return x
             else:
-                raise ValueError,"cannot compute log of a negative number"
+                raise ValueError, "cannot compute log of a negative number"
             
     def floatInvTransform(self, x):
         """
-        transform a float.It is use to determine the x.View min and x.View 
+        transform a float.It is use to determine the x.View min and x.View
         max for values not in x
         
@@ -482,5 +476,5 @@
         # functionality work without rewritting the whole code
         # with good design (which really should be done...).
-        if(self.xLabel == "x^(2)"): 
+        if(self.xLabel == "x^(2)"):
             return math.sqrt(x)
         
@@ -488,5 +482,5 @@
             return math.pow(10, x)
         
-        elif(self.xLabel == "ln(x)"): 
+        elif(self.xLabel == "ln(x)"):
             return math.exp(x)
         return x
@@ -499,5 +493,5 @@
         value = item.GetValue()
         # Check for possible values entered
-        if (self.xLabel == "log10(x)") :#or self.xLabel=="ln(x)"):
+        if (self.xLabel == "log10(x)"):  #or self.xLabel=="ln(x)"):
             if(float(value) > 0):
                 item.SetBackgroundColour(wx.WHITE)
@@ -520,5 +514,5 @@
         Set the fit region
         :param xmin: minimum x-value to be included in fit
-        :param xmax: maximum x-value to be included in fit 
+        :param xmax: maximum x-value to be included in fit
         """
         # Check values
@@ -532,4 +526,5 @@
         self.xmaxFit.SetValue(format_number(xmax))
   
+  
 class MyApp(wx.App):
     """
@@ -540,7 +535,7 @@
         wx.InitAllImageHandlers()
         plot = Theory1D([], [])
-        dialog = LinearFit(parent=None, plottable=plot, 
+        dialog = LinearFit(parent=None, plottable=plot,
                            push_data=self.onFitDisplay,
-                           transform=self.returnTrans, 
+                           transform=self.returnTrans,
                             title='Linear Fit')
         if dialog.ShowModal() == wx.ID_OK:
@@ -558,8 +553,2 @@
         """
         return '', '', 0, 0, 0, 0, 0
-
-# end of class MyApp
-
-if __name__ == "__main__":
-    app = MyApp(0)
-    app.MainLoop()
Index: plottools/src/danse/common/plottools/fittings.py
===================================================================
--- plottools/src/danse/common/plottools/fittings.py	(revision cfe1febdfc9b97a963c7bfad0b460893be14e1ba)
+++ plottools/src/danse/common/plottools/fittings.py	(revision 10bfeb307197dbe02c1ab9ca2e868b076c0cd128)
@@ -2,5 +2,5 @@
 """
 from scipy import optimize
-#from numpy import *
+
 
 class Parameter:
@@ -21,8 +21,9 @@
 
     def __call__(self):
-        """ 
+        """
             Return the current value of the parameter
         """
         return self.model.getParam(self.name)
+    
     
 def sansfit(model, pars, x, y, err_y , qmin=None, qmax=None):
@@ -34,10 +35,9 @@
     :param x: vector of x data
     :param y: vector of y data
-    :param err_y: vector of y errors 
-    
+    :param err_y: vector of y errors
     """
     def f(params):
         """
-        Calculates the vector of residuals for each point 
+        Calculates the vector of residuals for each point
         in y for a given set of input parameters.
         
@@ -79,5 +79,6 @@
         chisqr = chi2([out])
         
-    return chisqr, out, cov_x    
+    return chisqr, out, cov_x
+
 
 def calcCommandline(event):
@@ -85,14 +86,10 @@
     # Fit a Line model
     from LineModel import LineModel
-    line    = LineModel()
+    line = LineModel()
     cstA = Parameter(line, 'A', event.cstA)
-    cstB  = Parameter(line, 'B', event.cstB)        
+    cstB = Parameter(line, 'B', event.cstB)
     y = line.run()
-    chisqr, out, cov = sansfit(line, [cstA, cstB],  event.x, y, 0) 
+    chisqr, out, cov = sansfit(line, [cstA, cstB], event.x, y, 0)
     # print "Output parameters:", out
     print "The right answer is [70.0, 1.0]"
     print chisqr, out, cov
-
-if __name__ == "__main__": 
-    calcCommandline()
-
Index: plottools/src/danse/common/plottools/plottable_interactor.py
===================================================================
--- plottools/src/danse/common/plottools/plottable_interactor.py	(revision 82a54b89c2fb14de05cf41239d597f5e7cb6df9b)
+++ plottools/src/danse/common/plottools/plottable_interactor.py	(revision 10bfeb307197dbe02c1ab9ca2e868b076c0cd128)
@@ -17,6 +17,6 @@
         self.color = color
         self.colorlist = ['b', 'g', 'r', 'c', 'm', 'y', 'k']
-        self.symbollist = ['o', 'x', '^', 'v', '<', '>', 
-                           '+', 's', 'd', 'D', 'h', 'H', 'p','-']
+        self.symbollist = ['o', 'x', '^', 'v', '<', '>',
+                           '+', 's', 'd', 'D', 'h', 'H', 'p', '-']
         self.markersize = None
         self.marker = None
@@ -35,6 +35,6 @@
         return self.symbollist[s % len(self.symbollist)]
 
-    def points(self, x, y, dx=None, dy=None, color=0, symbol=0, markersize=5, label=None, 
-               hide_error=False):
+    def points(self, x, y, dx=None, dy=None, color=0, symbol=0, markersize=5,
+               label=None, hide_error=False):
         """
         """
@@ -66,24 +66,23 @@
                 zorder = 1
                 self.marker = self.axes.plot(x, y, color=self.color,
-                                         marker=self._symbol(symbol),
-                                         markersize=markersize,
-                                         linestyle='', label=label,
-                                         zorder=zorder)[0]
+                                             marker=self._symbol(symbol),
+                                             markersize=markersize,
+                                             linestyle='', label=label,
+                                             zorder=zorder)[0]
             else:
                 zorder = 2
                 self.marker = self.axes.errorbar(x, y, yerr=dy,
-                                                  xerr=None,
-                                             ecolor=self.color, 
-                                             color=self.color,
-                                             capsize=2, 
-                                             linestyle='',
-                                            barsabove=False,
-                                            #mec=self.color, mfc=self.color,
-                                            marker=self._symbol(symbol),
-                                            markersize=markersize,
-                                            lolims=False, uplims=False,
-                                            xlolims=False, xuplims=False,
-                                            label=label,
-                                            zorder=zorder)[0]
+                                                 xerr=None,
+                                                 ecolor=self.color,
+                                                 color=self.color,
+                                                 capsize=2,
+                                                 linestyle='',
+                                                 barsabove=False,
+                                                 marker=self._symbol(symbol),
+                                                 markersize=markersize,
+                                                 lolims=False, uplims=False,
+                                                 xlolims=False, xuplims=False,
+                                                 label=label,
+                                                 zorder=zorder)[0]
             
         self.connect_markers([self.marker])
@@ -96,5 +95,5 @@
             self.base.connect.clear([self.marker])
         self.color = self._color(color)
-        self.marker = self.axes.plot(x, y, color=self.color, lw = 1.5,
+        self.marker = self.axes.plot(x, y, color=self.color, lw=1.5,
                                      marker='', linestyle='-', label=label)[0]
             
@@ -112,5 +111,4 @@
             connect('click', h, self._on_click)
             connect('release', h, self._on_release)
-            #connect('drag', h, self._on_drag)
             connect('key', h, self.onKey)
 
@@ -128,10 +126,10 @@
             self._on_leave(evt)
 
-    def _on_release(self, evt): 
+    def _on_release(self, evt):
         """
         Called when a mouse button is released
         within the boundaries of an artist
         """
-        # Check to see whether we are about to pop 
+        # Check to see whether we are about to pop
         # the context menu up
         if evt.button == 3:
@@ -148,5 +146,5 @@
             if evt.artist.get_color() == 'y':
                 try:
-                     evt.artist.set_color('b')
+                    evt.artist.set_color('b')
                 except:
                     evt.artist.set_color_cycle('b')
@@ -157,5 +155,5 @@
             else:
                 try:
-                     evt.artist.set_color('y')
+                    evt.artist.set_color('y')
                 except:
                     evt.artist.set_color_cycle('y')
@@ -181,5 +179,5 @@
                 if hasattr(evt.artist, "set_facecolor"):
                     evt.artist.set_facecolor(self.color)
-                if hasattr(evt.artist, "set_edgecolor"):            
+                if hasattr(evt.artist, "set_edgecolor"):
                     evt.artist.set_edgecolor(self.color)
                 self.axes.figure.canvas.draw_idle()
@@ -190,3 +188,2 @@
         """
         pass
-
Index: plottools/src/danse/common/plottools/plottables.py
===================================================================
--- plottools/src/danse/common/plottools/plottables.py	(revision 82a54b89c2fb14de05cf41239d597f5e7cb6df9b)
+++ plottools/src/danse/common/plottools/plottables.py	(revision 10bfeb307197dbe02c1ab9ca2e868b076c0cd128)
@@ -44,5 +44,4 @@
 import copy
 import numpy
-import math
 import sys
 
@@ -51,6 +50,8 @@
     def any(L):
         for cond in L:
-            if cond: return True
+            if cond:
+                return True
         return False
+    
     def all(L):
         for cond in L:
@@ -59,5 +60,5 @@
         return True
 
-# Graph structure for holding multiple plottables
+
 class Graph:
     """
@@ -129,6 +130,6 @@
         (as opposed to changing the basic properties)
         """
-        if units != "": 
-             name = "%s (%s)" % (name, units)
+        if units != "":
+            name = "%s (%s)" % (name, units)
         self.prop["xlabel"] = name
         self.prop["xunit"] = units
@@ -140,6 +141,6 @@
         (as opposed to changing the basic properties)
         """
-        if units != "": 
-             name = "%s (%s)" % (name, units)
+        if units != "":
+            name = "%s (%s)" % (name, units)
         self.prop["ylabel"] = name
         self.prop["yunit"] = units
@@ -149,6 +150,6 @@
         Properties of the x axis.
         """
-        if units != "": 
-             name = "%s (%s)" % (name, units)
+        if units != "":
+            name = "%s (%s)" % (name, units)
         self.prop["xlabel"] = name
         self.prop["xunit"] = units
@@ -160,6 +161,6 @@
         Properties of the y axis.
         """
-        if units != "": 
-             name = "%s (%s)" % (name, units)
+        if units != "":
+            name = "%s (%s)" % (name, units)
         self.prop["ylabel"] = name
         self.prop["yunit"] = units
@@ -200,5 +201,5 @@
         if plottable in self.plottables:
             return True
-        return False  
+        return False
 
     def add(self, plottable, color=None):
@@ -211,5 +212,5 @@
                 self.color += plottable.colors()
                 self.plottables[plottable] = self.color
-    	        
+
     def changed(self):
         """Detect if any graphed plottables have changed"""
@@ -250,5 +251,5 @@
         if plottable in self.plottables:
             del self.plottables[plottable]
-            self.color = len(self.plottables) 
+            self.color = len(self.plottables)
             
     def reset_scale(self):
@@ -263,7 +264,7 @@
         self.color = -1
         self.symbol = 0
-        self.prop = {"xlabel":"", "xunit":None,
-                     "ylabel":"","yunit":None,
-                     "title":""}
+        self.prop = {"xlabel": "", "xunit": None,
+                     "ylabel": "", "yunit": None,
+                     "title": ""}
         self.plottables = {}
     
@@ -297,5 +298,5 @@
         """
         This method returns a dictionary of plottables contained in graph
-        It is just by Plotpanel to interact with the complete list of plottables 
+        It is just by Plotpanel to interact with the complete list of plottables
         inside the graph.
         """
@@ -310,8 +311,8 @@
         for p in self.plottables:
             if p.custom_color is not None:
-                p.render(plot, color=p.custom_color, symbol=0, 
+                p.render(plot, color=p.custom_color, symbol=0,
                 markersize=p.markersize, label=labels[p])
             else:
-                p.render(plot, color=self.plottables[p], symbol=0, 
+                p.render(plot, color=self.plottables[p], symbol=0,
                      markersize=p.markersize, label=labels[p])
         plot.render()
@@ -346,5 +347,5 @@
         menu for the graph.
         
-    type: operational axis.  This determines whether the 
+    type: operational axis.  This determines whether the
         transform should appear on x,y or z axis context
         menus, or if it should appear in the context menu for
@@ -353,11 +354,11 @@
     inventory: (not implemented) 
         a dictionary of user settable parameter names and
-        their associated types.  These should appear as keyword 
-        arguments to the transform call.  For example, Fresnel 
+        their associated types.  These should appear as keyword
+        arguments to the transform call.  For example, Fresnel
         reflectivity requires the substrate density:
              { 'rho': type.Value(10e-6/units.angstrom**2) }
              
-        Supply reasonable defaults in the callback so that 
-        limited plotting clients work even though they cannot 
+        Supply reasonable defaults in the callback so that
+        limited plotting clients work even though they cannot
         set the inventory.
         
@@ -373,5 +374,5 @@
         the standard x,dx,y,dy,z,dz attributes appropriately.
         
-        If the call raises a NotImplemented error the dataline 
+        If the call raises a NotImplemented error the dataline
         will not be plotted.  The associated string will usually
         be 'Not a valid transform', though other strings are possible.
@@ -380,5 +381,5 @@
         
         """
-        raise NotImplemented,"Not a valid transform"
+        raise NotImplemented, "Not a valid transform"
 
     # Related issues
@@ -387,5 +388,5 @@
     # log scale:
     #    All axes have implicit log/linear scaling options.
-    # 
+    #
     # normalization:
     #    Want to display raw counts vs detector efficiency correction
@@ -401,5 +402,5 @@
     #
     # multiline graph:
-    #    How do we show/hide data parts.  E.g., data or theory, or 
+    #    How do we show/hide data parts.  E.g., data or theory, or
     #    different polarization cross sections?  One way is with
     #    tags: each plottable has a set of tags and the tags are
@@ -420,5 +421,5 @@
     """
     """
-    # Short ascii name to refer to the plottable in a menu   
+    # Short ascii name to refer to the plottable in a menu
     short_name = None
     # Fancy name
@@ -434,5 +435,5 @@
     interactive = True
     custom_color = None
-    markersize = 5 #default marker size is 'size 5'
+    markersize = 5  # default marker size is 'size 5'
     
     def __init__(self):
@@ -441,5 +442,5 @@
         self._xunit = ""
         self._yaxis = ""
-        self._yunit = "" 
+        self._yunit = ""
         
     def __setattr__(self, name, value):
@@ -495,5 +496,5 @@
     def labels(cls, collection):
         """
-        Construct a set of unique labels for a collection of plottables of 
+        Construct a set of unique labels for a collection of plottables of
         the same type.
         
@@ -509,6 +510,7 @@
             else:
                 for i in xrange(len(collection)):
-                    map[collection[i]] = "%s %d"%(basename, i)
+                    map[collection[i]] = "%s %d" % (basename, i)
         return map
+
     ##Use the following if @classmethod doesn't work
     # labels = classmethod(labels)
@@ -526,5 +528,5 @@
     def set_View(self, x, y):
         """Load View"""
-        self.x= x
+        self.x = x
         self.y = y
         self.reset_view()
@@ -541,7 +543,7 @@
         """
         The base class makes sure the correct units are being used for
-        subsequent plottable.  
-        
-        For now it is assumed that the graphs are commensurate, and if you 
+        subsequent plottable.
+        
+        For now it is assumed that the graphs are commensurate, and if you
         put a Qx object on a Temperature graph then you had better hope 
         that it makes sense.
@@ -560,5 +562,4 @@
         return False
         
-        
     def colors(self):
         """Return the number of colors need to render the object"""
@@ -577,21 +578,21 @@
         return self.view.returnXview()
     
-    def check_data_PlottableX(self): 
-        """
-        Since no transformation is made for log10(x), check that 
+    def check_data_PlottableX(self):
+        """
+        Since no transformation is made for log10(x), check that
         no negative values is plot in log scale
         """
         self.view.check_data_logX()
         
-    def check_data_PlottableY(self): 
+    def check_data_PlottableY(self):
         """
         Since no transformation is made for log10(y), check that 
         no negative values is plot in log scale
         """
-        self.view.check_data_logY() 
+        self.view.check_data_logY()
         
     def transformX(self, transx, transdx):
         """
-        Receive pointers to function that transform x and dx 
+        Receive pointers to function that transform x and dx
         and set corresponding View pointers
         
@@ -604,5 +605,5 @@
     def transformY(self, transy, transdy):
         """
-        Receive pointers to function that transform y and dy 
+        Receive pointers to function that transform y and dy
         and set corresponding View pointers
         
@@ -628,5 +629,6 @@
         """
         self.view.onFitRangeView(xmin, xmax)
-        
+    
+    
 class View:
     """
@@ -666,5 +668,5 @@
         :param x: array of x values
         :param y: array of y values
-        :param dx: array of  errors values on x 
+        :param dx: array of  errors values on x
         :param dy: array of error values on y
         
@@ -675,8 +677,8 @@
         has_err_y = not (dy == None or len(dy) == 0)
         
-        if(x != None) and (y != None): 
-            if not dx == None and not len(dx) == 0 and not len(x)== len(dx):
+        if(x != None) and (y != None):
+            if not dx == None and not len(dx) == 0 and not len(x) == len(dx):
                 msg = "Plottable.View: Given x and dx are not"
-                msg += " of the same length" 
+                msg += " of the same length"
                 raise ValueError, msg
             # Check length of y array
@@ -686,7 +688,7 @@
                 raise ValueError, msg
         
-            if not dy == None and not len(dy) == 0 and not len(y)==len(dy):
+            if not dy == None and not len(dy) == 0 and not len(y) == len(dy):
                 msg = "Plottable.View: Given y and dy are not of the same "
-                msg += "length: len(y)=%s, len(dy)=%s" %(len(y),len(dy))
+                msg += "length: len(y)=%s, len(dy)=%s" % (len(y), len(dy))
                 raise ValueError, msg
             self.x = []
@@ -708,6 +710,6 @@
             for i in range(len(x)):
                 try:
-                    tempx =self.funcx(x[i],y[i])
-                    tempy =self.funcy(y[i],x[i])
+                    tempx = self.funcx(x[i], y[i])
+                    tempy = self.funcy(y[i], x[i])
                     if has_err_x:
                         tempdx = self.funcdx(x[i], y[i], dx[i], dy[i])
@@ -727,13 +729,13 @@
             if not len(self.x) == len(self.y):
                 msg = "Plottable.View: transformed x "
-                msg += "and y are not of the same length" 
+                msg += "and y are not of the same length"
                 raise ValueError, msg
             if has_err_x and not (len(self.x) and len(self.dx)):
                 msg = "Plottable.View: transformed x and dx"
-                msg += " are not of the same length" 
+                msg += " are not of the same length"
                 raise ValueError, msg
             if has_err_y and not (len(self.y) and len(self.dy)):
                 msg = "Plottable.View: transformed y"
-                msg += " and dy are not of the same length" 
+                msg += " and dy are not of the same length"
                 raise ValueError, msg
             # Check that negative values are not plot on x and y axis for
@@ -750,6 +752,5 @@
         """
         Reset x,y,dx and y in their full range  and in the initial scale
-        in case their previous range has changed  
-        
+        in case their previous range has changed
         """
         self.x = self.Xreel
@@ -758,12 +759,11 @@
         self.dy = self.DYreel
         
-    def setTransformX(self, funcx, funcdx):  
-        """
-        Receive pointers to function that transform x and dx 
+    def setTransformX(self, funcx, funcdx):
+        """
+        Receive pointers to function that transform x and dx
         and set corresponding View pointers
         
         :param transx: pointer to function that transforms x
         :param transdx: pointer to function that transforms dx
-        
         """
         self.funcx = funcx
@@ -772,11 +772,10 @@
     def setTransformY(self, funcy, funcdy):
         """
-        Receive pointers to function that transform y and dy 
+        Receive pointers to function that transform y and dy
         and set corresponding View pointers
         
         :param transx: pointer to function that transforms y
         :param transdx: pointer to function that transforms dy
-        
-        """    
+        """
         self.funcy = funcy
         self.funcdy = funcdy
@@ -788,9 +787,8 @@
         return self.x, self.y, self.dx, self.dy
     
-    def check_data_logX(self): 
+    def check_data_logX(self):
         """
         Remove negative value in x vector to avoid plotting negative
         value of Log10
-        
         """
         tempx = []
@@ -802,5 +800,5 @@
         if self.dy == None:
             self.dy = numpy.zeros(len(self.y))
-        if self.xLabel == "log10(x)" :
+        if self.xLabel == "log10(x)":
             for i in range(len(self.x)):
                 try:
@@ -812,5 +810,5 @@
                 except:
                     print "check_data_logX: skipping point x %g" % self.x[i]
-                    print sys.exc_value  
+                    print sys.exc_value
                     pass 
             self.x = tempx
@@ -819,7 +817,7 @@
             self.dy = tempdy
         
-    def check_data_logY(self): 
-        """
-        Remove negative value in y vector 
+    def check_data_logY(self):
+        """
+        Remove negative value in y vector
         to avoid plotting negative value of Log10
         
@@ -833,7 +831,7 @@
         if self.dy == None:
             self.dy = numpy.zeros(len(self.y))
-        if (self.yLabel == "log10(y)" ):
+        if (self.yLabel == "log10(y)"):
             for i in range(len(self.x)):
-                 try:
+                try:
                     if (self.y[i] > 0):
                         tempx.append(self.x[i])
@@ -841,7 +839,7 @@
                         tempy.append(self.y[i])
                         tempdy.append(self.dy[i])
-                 except:
-                    print "check_data_logY: skipping point %g" %self.y[i]
-                    print sys.exc_value  
+                except:
+                    print "check_data_logY: skipping point %g" % self.y[i]
+                    print sys.exc_value
                     pass
             self.x = tempx
@@ -865,5 +863,5 @@
             self.dx = numpy.zeros(len(self.x))
         if self.dy == None:
-            self.dy=numpy.zeros(len(self.y))
+            self.dy = numpy.zeros(len(self.y))
         if (xmin != None) and (xmax != None):
             for i in range(len(self.x)):
@@ -876,6 +874,7 @@
             self.y = tempy
             self.dx = tempdx
-            self.dy = tempdy 
-                       
+            self.dy = tempdy
+
+              
 class Data2D(Plottable):
     """
@@ -910,5 +909,5 @@
         self._yunit = 'A^{-1}'
         
-        ### might remove that later 
+        ### might remove that later
         ## Vector of Q-values at the center of each bin in x
         self.x_bins = []
@@ -1003,5 +1002,5 @@
         plot.image(self.data, self.qx_data, self.qy_data,
                    self.xmin, self.xmax, self.ymin,
-                   self.ymax, self.zmin, self.zmax, **kw)    
+                   self.ymax, self.zmin, self.zmax, **kw)
        
     def changed(self):
@@ -1021,4 +1020,5 @@
             map[item] = item.label
         return map
+
 
 class Data1D(Plottable):
@@ -1060,10 +1060,10 @@
         if self.interactive == True:
             kw['symbol'] = self.symbol
-            kw['id'] =  self.id
+            kw['id'] = self.id
             kw['hide_error'] = self.hide_error
             kw['markersize'] = self.markersize
             plot.interactive_points(self.view.x, self.view.y,
                                     dx=self.view.dx, dy=self.view.dy,
-              name=self.name, **kw)            
+              name=self.name, **kw)
         else:
             kw['id'] =  self.id
@@ -1072,5 +1072,5 @@
             kw['color'] = self.custom_color
             kw['markersize'] = self.markersize
-            plot.points(self.view.x, self.view.y, dx=self.view.dx, 
+            plot.points(self.view.x, self.view.y, dx=self.view.dx,
                 dy=self.view.dy, marker=self.symbollist[self.symbol], **kw)
        
@@ -1089,4 +1089,5 @@
             map[item] = item.label
         return map
+    
     
 class Theory1D(Plottable):
@@ -1121,12 +1122,11 @@
         """
         """
-        if self.interactive==True:
-      
-            kw['id'] =  self.id
+        if self.interactive == True:
+            kw['id'] = self.id
             plot.interactive_curve(self.view.x, self.view.y,
                                    dy=self.view.dy,
                                    name=self.name, **kw)
         else:
-            kw['id'] =  self.id
+            kw['id'] = self.id
             plot.curve(self.view.x, self.view.y, dy=self.view.dy, **kw)
             
@@ -1139,6 +1139,4 @@
         map = {}
         for item in collection:
-            #map[item] = label(item, collection)
-            #map[item] = r"$\rm{%s}$" % item.name
             if item.label == "theory":
                 item.label = item.name
@@ -1175,4 +1173,5 @@
         return self.data.changed() or self.theory.changed()
 
+
 # ---------------------------------------------------------------
 class Text(Plottable):
@@ -1190,11 +1189,11 @@
         self.ypos = ypos
         
-    def render(self,plot,**kw):
+    def render(self, plot, **kw):
         """
         """
         from matplotlib import transforms
 
-        xcoords=transforms.blended_transform_factory(plot.subplot.transAxes,
-                                                     plot.subplot.transAxes)
+        xcoords = transforms.blended_transform_factory(plot.subplot.transAxes,
+                                                       plot.subplot.transAxes)
         plot.subplot.text(self.xpos,
                           self.ypos,
@@ -1206,5 +1205,5 @@
     def setText(self, text):
         """Set the text string."""
-        self.text =  text
+        self.text = text
 
     def getText(self, text):
@@ -1230,5 +1229,5 @@
 class Chisq(Plottable):
     """
-    Chisq plottable plots the chisq 
+    Chisq plottable plots the chisq
     """
     def __init__(self, chisq=None):
@@ -1265,5 +1264,5 @@
         Set the chisq value.
         """
-        self._chisq =  chisq
+        self._chisq = chisq
 
 
@@ -1275,9 +1274,9 @@
     # Construct a simple graph
     if False:
-        x = nx.array([1,2,3,4,5,6],'d')
-        y = nx.array([4,5,6,5,4,5],'d')
+        x = nx.array([1,2,3,4,5,6], 'd')
+        y = nx.array([4,5,6,5,4,5], 'd')
         dy = nx.array([0.2, 0.3, 0.1, 0.2, 0.9, 0.3])
     else:
-        x = nx.linspace(0,1.,10000)
+        x = nx.linspace(0, 1., 10000)
         y = nx.sin(2 * nx.pi * x * 2.8)
         dy = nx.sqrt(100 * nx.abs(y)) / 100
@@ -1289,5 +1288,6 @@
     graph.add(data)
     graph.add(Theory1D(x, y, dy=dy))
-    return graph 
+    return graph
+
 
 def demo_plotter(graph):
@@ -1306,23 +1306,20 @@
     
     class GraphUpdate:
-        callnum=0
+        callnum = 0
+        
         def __init__(self, graph, plotter):
             self.graph, self.plotter = graph, plotter
+        
         def __call__(self):
-            if self.graph.changed(): 
+            if self.graph.changed():
                 self.graph.render(self.plotter)
                 return True
             return False
+        
         def onIdle(self, event):
-            #print "On Idle checker %d"%(self.callnum)
             self.callnum = self.callnum + 1
             if self.__call__(): 
-                pass # event.RequestMore()
+                pass  # event.RequestMore()
     update = GraphUpdate(graph, plotter)
     frame.Bind(wx.EVT_IDLE, update.onIdle)
     app.MainLoop()
-
-import sys; print sys.version
-if __name__ == "__main__":
-    demo_plotter(sample_graph())
-    
Index: plottools/src/danse/common/plottools/toolbar.py
===================================================================
--- plottools/src/danse/common/plottools/toolbar.py	(revision 82a54b89c2fb14de05cf41239d597f5e7cb6df9b)
+++ plottools/src/danse/common/plottools/toolbar.py	(revision 10bfeb307197dbe02c1ab9ca2e868b076c0cd128)
@@ -1,10 +1,7 @@
-
 """
-this module overwrite matplotlib toolbar
-
+    This module overwrites matplotlib toolbar
 """
 import wx
 from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg
-from matplotlib.backends.backend_wx import _load_bitmap
 
 class NavigationToolBar(NavigationToolbar2WxAgg):
@@ -28,7 +25,7 @@
         """
         #delte reset button
-        self.DeleteToolByPos(0) 
+        self.DeleteToolByPos(0)
         #delete unwanted button that configures subplot parameters
-        self.DeleteToolByPos(5) 
+        self.DeleteToolByPos(5)
         
     def add_option(self):
@@ -41,12 +38,12 @@
         context_tip += '    For more menu options, \n'
         context_tip += '    right-click the data symbols.'
-        context =  wx.ArtProvider.GetBitmap(wx.ART_LIST_VIEW, wx.ART_TOOLBAR)
-        self.InsertSimpleTool(0, id_context, context, 
+        context = wx.ArtProvider.GetBitmap(wx.ART_LIST_VIEW, wx.ART_TOOLBAR)
+        self.InsertSimpleTool(0, id_context, context,
                                    context_tip, context_tip)
-        wx.EVT_TOOL(self, id_context,  self.on_menu)
+        wx.EVT_TOOL(self, id_context, self.on_menu)
         self.InsertSeparator(1)
         
         id_print = wx.NewId()
-        print_bmp =  wx.ArtProvider.GetBitmap(wx.ART_PRINT, wx.ART_TOOLBAR)
+        print_bmp = wx.ArtProvider.GetBitmap(wx.ART_PRINT, wx.ART_TOOLBAR)
         self.AddSimpleTool(id_print, print_bmp,
                            'Print', 'Activate printing')
@@ -54,5 +51,5 @@
         #add reset button
         id_reset = wx.NewId()
-        reset_bmp =  wx.ArtProvider.GetBitmap(wx.ART_GO_HOME, wx.ART_TOOLBAR)
+        reset_bmp = wx.ArtProvider.GetBitmap(wx.ART_GO_HOME, wx.ART_TOOLBAR)
         self.AddSimpleTool(id_reset, reset_bmp,
                            'Reset Graph Range', 'Reset graph range')
@@ -85,2 +82,3 @@
         except:
             pass
+        
Index: plottools/src/danse/common/plottools/transform.py
===================================================================
--- plottools/src/danse/common/plottools/transform.py	(revision 8d27cacc9b29b497ac295afb6f6125555a07cda4)
+++ plottools/src/danse/common/plottools/transform.py	(revision 10bfeb307197dbe02c1ab9ca2e868b076c0cd128)
@@ -1,3 +1,4 @@
-import math  
+import math
+         
          
 def toX(x, y=None):
@@ -12,4 +13,5 @@
     return x
 
+
 def toX_pos(x, y=None):
     """
@@ -26,4 +28,5 @@
         return x
 
+
 def toX2(x, y=None):
     """
@@ -37,4 +40,5 @@
     return x * x
 
+
 def fromX2(x, y=None):
     """
@@ -45,9 +49,10 @@
      
     """
-    if not x >= 0 :
+    if not x >= 0:
         raise ValueError, "square root of a negative value "
     else:
         return math.sqrt(x)
 
+
 def toX4(x, y=None):
     """
@@ -61,4 +66,5 @@
     return x * x * x * x
 
+
 def fromX4(x, y=None):
     """
@@ -69,9 +75,10 @@
      
     """
-    if not x >= 0 :
+    if not x >= 0:
         raise ValueError, "double square root of a negative value "
     else:
         return math.sqrt(math.sqrt(x))
          
+
 def toLogX(x, y=None):
     """
@@ -93,5 +100,6 @@
         return 1/x
     else:
-        raise ValueError,"cannot divide by zero"
+        raise ValueError, "cannot divide by zero"
+    
     
 def toOneOverSqrtX(y, x=None):
@@ -101,13 +109,15 @@
         return 1/math.sqrt(y)
     else:
-        raise ValueError,"transform.toOneOverSqrtX: cannot be computed"
+        raise ValueError, "transform.toOneOverSqrtX: cannot be computed"
+    
     
 def toLogYX2(y, x):
     """
     """
-    if (y *(x**2)) > 0:
+    if (y * (x**2)) > 0:
         return math.log(y * (x**2))
     else:
-         raise ValueError,"transform.toLogYX2: cannot be computed"
+        raise ValueError, "transform.toLogYX2: cannot be computed"
+     
      
 def toLogYX4(y, x):
@@ -117,5 +127,6 @@
         return math.log(math.pow(x,4) * y)
     else:
-         raise ValueError,"transform.toLogYX4: input error"
+        raise ValueError,"transform.toLogYX4: input error"
+     
      
 def toYX4(y, x):
@@ -123,4 +134,5 @@
     """
     return math.pow(x, 4) * y
+
 
 def toLogXY(y, x):
@@ -137,4 +149,5 @@
         return math.log(x * y)
 
+
 def errToX(x, y=None, dx=None, dy=None):
     """
@@ -149,4 +162,5 @@
     return dx
 
+
 def errToX_pos(x, y=None, dx=None, dy=None):
     """
@@ -158,6 +172,7 @@
     """
     if dx == None:
-        dx = 0   
+        dx = 0
     return dx
+
 
 def errToX2(x, y=None, dx=None, dy=None):
@@ -175,4 +190,5 @@
         return 0.0
     
+    
 def errFromX2(x, y=None, dx=None, dy=None):
     """
@@ -185,5 +201,5 @@
     if (x > 0):
         if(dx != None):
-            err = dx/(2 * math.sqrt(x))
+            err = dx / (2 * math.sqrt(x))
         else:
             err = 0
@@ -193,4 +209,5 @@
         raise ValueError, msg
 
+
 def errToX4(x, y=None, dx=None, dy=None):
     """
@@ -207,4 +224,5 @@
         return 0.0
     
+    
 def errFromX4(x, y=None, dx=None, dy=None):
     """
@@ -217,5 +235,5 @@
     if (x > 0):
         if(dx != None):
-            err = dx/(4 * math.pow(x, 3/4))
+            err = dx / (4 * math.pow(x, 3/4))
         else:
             err = 0
@@ -224,4 +242,5 @@
         msg = "transform.errFromX4: can't compute error of negative x"
         raise ValueError, msg
+ 
  
 def errToLog10X(x, y=None, dx=None, dy=None):
@@ -243,8 +262,9 @@
         raise ValueError, msg
     if x != 0:
-        dx = dx /(x * math.log(10))
+        dx = dx / (x * math.log(10))
     else:
         raise ValueError, "errToLogX: divide by zero"
     return dx
+    
     
 def errToLogX(x, y=None, dx=None, dy=None):
@@ -266,4 +286,5 @@
     return dx
 
+
 def errToYX2(x, y, dx=None, dy=None):
     """
@@ -274,5 +295,6 @@
         dy = 0
     err = math.sqrt((2 * x * y * dx)**2 + ((x**2) * dy)**2)
-    return err 
+    return err
+    
     
 def errToLogXY(x, y, dx=None, dy=None):
@@ -298,4 +320,5 @@
     return math.sqrt(math.fabs(err))
     
+    
 def errToLogYX2(x, y, dx=None, dy=None):
     """
@@ -317,5 +340,6 @@
     else:
         raise ValueError, "cannot compute this error"
-    return math.sqrt(math.fabs(err)) 
+    return math.sqrt(math.fabs(err))
+        
         
 def errOneOverX(x, y=None, dx=None, dy=None):
@@ -329,6 +353,7 @@
         err = dx/x**2
     else:
-        raise ValueError,"Cannot compute this error"
+        raise ValueError, "Cannot compute this error"
     return math.fabs(err)
+
 
 def errOneOverSqrtX(x, y=None, dx=None, dy=None):
@@ -344,4 +369,5 @@
         raise ValueError, "Cannot compute this error"
     return math.fabs(err)
+
 
 def errToLogYX4(x, y=None, dx=None, dy=None):
@@ -363,5 +389,6 @@
         dy = 0
     err = math.sqrt((4.0 * dx/x)**2  + (dy/y)**2)
-    return err 
+    return err
+
 
 def errToYX4(x, y=None, dx=None, dy=None):
@@ -380,4 +407,3 @@
         dy = 0
     err = math.sqrt((dy * pow(x, 4))**2  + (4 * y * dx * math.pow(x, 3))**2)
-    return err 
-           
+    return err
Index: plottools/src/danse/common/plottools/unitConverter.py
===================================================================
--- plottools/src/danse/common/plottools/unitConverter.py	(revision 82a54b89c2fb14de05cf41239d597f5e7cb6df9b)
+++ plottools/src/danse/common/plottools/unitConverter.py	(revision 10bfeb307197dbe02c1ab9ca2e868b076c0cd128)
@@ -1,11 +1,12 @@
-import re, string
+import re
+import string
 #Input   ->  new scale  ->  Output
 
-unit1 = "A^{-1} "#           x                    A^{-1}
+unit1 = "A^{-1} "  #             x                    A^{-1}
 unit2 = "A"  #                   x                     A
-unit3 = "A"  #                  x^2                  A^{2}
+unit3 = "A"  #                   x^2                  A^{2}
 unit4 = "A "  #                  1/x                  A^{-1}
-unit5 = "A^{0.5} " #        x^2                      A
-unit9 = "m^{1/2}" #         x^2               m
+unit5 = "A^{0.5} "  #        x^2                      A
+unit9 = "m^{1/2}"  #         x^2               m
 
 #If you don't recognize the pattern, give up
@@ -13,6 +14,6 @@
 
 unit6 = "m/s"  #                x^2               (m/s)^{2}
-unit7 = "m/s^{2}" #         1/x                 (m/s^{2})^{-1}
-unit8 = "m/s^{4}" #         x^2               (m/s^{4})^{2}
+unit7 = "m/s^{2}"  #         1/x                 (m/s^{2})^{-1}
+unit8 = "m/s^{4}"  #         x^2               (m/s^{4})^{2}
 
 
@@ -21,8 +22,8 @@
     """
     if pow != 0:
-        if string.find(unit, "^") != -1:# if the unit contains a power ^
+        if string.find(unit, "^") != -1:  # if the unit contains a power ^
             unitSplitted = re.split("\^", unit)
-            if string.find(unitSplitted[0],"/") != -1 or\
-                string.find(unitSplitted[0],"-") != -1 : # find slash /
+            if string.find(unitSplitted[0], "/") != -1 or\
+                string.find(unitSplitted[0], "-") != -1 :  # find slash /
                 if pow == 1:
                     unit = unit
@@ -30,29 +31,29 @@
                     unit = "("+unit+")" + "^{"+ str(pow) + "}"
             else:
-                if string.find(unitSplitted[1],"{") != -1:# if found a {
-                    findPower = re.split("{",unitSplitted[1])
-                    if string.find(findPower[1],"}") != -1:# found }
+                if string.find(unitSplitted[1], "{") != -1:  # if found a {
+                    findPower = re.split("{", unitSplitted[1])
+                    if string.find(findPower[1], "}") != -1:  # found }
                         unitPower = re.split("}", findPower[1])
-                        if(string.find(unitPower[0],".") != -1):
-                            power = float(unitPower[0]) * pow 
-                        elif(string.find(unitPower[0],"/") != -1): 
+                        if(string.find(unitPower[0], ".") != -1):
+                            power = float(unitPower[0]) * pow
+                        elif(string.find(unitPower[0], "/") != -1):
                             #power is a float
                             poweSplitted = re.split("/", unitPower[0])
                             power = pow * int(poweSplitted[0])\
-                                        /int(poweSplitted[1])
+                                         /int(poweSplitted[1])
                         else:
-                            power = int(unitPower[0]) * pow   
+                            power = int(unitPower[0]) * pow
                        
                         if power == 1.0:
-                           unit = unitSplitted[0]
+                            unit = unitSplitted[0]
                         elif power == 0.5:
-                            unit = unitSplitted[0] + "^{1/2}"  
+                            unit = unitSplitted[0] + "^{1/2}"
                         elif power == -0.5:
-                            unit = unitSplitted[0] + "^{-1/2}"  
+                            unit = unitSplitted[0] + "^{-1/2}"
                         else:
-                            unit = unitSplitted[0] + "^{" + str(power) + "}"  
+                            unit = unitSplitted[0] + "^{" + str(power) + "}"
                 else:
-                     raise ValueError, "missing } in unit expression" 
-        else:#no power
+                     raise ValueError, "missing } in unit expression"
+        else:  # no power
             if  pow != 1:
                 unit = "(" + unit + ")" + "^{" + str(pow) + "}"
@@ -60,22 +61,23 @@
         raise ValueError, "empty unit ,enter a power different from zero"
     return unit
+
+
 if __name__ == "__main__": 
     print "this unit1 %s ,its power %s , and value %s" % (unit1,
                                                 1, UnitConvertion(1, unit1))
-    print "this unit2 %s ,its power %s , and value %s" % (unit2,1,
+    print "this unit2 %s ,its power %s , and value %s" % (unit2, 1,
                                                 UnitConvertion(1, unit2))
-    print "this unit3 %s ,its power %s , and value %s" % (unit3, 2, 
+    print "this unit3 %s ,its power %s , and value %s" % (unit3, 2,
                                                     UnitConvertion(2, unit3))
-    print "this unit4 %s ,its power %s , and value %s" % (unit4, -1, 
+    print "this unit4 %s ,its power %s , and value %s" % (unit4, -1,
                                                 UnitConvertion(-1, unit4))
     print "this unit5 %s ,its power %s , and value %s" % (unit5, 2,
                                                     UnitConvertion(2, unit5))
-    print "this unit6 %s ,its power %s , and value %s" % (unit6, 2, 
+    print "this unit6 %s ,its power %s , and value %s" % (unit6, 2,
                                                     UnitConvertion(2, unit6))
-    print "this unit7 %s ,its power %s , and value %s" % (unit7, -1, 
+    print "this unit7 %s ,its power %s , and value %s" % (unit7, -1,
                                                     UnitConvertion(-1, unit7))
-    print "this unit8 %s ,its power %s , and value %s" % (unit8, 2, 
+    print "this unit8 %s ,its power %s , and value %s" % (unit8, 2,
                                                     UnitConvertion(2, unit8))
-    print "this unit9 %s ,its power %s , and value %s" % (unit9, 2, 
+    print "this unit9 %s ,its power %s , and value %s" % (unit9, 2,
                                                     UnitConvertion(2, unit9))
-    
