Index: src/sas/perspectives/fitting/batchfitpage.py
===================================================================
--- src/sas/perspectives/fitting/batchfitpage.py	(revision fa09d62cc24b9425dc926fced79d5ba20fa6fcd3)
+++ src/sas/perspectives/fitting/batchfitpage.py	(revision 2f4b43041eaa7b7f496750f223a299cb33cd268e)
@@ -1,3 +1,3 @@
-""" 
+"""
 Batch panel
 """
@@ -5,8 +5,8 @@
 import wx.lib.newevent
 import math
-from sas.guiframe.events import StatusEvent    
-from sas.guiframe.events import NewPlotEvent  
-
-(Chi2UpdateEvent, EVT_CHI2_UPDATE)   = wx.lib.newevent.NewEvent()
+from sas.guiframe.events import StatusEvent
+from sas.guiframe.events import NewPlotEvent
+
+(Chi2UpdateEvent, EVT_CHI2_UPDATE) = wx.lib.newevent.NewEvent()
 _BOX_WIDTH = 76
 _DATA_BOX_WIDTH = 300
@@ -24,14 +24,14 @@
     """
     window_name = "BatchFit"
-    window_caption  = "BatchFit"
+    window_caption = "BatchFit"
 
     def __init__(self, parent, color=None):
-        """ 
+        """
         Initialization of the Panel
         """
         FitPage.__init__(self, parent, color=color)
-        
+
         ## draw sizer
-        
+
     def _fill_data_sizer(self):
         """
@@ -53,14 +53,14 @@
         text2.SetForegroundColour(wx.RED)
         sizer_data.Add(text2)
-        
+
         combo = wx.BoxSizer(wx.HORIZONTAL)
         self.dataSource = wx.ComboBox(self, -1, style=wx.CB_READONLY)
         wx.EVT_COMBOBOX(self.dataSource, -1, self.on_select_data)
         self.dataSource.SetMinSize((_DATA_BOX_WIDTH, -1))
-        
+
         combo.Add(wx.StaticText(self, -1, 'Name : '))
-        combo.Add((0,5))
+        combo.Add((0, 5))
         combo.Add(self.dataSource)
-        
+
         sizer_data.Add(combo, 0, wx.ALL, 10)
         boxsizer1.Add(sizer_data, 0, wx.ALL, 0)
@@ -69,5 +69,5 @@
 
 #    COMMENTED OUT TO USE METHODS INHERITED FROM fitpage.py
-        
+
 #     def _fill_range_sizer(self):
 #         """
@@ -398,11 +398,11 @@
 #                                       caption=self.window_name)
 #             self._draw_model()
-    
-
-        
+
+
+
 class BGTextCtrl(wx.TextCtrl):
     """
     Text control used to display outputs.
-    No editing allowed. The background is 
+    No editing allowed. The background is
     grayed out. User can't select text.
     """
@@ -411,15 +411,15 @@
         self.SetEditable(False)
         self.SetBackgroundColour(self.GetParent().parent.GetBackgroundColour())
-        
+
         # Bind to mouse event to avoid text highlighting
         # The event will be skipped once the call-back
         # is called.
         self.Bind(wx.EVT_MOUSE_EVENTS, self._click)
-        
+
     def _click(self, event):
         """
         Prevent further handling of the mouse event
         by not calling Skip().
-        """ 
+        """
         pass
- 
+
Index: src/sas/perspectives/fitting/console.py
===================================================================
--- src/sas/perspectives/fitting/console.py	(revision b9a5f0eb8e8cbff8f8d934bbfa4ea18168141e13)
+++ src/sas/perspectives/fitting/console.py	(revision 2f4b43041eaa7b7f496750f223a299cb33cd268e)
@@ -2,5 +2,5 @@
 
 
-from sas.guiframe.events import StatusEvent 
+from sas.guiframe.events import StatusEvent
 import time
 import wx
@@ -13,18 +13,18 @@
     isbetter = False
     """Record whether results improved since last update"""
-    progress_delta =  60
+    progress_delta = 60
     """Number of seconds between progress updates"""
     improvement_delta = 5
     """Number of seconds between improvement updates"""
     def __init__(self, parent, manager=None,
-                 quiet=False,progress_delta=60,improvement_delta=5):
+                 quiet=False, progress_delta=60, improvement_delta=5):
         """
         If quiet is true, only print out final summary, not progress and
         improvements.
-        
+
         :attr parent: the object that handle the messages
-        
+
         """
-        self.parent= parent
+        self.parent = parent
         self.manager = manager
         self.progress_time = time.time()
@@ -38,6 +38,6 @@
         self.update_duration = time.time()
         self.fit_duration = 0
-        
-        
+
+
     def progress(self, k, n):
         """
@@ -47,6 +47,6 @@
 
         t = time.time()
-        p = int((100*k)//n)
-        
+        p = int((100 * k) // n)
+
         # Show improvements if there are any
         dt = t - self.improvement_time
@@ -56,7 +56,7 @@
             self.isbetter = False
             self.improvement_time = t
-       
+
         # Update percent complete
-        dp = p-self.progress_percent
+        dp = p - self.progress_percent
         if dp < 1: return
         dt = t - self.progress_time
@@ -67,13 +67,13 @@
                 self.update_fit()
             elif 2 < dp <= 5:
-                if p//5 != self.progress_percent//5:
+                if p // 5 != self.progress_percent // 5:
                     self.progress_percent = p
                     self.progress_time = t
             else:
-                if p//10 != self.progress_percent//10:
+                if p // 10 != self.progress_percent // 10:
                     self.progress_percent = p
                     self.progress_time = t
                     self.update_fit()
-        
+
     def improvement(self):
         """
@@ -82,5 +82,5 @@
         """
         self.isbetter = True
-    
+
     def print_result(self):
         """
@@ -89,5 +89,5 @@
         msg = " \n %s \n" % str(self.result)
         wx.PostEvent(self.parent, StatusEvent(status=msg))
-                     
+
     def error(self, msg):
         """
@@ -112,5 +112,5 @@
         wx.PostEvent(self.parent, StatusEvent(status=message,
                                    info="info", type="stop"))
-        
+
     def finalize(self):
         """
@@ -126,11 +126,11 @@
             #self.result.print_summary()
             self.update_fit()
-            
-        
+
+
     def update_fit(self, last=False):
         """
         """
         t1 = time.time()
-        self.elapsed_time =  t1 - self.update_duration
+        self.elapsed_time = t1 - self.update_duration
         self.update_duration = t1
         self.fit_duration += self.elapsed_time
@@ -147,5 +147,5 @@
                 d_flag = (hasattr(self.result, "data") and \
                     self.result.data is not None and \
-                    hasattr(self.result.data, "sas_data") and 
+                    hasattr(self.result.data, "sas_data") and
                     self.result.data.sas_data is not None)
                 m_flag = (hasattr(self.result, "model") and \
@@ -156,7 +156,7 @@
                     model_name = str(self.result.model.name)
                 if m_flag and d_flag:
-                    msg += "Data : %s \n"  % (str(data_name))#,
+                    msg += "Data : %s \n" % (str(data_name))#,
                                                      #str(model_name))
-                msg +=  str(self.result)
+                msg += str(self.result)
                 msg += "\n"
             else:
@@ -164,20 +164,20 @@
             wx.PostEvent(self.parent, StatusEvent(status=msg, info="info",
                                               type="progress"))
-     
+
     def starting_fit(self):
         """
         """
         wx.PostEvent(self.parent, StatusEvent(status="Starting the Fit...",
-                                        info="info",type="progress"))
-        
+                                        info="info", type="progress"))
+
     def set_result(self, result):
         """
         """
         self.result = result
-    
+
     def get_result(self):
         """
         """
         return self.result
-        
-    
+
+
Index: src/sas/perspectives/fitting/fit_thread.py
===================================================================
--- src/sas/perspectives/fitting/fit_thread.py	(revision 386ffe12ba023b3eab0fbbb16a6f958ed7c099a3)
+++ src/sas/perspectives/fitting/fit_thread.py	(revision 2f4b43041eaa7b7f496750f223a299cb33cd268e)
@@ -9,5 +9,5 @@
     Execute class.function and return result
     """
-    return  getattr(classInstance,classFunc)(*args)
+    return  getattr(classInstance, classFunc)(*args)
 
 def map_apply(arguments):
@@ -16,6 +16,6 @@
 class FitThread(CalcThread):
     """Thread performing the fit """
-    
-    def __init__(self, 
+
+    def __init__(self,
                  fn,
                  page_id,
@@ -24,9 +24,9 @@
                  batch_inputs=None,
                  pars=None,
-                 completefn = None,
-                 updatefn   = None,
-                 yieldtime  = 0.03,
-                 worktime   = 0.03,
-                 reset_flag = False):
+                 completefn=None,
+                 updatefn=None,
+                 yieldtime=0.03,
+                 worktime=0.03,
+                 reset_flag=False):
         CalcThread.__init__(self,
                  completefn,
@@ -44,9 +44,9 @@
         #Relative error desired in the sum of squares.
         self.reset_flag = reset_flag
-   
+
     def isquit(self):
         """
         :raise KeyboardInterrupt: when the thread is interrupted
-        
+
         """
         try:
@@ -55,8 +55,8 @@
             msg = "Fitting: terminated by the user."
             raise KeyboardInterrupt, msg
-       
+
     def compute(self):
         """
-        Perform a fit 
+        Perform a fit
         """
         msg = ""
@@ -64,5 +64,5 @@
             import copy
             list_handler = []
-            list_curr_thread = [] 
+            list_curr_thread = []
             list_reset_flag = []
             list_map_get_attr = []
@@ -78,15 +78,15 @@
             #from multiprocessing import Pool
             inputs = zip(list_map_get_attr, self.fitter, list_fit_function,
-                         list_q, list_q, list_handler,list_curr_thread,
+                         list_q, list_q, list_handler, list_curr_thread,
                          list_reset_flag)
-            result =  map(map_apply, inputs)
-    
+            result = map(map_apply, inputs)
+
             self.complete(result=result,
                           batch_inputs=self.batch_inputs,
                           batch_outputs=self.batch_outputs,
                           page_id=self.page_id,
-                          pars = self.pars,
-                          elapsed=time.time()-self.starttime)
-           
+                          pars=self.pars,
+                          elapsed=time.time() - self.starttime)
+
         except KeyboardInterrupt, msg:
             # Thread was interrupted, just proceed and re-raise.
@@ -95,5 +95,5 @@
             #Stop on exception during fitting. Todo: need to put 
             #some mssg and reset progress bar.
-            
+
             if self.handler is not None:
                 self.handler.stop(msg=msg)
@@ -102,5 +102,5 @@
             if self.handler is not None:
                 self.handler.error(msg=traceback.format_exc())
-           
-        
-    
+
+
+
Index: src/sas/perspectives/fitting/fitpage.py
===================================================================
--- src/sas/perspectives/fitting/fitpage.py	(revision 386ffe12ba023b3eab0fbbb16a6f958ed7c099a3)
+++ src/sas/perspectives/fitting/fitpage.py	(revision 2f4b43041eaa7b7f496750f223a299cb33cd268e)
@@ -32,5 +32,5 @@
     FitPanel class contains fields allowing to display results when
     fitting  a model and one data
-    
+
     :note: For Fit to be performed the user should check at least one parameter
         on fit Panel window.
@@ -42,5 +42,5 @@
         """
         BasicPage.__init__(self, parent, color=color)
-        
+
         ## draw sizer
         self._fill_data_sizer()
@@ -69,5 +69,5 @@
         self.create_default_data()
         #self._manager.frame.Bind(wx.EVT_SET_FOCUS, self.on_set_focus)
-    
+
     def enable_fit_button(self):
         """
@@ -76,5 +76,5 @@
         flag = check_data_validity(self.data) & (self.model is not None)
         self.btFit.Enable(flag)
-        
+
     def _fill_data_sizer(self):
         """
@@ -99,5 +99,5 @@
         self.sizer0.Add(boxsizer1, 0, wx.EXPAND | wx.ALL, 10)
         self.sizer0.Layout()
-        
+
     def enable_datasource(self):
         """
@@ -108,5 +108,5 @@
         else:
             self.dataSource.Enable()
-            
+
     def fill_data_combobox(self, data_list):
         """
@@ -143,5 +143,5 @@
         if len(data_list) == 1:
             self.dataSource.Disable()
-                
+
     def on_select_data(self, event=None):
         """
@@ -155,5 +155,5 @@
             data = self.dataSource.GetClientData(pos)
             self.set_data(data)
-    
+
     def _on_fit_complete(self):
         """
@@ -162,11 +162,11 @@
         self.fit_started = False
         self.set_fitbutton()
-        
+
     def _is_2D(self):
         """
         Check if data_name is Data2D
-        
+
         :return: True or False
-        
+
         """
         if self.data.__class__.__name__ == "Data2D" or \
@@ -174,5 +174,5 @@
             return True
         return False
-            
+
     def _on_engine_change(self, name):
         """
@@ -180,5 +180,5 @@
          and update the panel accordingly
         """
-        
+
         self.engine_type = str(name)
         self.state.engine_type = self.engine_type
@@ -189,5 +189,5 @@
             self.Layout()
             self.Refresh()
-        
+
     def _fill_range_sizer(self):
         """
@@ -196,10 +196,10 @@
         """
         is_2Ddata = False
-        
+
         # Check if data is 2D
         if self.data.__class__.__name__ == "Data2D" or \
                         self.enable2D:
             is_2Ddata = True
-            
+
         title = "Fitting"
         #smear messages & titles
@@ -218,7 +218,7 @@
         smear_message_slit_height_title = "Slit height[1/A]:"
         smear_message_slit_width_title = "Slit width[1/A]:"
-        
+
         self._get_smear_info()
-        
+
         #Sizers
         box_description_range = wx.StaticBox(self, -1, str(title))
@@ -233,5 +233,5 @@
         sizer_smearer_box = wx.StaticBoxSizer(smear_set_box, wx.HORIZONTAL)
         sizer_smearer_box.SetMinSize((_DATA_BOX_WIDTH, 60))
-        
+
         weighting_set_box = wx.StaticBox(self, -1, \
                                 'Set Weighting by Selecting dI Source')
@@ -268,7 +268,7 @@
         self.dI_idata.Enable(False)
         weighting_box.Add(sizer_weighting)
-        
+
         sizer_fit = wx.GridSizer(2, 4, 2, 6)
-        
+
         # combobox for smear2d accuracy selection
         self.smear_accuracy = wx.ComboBox(self, -1, size=(50, -1),
@@ -279,5 +279,5 @@
         self.smear_accuracy.SetToolTipString(\
             "'Higher' uses more Gaussian points for smearing computation.")
-                   
+
         wx.EVT_COMBOBOX(self.smear_accuracy, -1, self._on_select_accuracy)
 
@@ -287,5 +287,5 @@
         self.btFit.Bind(wx.EVT_BUTTON, self._onFit, id=self.btFit.GetId())
         self.btFit.SetToolTipString("Start fitting.")
-        
+
         #textcntrl for custom resolution
         self.smear_pinhole_max = self.ModelTextCtrl(self, -1,
@@ -343,5 +343,5 @@
                   id=self.slit_smearer.GetId())
         self.disable_smearer.SetValue(True)
-        
+
         # add 4 types of smearing to the sizer
         sizer_smearer.Add(self.disable_smearer, 0, wx.LEFT, 10)
@@ -353,5 +353,5 @@
         sizer_smearer.Add(self.slit_smearer)
         sizer_smearer.Add((10, 10))
-        
+
         # StaticText for chi2, N(for fitting), Npts + Log/linear spacing
         self.tcChi = BGTextCtrl(self, -1, "-", size=(75, 20), style=0)
@@ -367,5 +367,5 @@
         self.Npts_total.SetToolTipString(\
                                 " Total Npts : total number of data points")
-                
+
         # Update and Draw button
         self.draw_button = wx.Button(self, wx.NewId(),
@@ -374,11 +374,11 @@
                               self._onDraw, id=self.draw_button.GetId())
         self.draw_button.SetToolTipString("Compute and Draw.")
-        
-        self.points_sizer = wx.BoxSizer(wx.HORIZONTAL) 
+
+        self.points_sizer = wx.BoxSizer(wx.HORIZONTAL)
         self.pointsbox = wx.CheckBox(self, -1, 'Log?', (10, 10))
         self.pointsbox.SetValue(False)
         self.pointsbox.SetToolTipString("Check mark to use log spaced points")
         wx.EVT_CHECKBOX(self, self.pointsbox.GetId(), self.select_log)
-        
+
         self.points_sizer.Add(wx.StaticText(self, -1, 'Npts    '))
         self.points_sizer.Add(self.pointsbox)
@@ -389,5 +389,5 @@
         #box_description_3.SetToolTipString( \
         #                        " Total Npts : total number of data points")
-        
+
         sizer_fit.Add(box_description_1, 0, 0)
         sizer_fit.Add(box_description_2, 0, 0)
@@ -404,7 +404,7 @@
                                     smear_message_none, style=wx.ALIGN_LEFT)
         self.smear_description_dqdata = wx.StaticText(self,
-                                -1, smear_message_dqdata, style=wx.ALIGN_LEFT)
+                                - 1, smear_message_dqdata, style=wx.ALIGN_LEFT)
         self.smear_description_type = wx.StaticText(self,
-                                     -1, "Type:", style=wx.ALIGN_LEFT)
+                                     - 1, "Type:", style=wx.ALIGN_LEFT)
         self.smear_description_accuracy_type = wx.StaticText(self, -1,
                                         "Accuracy:", style=wx.ALIGN_LEFT)
@@ -435,5 +435,5 @@
         self.smear_description_slit_width = wx.StaticText(self, -1,
                         smear_message_slit_width_title, style=wx.ALIGN_LEFT)
-        
+
         #arrange sizers
         self.sizer_set_smearer.Add(sizer_smearer)
@@ -468,19 +468,19 @@
         self.sizer_new_smear.Add((20, -1))
         self.sizer_new_smear.Add(self.smear_description_2d_y,
-                                  0, wx.CENTER, 10 )
+                                  0, wx.CENTER, 10)
         self.sizer_new_smear.Add(self.smear_description_pin_max,
-                                  0, wx.CENTER, 10 )
+                                  0, wx.CENTER, 10)
         self.sizer_new_smear.Add(self.smear_description_slit_width,
-                                  0, wx.CENTER, 10 )
+                                  0, wx.CENTER, 10)
 
         self.sizer_new_smear.Add(self.smear_pinhole_max, 0, wx.CENTER, 10)
         self.sizer_new_smear.Add(self.smear_slit_width, 0, wx.CENTER, 10)
         self.sizer_new_smear.Add(self.smear_data_right, 0, wx.CENTER, 10)
-           
+
         self.sizer_set_smearer.Add(self.smear_message_new_s, 0, wx.CENTER, 10)
         self.sizer_set_smearer.Add(self.smear_message_new_p, 0, wx.CENTER, 10)
         self.sizer_set_smearer.Add((5, 2))
         self.sizer_set_smearer.Add(self.sizer_new_smear, 0, wx.CENTER, 10)
-        
+
         # add all to chi2 sizer
         sizer_smearer_box.Add(self.sizer_set_smearer)
@@ -489,8 +489,8 @@
         sizer_chi2.Add(weighting_box)
         sizer_chi2.Add((-1, 5))
-        
+
         # hide all smear messages and textctrl
         self._hide_all_smear_info()
-        
+
         # get smear_selection
         self.current_smearer = smear_selection(self.data, self.model)
@@ -513,11 +513,11 @@
         #2D data? default
         is_2Ddata = False
-        
+
         #check if it is 2D data
         if self.data.__class__.__name__ == "Data2D" or self.enable2D:
             is_2Ddata = True
-            
+
         self.sizer5.Clear(True)
-     
+
         self.qmin = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20),
                                     style=wx.TE_PROCESS_ENTER,
@@ -530,5 +530,5 @@
         qmin_tip += q_tip
         self.qmin.SetToolTipString(qmin_tip)
-     
+
         self.qmax = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20),
                                        style=wx.TE_PROCESS_ENTER,
@@ -548,8 +548,8 @@
         id = wx.NewId()
         self.reset_qrange = wx.Button(self, id, 'Reset', size=(77, 20))
-      
+
         self.reset_qrange.Bind(wx.EVT_BUTTON, self.on_reset_clicked, id=id)
         self.reset_qrange.SetToolTipString("Reset Q range to the default")
-     
+
         sizer = wx.GridSizer(2, 4, 2, 6)
 
@@ -559,5 +559,5 @@
         self.btEditMask.SetToolTipString("Edit Mask.")
         self.EditMask_title = wx.StaticText(self, -1, ' Masking(2D)')
-        
+
         sizer.Add(wx.StaticText(self, -1, '   Q range'))
         sizer.Add(wx.StaticText(self, -1, ' Min[1/A]'))
@@ -572,5 +572,5 @@
         boxsizer_range.Add((10, 10))
         boxsizer_range.Add(sizer)
-        
+
         boxsizer_range.Add((10, 15))
         boxsizer_range.Add(sizer_fit)
@@ -586,5 +586,5 @@
         self.sizer5.Layout()
 
-        
+
     def _set_sizer_dispersion(self):
         """
@@ -602,7 +602,7 @@
             ## the user didn't select dispersity display
             return
-            
+
         self._reset_dispersity()
-        
+
         ## fill a sizer with the combobox to select dispersion type
         model_disp = wx.StaticText(self, -1, 'Function')
@@ -632,5 +632,5 @@
         self.sizer4_4.Add(self.text_disp_1, (iy, ix), (1, 1), \
                           wx.EXPAND | wx.ADJUST_MINSIZE, 0)
-        
+
         ix += 1
         self.text_disp_min = wx.StaticText(self, -1, 'Min')
@@ -642,5 +642,5 @@
         self.sizer4_4.Add(self.text_disp_max, (iy, ix), (1, 1),
                           wx.EXPAND | wx.ADJUST_MINSIZE, 0)
-       
+
         ix += 1
         npts = wx.StaticText(self, -1, 'Npts')
@@ -660,5 +660,5 @@
         self.sizer4_4.Add(model_disp, (iy, ix), (1, 1),
                           wx.EXPAND | wx.ADJUST_MINSIZE, 0)
-        
+
         self.text_disp_max.Show(True)
         self.text_disp_min.Show(True)
@@ -680,5 +680,5 @@
                 iy += 1
                 for p in self.model.dispersion[item].keys():
-        
+
                     if p == "width":
                         ix = 0
@@ -713,5 +713,5 @@
                                            size=(_BOX_WIDTH / 1.3, 20),
                                            style=0)
-                  
+
                         self.sizer4_4.Add(ctl2, (iy, ix), (1, 1),
                                           wx.EXPAND | wx.ADJUST_MINSIZE, 0)
@@ -724,8 +724,8 @@
                                                   style=wx.TE_PROCESS_ENTER,
                                 text_enter_callback=self._onparamRangeEnter)
-                        
+
                         self.sizer4_4.Add(ctl3, (iy, ix), (1, 1),
                                           wx.EXPAND | wx.ADJUST_MINSIZE, 0)
-                       
+
                         ix = 5
                         ctl4 = self.ModelTextCtrl(self, -1,
@@ -733,5 +733,5 @@
                                                   style=wx.TE_PROCESS_ENTER,
                             text_enter_callback=self._onparamRangeEnter)
-                        
+
                         self.sizer4_4.Add(ctl4, (iy, ix), (1, 1),
                                           wx.EXPAND | wx.ADJUST_MINSIZE, 0)
@@ -739,5 +739,5 @@
                         ctl3.Show(True)
                         ctl4.Show(True)
-                                                              
+
                     elif p == "npts":
                         ix = 6
@@ -746,5 +746,5 @@
                                                   size=(_BOX_WIDTH / 2.2, 20),
                                                   style=wx.TE_PROCESS_ENTER)
-                        
+
                         Tctl.SetValue(str(format_number(value)))
                         self.sizer4_4.Add(Tctl, (iy, ix), (1, 1),
@@ -758,5 +758,5 @@
                                                   size=(_BOX_WIDTH / 2.2, 20),
                                                   style=wx.TE_PROCESS_ENTER)
-                        
+
                         Tct2.SetValue(str(format_number(value)))
                         self.sizer4_4.Add(Tct2, (iy, ix), (1, 1),
@@ -777,5 +777,5 @@
                 self.fittable_param.append([cb, name1, ctl1, text2,
                                             ctl2, ctl3, ctl4, disp_box])
-                           
+
         ix = 0
         iy += 1
@@ -794,11 +794,11 @@
                 name2 = item + ".npts"
                 name3 = item + ".nsigmas"
-                
+
                 if not name1 in self.model.details:
                     self.model.details[name1] = ["", None, None]
- 
+
                 iy += 1
                 for p in self.model.dispersion[item].keys():
-        
+
                     if p == "width":
                         ix = 0
@@ -832,5 +832,5 @@
                                 poly_text += "It is the STD (ratio*mean)"
                                 poly_text += " of the distribution.\n "
-                            
+
                                 values.SetToolTipString(poly_text)
                                 first_orient = False
@@ -838,5 +838,5 @@
                         elif ctl1.IsShown():
                             ctl1.Hide()
-                        
+
                         self.sizer4_4.Add(ctl1, (iy, ix), (1, 1), wx.EXPAND)
                         ## text to show error sign
@@ -852,5 +852,5 @@
                                            size=(_BOX_WIDTH / 1.3, 20),
                                            style=0)
-                    
+
                         self.sizer4_4.Add(ctl2, (iy, ix), (1, 1),
                                           wx.EXPAND | wx.ADJUST_MINSIZE, 0)
@@ -862,5 +862,5 @@
                                 text2.Show(True)
                                 ctl2.Show(True)
-                            
+
                         ix = 4
                         ctl3 = self.ModelTextCtrl(self, -1,
@@ -873,5 +873,5 @@
 
                         ctl3.Hide()
-                
+
                         ix = 5
                         ctl4 = self.ModelTextCtrl(self, -1,
@@ -882,10 +882,10 @@
                                           wx.EXPAND | wx.ADJUST_MINSIZE, 0)
                         ctl4.Hide()
-                        
+
                         if self.data.__class__.__name__ == "Data2D" or \
                                 self.enable2D:
                             ctl3.Show(True)
                             ctl4.Show(True)
-                             
+
                     elif p == "npts":
                         ix = 6
@@ -894,5 +894,5 @@
                                                  size=(_BOX_WIDTH / 2.2, 20),
                                                  style=wx.TE_PROCESS_ENTER)
-                        
+
                         Tctl.SetValue(str(format_number(value)))
                         if self.data.__class__.__name__ == "Data2D" or \
@@ -914,5 +914,5 @@
                                                   size=(_BOX_WIDTH / 2.2, 20),
                                                   style=wx.TE_PROCESS_ENTER)
-                        
+
                         Tct2.SetValue(str(format_number(value)))
                         if self.data.__class__.__name__ == "Data2D" or \
@@ -926,5 +926,5 @@
                         self.fixed_param.append([None, name3, Tct2,
                                                  None, None, None, None, None])
-                                                   
+
                         self.orientation_params_disp.append([None, name3,
                                         Tct2, None, None, None, None, None])
@@ -943,5 +943,5 @@
                 self.orientation_params_disp.append([cb, name1, ctl1,
                                             text2, ctl2, ctl3, ctl4, disp_box])
-                       
+
                 if self.data.__class__.__name__ == "Data2D" or \
                                 self.enable2D:
@@ -949,7 +949,7 @@
                 else:
                     disp_box.Hide()
-        
+
         self.state.disp_cb_dict = copy.deepcopy(self.disp_cb_dict)
-          
+
         self.state.model = self.model.clone()
         ## save state into
@@ -984,5 +984,5 @@
         """
         flag = self._update_paramv_on_fit()
-    
+
         wx.CallAfter(self._onparamEnter_helper)
         if not flag:
@@ -990,5 +990,5 @@
             wx.PostEvent(self._manager.parent, StatusEvent(status=msg))
             return
-        
+
     def _onFit(self, event):
         """
@@ -1015,5 +1015,5 @@
                          StatusEvent(status="Fit: %s" % msg, type="stop"))
             return
-        
+
         if len(self.param_toFit) <= 0:
             msg = "Select at least one parameter to fit"
@@ -1022,11 +1022,11 @@
                          StatusEvent(status=msg, type="stop"))
             return
-        
+
         flag = self._update_paramv_on_fit()
-        
+
         if self.batch_on and not self._is_2D():
             if not self._validate_Npts_1D():
                 return
-                
+
         if not flag:
             msg = "Fitting range or parameters are invalid"
@@ -1034,5 +1034,5 @@
                          StatusEvent(status=msg, type="stop"))
             return
-              
+
         self.select_param(event=None)
 
@@ -1050,5 +1050,5 @@
         self.fit_started = self._manager.onFit(uid=self.uid)
         wx.CallAfter(self.set_fitbutton)
-    
+
     def set_fitbutton(self):
         """
@@ -1059,5 +1059,5 @@
         if self.is_mac:
             return
-        
+
         if self.fit_started:
             label = "Stop"
@@ -1070,5 +1070,5 @@
         self.btFit.SetForegroundColour(color)
         self.btFit.Enable(True)
-                     
+
     def get_weight_flag(self):
         """
@@ -1092,5 +1092,5 @@
                 break
         return flag
-                
+
     def _StopFit(self, event=None):
         """
@@ -1102,5 +1102,5 @@
         self._manager._reset_schedule_problem(value=0)
         self._on_fit_complete()
-         
+
     def rename_model(self):
         """
@@ -1109,5 +1109,5 @@
         if self.model is not None:
             self.model.name = "M" + str(self.index_model)
-    
+
     def _on_select_model(self, event=None):
         """
@@ -1141,5 +1141,5 @@
         self.state.pinhole_smearer = self.pinhole_smearer.GetValue()
         self.state.slit_smearer = self.slit_smearer.GetValue()
-    
+
         self.state.structurecombobox = self.structurebox.GetLabel()
         self.state.formfactorcombobox = self.formfactorbox.GetLabel()
@@ -1161,8 +1161,8 @@
                 self.disable_smearer.SetValue(True)
                 self.enable_smearer.SetValue(False)
-    
+
             # more disables for 2D
             self._set_smear_buttons()
-            
+
             try:
                 # update smearer sizer
@@ -1180,5 +1180,5 @@
             ## event to post model to fit to fitting plugins
             (ModelEventbox, EVT_MODEL_BOX) = wx.lib.newevent.NewEvent()
-         
+
             ## set smearing value whether or not
             #    the data contain the smearing info
@@ -1190,7 +1190,7 @@
                             caption=self.window_caption,
                             qmax=float(self.qmax_x))
-   
+
             self._manager._on_model_panel(evt=evt)
-            self.mbox_description.SetLabel("Model [ %s ]"% str(self.model.name))
+            self.mbox_description.SetLabel("Model [ %s ]" % str(self.model.name))
             self.mbox_description.SetForegroundColour(wx.BLUE)
             self.state.model = self.model.clone()
@@ -1225,8 +1225,8 @@
                 self.get_paste_params(copy_flag)
                 wx.CallAfter(self._onDraw, None)
-                
+
         else:
             self._draw_model()
-            
+
         if self.batch_on:
             self.slit_smearer.Enable(False)
@@ -1234,8 +1234,8 @@
             self.btEditMask.Disable()
             self.EditMask_title.Disable()
-            
+
         self.Show(True)
         self.SetupScrolling()
-         
+
     def _onparamEnter(self, event):
         """
@@ -1282,5 +1282,5 @@
                 if flag:
                     #self.compute_chisqr(smearer= temp_smearer)
-        
+
                     ## new state posted
                     if self.state_change:
@@ -1297,8 +1297,8 @@
             msg = "Cannot Plot :Must enter a number!!!  "
             wx.PostEvent(self._manager.parent, StatusEvent(status=msg))
-             
+
         self.save_current_state()
         return
-   
+
     def _onparamRangeEnter(self, event):
         """
@@ -1323,5 +1323,5 @@
         else:
             tcrtl.SetBackgroundColour(wx.WHITE)
-           
+
         #self._undo.Enable(True)
         self.save_current_state()
@@ -1329,6 +1329,6 @@
         wx.PostEvent(self.parent, event)
         self.state_change = False
-        
-    def qrang_set_focus(self, event=None):  
+
+    def qrang_set_focus(self, event=None):
         """
         ON Qrange focus
@@ -1338,5 +1338,5 @@
         #tcrtl = event.GetEventObject()
         self._validate_qrange(self.qmin, self.qmax)
-        
+
     def qrange_click(self, event):
         """
@@ -1352,9 +1352,9 @@
             d_group_id = self.data.group_id
             act_ctrl = event.GetEventObject()
-            wx.PostEvent(self._manager.parent, 
-                         PlotQrangeEvent(ctrl=[self.qmin, self.qmax], id=d_id, 
+            wx.PostEvent(self._manager.parent,
+                         PlotQrangeEvent(ctrl=[self.qmin, self.qmax], id=d_id,
                                      group_id=d_group_id, leftdown=is_click,
                                      active=act_ctrl))
-            
+
     def on_qrange_text(self, event):
         """
@@ -1368,11 +1368,11 @@
         d_id = self.data.id
         d_group_id = self.data.group_id
-        wx.PostEvent(self._manager.parent, 
-                     PlotQrangeEvent(ctrl=[self.qmin, self.qmax], id=d_id, 
-                                     group_id=d_group_id, leftdown=False, 
+        wx.PostEvent(self._manager.parent,
+                     PlotQrangeEvent(ctrl=[self.qmin, self.qmax], id=d_id,
+                                     group_id=d_group_id, leftdown=False,
                                      active=act_ctrl))
         self._validate_qrange(self.qmin, self.qmax)
-    
-    def on_key(self, event):   
+
+    def on_key(self, event):
         """
         On Key down
@@ -1385,5 +1385,5 @@
             x_data = float(ctrl.GetValue())
         except:
-            return 
+            return
         key = event.GetKeyCode()
         length = len(self.data.x)
@@ -1402,5 +1402,5 @@
         ctrl.SetValue(str(self.data.x[indx]))
         self._validate_qrange(self.qmin, self.qmax)
-               
+
     def _onQrangeEnter(self, event):
         """
@@ -1463,5 +1463,5 @@
                               (self.data.x <= self.qmax_x))
                 self.Npts_fit.SetValue(str(len(self.data.x[index_data])))
-            
+
             self.npts_x = self.Npts_total.GetValue()
             self.create_default_data()
@@ -1471,5 +1471,5 @@
             msg = "Model Error:wrong value entered!!!"
             wx.PostEvent(self._manager.parent, StatusEvent(status=msg))
-        
+
         self._draw_model()
         self.save_current_state()
@@ -1478,5 +1478,5 @@
         self.state_change = False
         return
-    
+
     def _clear_Err_on_Fit(self):
         """
@@ -1508,5 +1508,5 @@
                     if item[4] != None and item[4].IsShown():
                         item[4].Hide()
-  
+
         if len(self.fittable_param) > 0:
             for item in self.fittable_param:
@@ -1528,5 +1528,5 @@
                         item[4].Hide()
         return
-                
+
     def _get_defult_custom_smear(self):
         """
@@ -1542,9 +1542,9 @@
         if self.dx_max == None:
             self.dx_max = SMEAR_SIZE_H
-        
+
     def _get_smear_info(self):
         """
         Get the smear info from data.
-       
+
         :return: self.smear_type, self.dq_l and self.dq_r,
             respectively the type of the smear, dq_min and
@@ -1577,5 +1577,5 @@
             self.dq_l = data.dx[0]
             self.dq_r = data.dx[-1]
-            
+
         # check if it is slit smear and get min max if it is.
         elif data.dxl != None or data.dxw != None:
@@ -1586,5 +1586,5 @@
                 self.dq_r = data.dxw[0]
         #return self.smear_type,self.dq_l,self.dq_r
-    
+
     def _show_smear_sizer(self):
         """
@@ -1650,5 +1650,5 @@
         self.smear_description_2d_y.Hide()
         self.smear_description_2d.Hide()
-        
+
         self.smear_accuracy.Hide()
         self.smear_data_left.Hide()
@@ -1664,5 +1664,5 @@
         self.smear_message_new_p.Hide()
         self.smear_message_new_s.Hide()
-    
+
     def _set_accuracy_list(self):
         """
@@ -1674,5 +1674,5 @@
         for idx in range(len(list)):
             self.smear_accuracy.Append(list[idx], idx)
-            
+
     def _set_fun_box_list(self, fun_box):
         """
@@ -1695,5 +1695,5 @@
                     break
             ind += 1
-        
+
     def _on_select_accuracy(self, event):
         """
@@ -1710,5 +1710,5 @@
             if self.current_smearer != None:
                 self.current_smearer.set_accuracy(accuracy=\
-                                                  self.smear2d_accuracy) 
+                                                  self.smear2d_accuracy)
         event.Skip()
 
@@ -1735,5 +1735,5 @@
         # get ready for new event
         event.Skip()
-        
+
     def _onMask(self, event):
         """
@@ -1742,8 +1742,8 @@
         from sas.guiframe.local_perspectives.plotting.masking \
         import MaskPanel as MaskDialog
-        
+
         self.panel = MaskDialog(base=self, data=self.data, id=wx.NewId())
         self.panel.ShowModal()
-        
+
     def _draw_masked_model(self, event):
         """
@@ -1797,5 +1797,5 @@
         """
         return self.enable2D
-    
+
     def compute_data_set_range(self, data_list):
         """
@@ -1810,5 +1810,5 @@
                 self.npts_data_set += npts
         return self.qmin_data_set, self.qmax_data_set, self.npts_data_set
-        
+
     def compute_data_range(self, data):
         """
@@ -1826,10 +1826,10 @@
                     npts = len(data.x)
                 except:
-                    msg = "Unable to find min/max/length of \n data named %s"% \
-                                data.filename  
+                    msg = "Unable to find min/max/length of \n data named %s" % \
+                                data.filename
                     wx.PostEvent(self._manager.parent, StatusEvent(status=msg,
                                                info="error"))
                     raise ValueError, msg
-                    
+
             else:
                 qmin = 0
@@ -1838,6 +1838,6 @@
                     y = max(math.fabs(data.ymin), math.fabs(data.ymax))
                 except:
-                    msg = "Unable to find min/max of \n data named %s"% \
-                                data.filename  
+                    msg = "Unable to find min/max of \n data named %s" % \
+                                data.filename
                     wx.PostEvent(self._manager.parent, StatusEvent(status=msg,
                                                info="error"))
@@ -1847,5 +1847,5 @@
                 npts = len(data.data)
         return qmin, qmax, npts
-            
+
     def set_data(self, data):
         """
@@ -1874,5 +1874,5 @@
             self.graph_id = data.group_id
         self.data.group_id = self.graph_id
-        
+
         if self.data is None:
             data_name = ""
@@ -1884,5 +1884,5 @@
                 self._set_bookmark_flag(not self.batch_on)
                 self._keep.Enable(not self.batch_on)
-            if self.data.is_data:    
+            if self.data.is_data:
                 self._set_save_flag(True)
                 self._set_preview_flag(True)
@@ -1922,5 +1922,5 @@
             self.dI_sqrdata.Enable(True)
             self.dI_idata.Enable(True)
-              
+
             self.formfactorbox.Enable()
             self.structurebox.Enable()
@@ -1934,5 +1934,5 @@
                 self.btEditMask.Enable()
                 self.EditMask_title.Enable()
-    
+
         self.Npts_total.SetValue(str(npts))
         #default:number of data points selected to fit
@@ -1941,5 +1941,5 @@
         self.Npts_total.SetBackgroundColour(\
                                     self.GetParent().GetBackgroundColour())
-        
+
         self.Npts_total.Bind(wx.EVT_MOUSE_EVENTS, self._npts_click)
         self.pointsbox.Disable()
@@ -1952,5 +1952,5 @@
         if check_data_validity(data):
             self.data_box_description.SetForegroundColour(wx.BLUE)
-        
+
         if self.batch_on:
             self.slit_smearer.Enable(False)
@@ -1988,5 +1988,5 @@
                                       title=str(self.data.title)))
             self._draw_model()
-    
+
     def _npts_click(self, event):
         """
@@ -1995,5 +1995,5 @@
         """
         pass
-    
+
     def reset_page(self, state, first=False):
         """
@@ -2002,5 +2002,5 @@
         try:
             self.reset_page_helper(state)
-    
+
             self.select_param(event=None)
             #Save state_fit
@@ -2010,10 +2010,10 @@
             msg = "Error: This model state has missing or outdated "
             msg += "information.\n"
-            msg += "%s"% (sys.exc_value)
+            msg += "%s" % (sys.exc_value)
             wx.PostEvent(self._manager.parent,
                          StatusEvent(status=msg, info="error"))
         self._lay_out()
         self.Refresh()
-        
+
     def get_range(self):
         """
@@ -2021,11 +2021,11 @@
         """
         return float(self.qmin_x), float(self.qmax_x)
-    
+
     def get_npts2fit(self):
         """
         return numbers of data points within qrange
-        
+
         :Note: This is to normalize chisq by Npts of fit
-        
+
         """
         if self.data is None:
@@ -2052,5 +2052,5 @@
         """
         self.Npts_fit.SetValue(str(self.get_npts2fit()))
-        
+
     def get_chi2(self):
         """
@@ -2058,28 +2058,28 @@
         """
         return self.tcChi.GetValue()
-        
+
     def onsetValues(self, chisqr, p_name, out, cov):
         """
         Build the panel from the fit result
-        
+
         :param chisqr: Value of the goodness of fit metric
         :param p_name: the name of parameters
         :param out: list of parameter with the best value found during fitting
         :param cov: Covariance matrix
-   
-        """
-	
+
+        """
+
         # make sure stop button to fit button all the time
         self._on_fit_complete()
         if out == None or not numpy.isfinite(chisqr):
             raise ValueError, "Fit error occured..."
-        
+
         is_modified = False
         has_error = False
         dispersity = ''
-        
+
         #Hide textctrl boxes of errors.
         self._clear_Err_on_Fit()
-        
+
         #Check if chi2 is finite
         if chisqr != None and numpy.isfinite(chisqr):
@@ -2090,9 +2090,9 @@
         else:
             self.tcChi.SetValue("-")
-        
+
         #Hide error title
         if self.text2_3.IsShown() and not self.is_mac:
             self.text2_3.Hide()
-      
+
         try:
             if self.enable_disp.GetValue():
@@ -2103,5 +2103,5 @@
             dispersity = None
             pass
-      
+
         i = 0
         #Set the panel when fit result are list
@@ -2121,5 +2121,5 @@
                         val_out = format_number(out[ind], True)
                         item[2].SetValue(val_out)
-    
+
                     if(cov != None and len(cov) == len(out)):
                         try:
@@ -2133,5 +2133,5 @@
                         except:
                             pass
-                        
+
                         if cov[ind] != None:
                             if numpy.isfinite(float(cov[ind])):
@@ -2160,5 +2160,5 @@
         ## save current state
         self.save_current_state()
-        
+
         if not self.is_mac:
             self.Layout()
@@ -2167,5 +2167,5 @@
         #plot model ( when drawing, do not update chisqr value again)
         self._draw_model(update_chisqr=False, source='fit')
-    
+
     def onWeighting(self, event):
         """
@@ -2174,5 +2174,5 @@
         self.weightbt_string = event.GetEventObject().GetLabelText()
         self._set_weight()
-        
+
     def _set_weight(self, is_2D=None):
         """
@@ -2191,13 +2191,13 @@
                                      is2d=is_2D,
                                      fid=None)
-    
+
     def onPinholeSmear(self, event):
         """
         Create a custom pinhole smear object that will change the way residuals
         are compute when fitting
-        
+
         :Note: accuracy is given by strings'High','Med', 'Low' FOR 2d,
                      None for 1D
-                     
+
         """
         if self.model == None:
@@ -2232,5 +2232,5 @@
         # hide all silt sizer
         self._hide_all_smear_info()
-        
+
         # show relevant slit sizers
         self._show_smear_sizer()
@@ -2238,5 +2238,5 @@
         self.sizer_set_smearer.Layout()
         self.Layout()
-        
+
         if event != None:
             event.Skip()
@@ -2245,16 +2245,16 @@
         event = PageInfoEvent(page=self)
         wx.PostEvent(self.parent, event)
-        
+
     def _is_changed_pinhole(self):
         """
         check if any of pinhole smear is changed
-        
+
         :return: True or False
-        
+
         """
         # get the values
         pin_min = self.smear_pinhole_min.GetValue()
         pin_max = self.smear_pinhole_max.GetValue()
-                    
+
         # Check changes in slit width
         try:
@@ -2264,5 +2264,5 @@
         if self.dx_min != dx_min:
             return True
-        
+
         # Check changes in slit heigth
         try:
@@ -2273,11 +2273,11 @@
             return True
         return False
-    
+
     def _set_pinhole_smear(self):
         """
         Set custom pinhole smear
-        
+
         :return: msg
-        
+
         """
         # copy data
@@ -2295,5 +2295,5 @@
             data.dxw = None
         msg = None
-   
+
         get_pin_min = self.smear_pinhole_min
         get_pin_max = self.smear_pinhole_max
@@ -2349,5 +2349,5 @@
             get_pin_max.SetBackgroundColour("white")
         ## set smearing value whether or not the data contain the smearing info
-        
+
         self._manager.set_smearer(smearer=self.current_smearer,
                             fid=self.data.id,
@@ -2357,12 +2357,12 @@
                             uid=self.uid)
         return msg
-        
+
     def update_pinhole_smear(self):
         """
         called by kill_focus on pinhole TextCntrl
         to update the changes
-        
+
         :return: False when wrong value was entered
-        
+
         """
         # msg default
@@ -2377,5 +2377,5 @@
         else:
             return True
-                     
+
     def onSlitSmear(self, event):
         """
@@ -2410,9 +2410,9 @@
         else:
             is_new_slit = True
-        
+
         # if any value is changed
         if is_new_slit:
             msg = self._set_slit_smear()
-            
+
         # hide all silt sizer
         self._hide_all_smear_info()
@@ -2433,12 +2433,12 @@
         """
         check if any of slit lengths is changed
-        
+
         :return: True or False
-        
+
         """
         # get the values
         width = self.smear_slit_width.GetValue()
         height = self.smear_slit_height.GetValue()
-        
+
         # check and change the box bg color if it was pink
         #    but it should be white now
@@ -2448,5 +2448,5 @@
         if width.lstrip().rstrip() == "":
             self.smear_slit_width.SetBackgroundColour(wx.WHITE)
-            
+
         # Check changes in slit width
         if width == "":
@@ -2459,5 +2459,5 @@
         if self.dxw != dxw:
             return True
-        
+
         # Check changes in slit heigth
         if height == "":
@@ -2472,9 +2472,9 @@
 
         return False
-    
+
     def _set_slit_smear(self):
         """
         Set custom slit smear
-        
+
         :return: message to inform the user about the validity
             of the values entered for slit smear
@@ -2490,5 +2490,5 @@
         data.dxw = None
         msg = None
-   
+
         try:
             self.dxl = float(self.smear_slit_height.GetValue())
@@ -2515,5 +2515,5 @@
             else:
                 self.smear_slit_width.SetBackgroundColour(wx.WHITE)
-              
+
         self.current_smearer = smear_selection(data, self.model)
         ## set smearing value whether or not the data contain the smearing info
@@ -2525,12 +2525,12 @@
                                  uid=self.uid)
         return msg
-    
+
     def update_slit_smear(self):
         """
         called by kill_focus on pinhole TextCntrl
         to update the changes
-        
+
         :return: False when wrong value was entered
-        
+
         """
         # msg default
@@ -2546,5 +2546,5 @@
         else:
             return True
-                            
+
     def onSmear(self, event):
         """
@@ -2572,9 +2572,9 @@
                 self._manager.page_finder[self.uid].add_data(data=self.data)
         temp_smearer = self.on_smear_helper()
-        
+
         self.sizer_set_smearer.Layout()
         self.Layout()
         self._set_weight()
-        
+
         ## set smearing value whether or not the data contain the smearing info
         wx.CallAfter(self._manager.set_smearer, uid=self.uid,
@@ -2585,14 +2585,14 @@
                      enable_smearer=not self.disable_smearer.GetValue(),
                      draw=True)
-        
+
         self.state.enable_smearer = self.enable_smearer.GetValue()
         self.state.disable_smearer = self.disable_smearer.GetValue()
         self.state.pinhole_smearer = self.pinhole_smearer.GetValue()
         self.state.slit_smearer = self.slit_smearer.GetValue()
-        
+
     def on_smear_helper(self, update=False):
         """
         Help for onSmear
-        
+
         :param update: force or not to update
         """
@@ -2606,5 +2606,5 @@
         self._hide_all_smear_info()
         data = copy.deepcopy(self.data)
-        
+
         # make sure once more if it is smearer
         temp_smearer = smear_selection(data, self.model)
@@ -2629,7 +2629,7 @@
             self.onSlitSmear(None)
         self._show_smear_sizer()
-        
+
         return temp_smearer
-    
+
     def on_complete_chisqr(self, event):
         """
@@ -2648,5 +2648,5 @@
         except:
             pass
-            
+
     def get_all_checked_params(self):
         """
@@ -2664,5 +2664,5 @@
                     self.param_toFit.append(item)
         self.save_current_state_fit()
-       
+
         event = PageInfoEvent(page=self)
         wx.PostEvent(self.parent, event)
@@ -2672,5 +2672,5 @@
                 param2fit.append(item[1])
         self._manager.set_param2fit(self.uid, param2fit)
-                
+
     def select_all_param(self, event):
         """
@@ -2706,5 +2706,5 @@
                             except:
                                 pass
-    
+
                         else:
                             ## for 1D all parameters except orientation
@@ -2726,7 +2726,7 @@
                     item[0].SetValue(False)
                 self.param_toFit = []
-           
+
         self.save_current_state_fit()
-       
+
         if event != None:
             #self._undo.Enable(True)
@@ -2739,5 +2739,5 @@
                 param2fit.append(item[1])
         self.parent._manager.set_param2fit(self.uid, param2fit)
-    
+
     def select_param(self, event):
         """
@@ -2792,5 +2792,5 @@
         else:
             self.cb1.SetValue(False)
-       
+
         self.save_current_state_fit()
         if event != None:
@@ -2798,5 +2798,5 @@
             event = PageInfoEvent(page=self)
             wx.PostEvent(self.parent, event)
-        
+
         param2fit = []
         for item in self.param_toFit:
@@ -2804,11 +2804,11 @@
                 param2fit.append(item[1])
         self._manager.set_param2fit(self.uid, param2fit)
-        
+
     def set_model_param_sizer(self, model):
         """
         Build the panel from the model content
-        
+
         :param model: the model selected in combo box for fitting purpose
-        
+
         """
         self.sizer3.Clear(True)
@@ -2820,5 +2820,5 @@
         self.orientation_params = []
         self.orientation_params_disp = []
-        
+
         if model == None:
             self.sizer3.Layout()
@@ -2834,7 +2834,7 @@
         ## save the current model
         self.model = model
-           
+
         keys = self.model.getParamList()
-	
+
         #list of dispersion parameters
         self.disp_list = self.model.getDispParamList()
@@ -2892,5 +2892,5 @@
 
         keys.sort(custom_compare)
-    
+
         iy = 0
         ix = 0
@@ -2900,5 +2900,5 @@
         self.cb1.SetToolTipString("To check/uncheck all the boxes below.")
         self.cb1.SetValue(True)
-        
+
         sizer.Add(self.cb1, (iy, ix), (1, 1), \
                              wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 5)
@@ -2928,15 +2928,15 @@
                             wx.EXPAND | wx.ADJUST_MINSIZE, 0)
         self.text2_4.Hide()
-        
+
         CHECK_STATE = self.cb1.GetValue()
         for item in keys:
-	    
+
             if not item in self.disp_list and not item in \
                     self.model.orientation_params:
-                
+
                 ##prepare a spot to store errors
                 if not item in self.model.details:
                     self.model.details[item] = ["", None, None]
-         
+
                 iy += 1
                 ix = 0
@@ -2978,5 +2978,5 @@
                     #cb.SetValue(True)
                     wx.EVT_CHECKBOX(self, cb.GetId(), self.select_param)
-                    
+
                     sizer.Add(cb, (iy, ix), (1, 1),
                               wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 5)
@@ -3017,5 +3017,5 @@
                     sizer.Add(ctl3, (iy, ix), (1, 1),
                               wx.EXPAND | wx.ADJUST_MINSIZE, 0)
-            
+
                     ix += 1
                     ctl4 = self.ModelTextCtrl(self, -1,
@@ -3028,5 +3028,5 @@
                     sizer.Add(ctl4, (iy, ix), (1, 1),
                               wx.EXPAND | wx.FIXED_MINSIZE, 0)
-    
+
                     ix += 1
                     # Units
@@ -3039,12 +3039,12 @@
                     sizer.Add(units, (iy, ix), (1, 1),
                               wx.EXPAND | wx.ADJUST_MINSIZE, 0)
-                        
+
                     self.parameters.append([cb, item, ctl1,
                                             text2, ctl2, ctl3, ctl4, units])
-                                  
+
         iy += 1
         sizer.Add((10, 10), (iy, ix), (1, 1),
                   wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
-        
+
         # type can be either Guassian or Array
         if len(self.model.dispersion.values()) > 0:
@@ -3052,5 +3052,5 @@
         else:
             type = "Gaussian"
-            
+
         iy += 1
         ix = 0
@@ -3059,16 +3059,16 @@
             if item in self.model.orientation_params:
                 orient_angle = wx.StaticText(self, -1, '[For 2D only]:')
-                mag_on_button = wx.Button(self, -1, "Magnetic ON" )
+                mag_on_button = wx.Button(self, -1, "Magnetic ON")
                 mag_on_button.Bind(wx.EVT_BUTTON, self._on_mag_on)
-                mag_help_button = wx.Button(self, -1,"Magnetic angles?" )
-                mag_help_button.Bind(wx.EVT_BUTTON,self._on_mag_help)
+                mag_help_button = wx.Button(self, -1, "Magnetic angles?")
+                mag_help_button.Bind(wx.EVT_BUTTON, self._on_mag_help)
                 sizer.Add(orient_angle, (iy, ix), (1, 1),
                           wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
                 iy += 1
-                sizer.Add(mag_on_button,(iy, ix ),(1,1), 
-                          wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
-                sizer.Add(mag_help_button,(iy, ix + 1),(1,1), 
-                          wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
-                
+                sizer.Add(mag_on_button, (iy, ix), (1, 1),
+                          wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
+                sizer.Add(mag_help_button, (iy, ix + 1), (1, 1),
+                          wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
+
                 #handle the magnetic buttons
                 if not self._has_magnetic:
@@ -3082,9 +3082,9 @@
                     if self.magnetic_on:
                         mag_on_button.SetLabel("Magnetic OFF")
-                        mag_help_button.Show(True) 
+                        mag_help_button.Show(True)
                     else:
                         mag_on_button.SetLabel("Magnetic ON")
                         mag_help_button.Show(False)
-                        
+
                 if not self.data.__class__.__name__ == "Data2D" and \
                         not self.enable2D:
@@ -3093,5 +3093,5 @@
                     orient_angle.Show(True)
                 break
-      
+
         #For Gaussian only
         if type.lower() != "array":
@@ -3104,5 +3104,5 @@
                     if not item in self.model.details:
                         self.model.details[item] = ["", None, None]
-                          
+
                     iy += 1
                     ix = 0
@@ -3119,5 +3119,5 @@
                     sizer.Add(cb, (iy, ix), (1, 1),
                               wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 5)
-    
+
                     ## add parameter value
                     ix += 1
@@ -3148,5 +3148,5 @@
 
                     ctl2.Hide()
-                    
+
                     ix += 1
                     ctl3 = self.ModelTextCtrl(self, -1,
@@ -3154,9 +3154,9 @@
                                               style=wx.TE_PROCESS_ENTER,
                                 text_enter_callback=self._onparamRangeEnter)
-                    
+
                     sizer.Add(ctl3, (iy, ix), (1, 1),
                               wx.EXPAND | wx.ADJUST_MINSIZE, 0)
                     ctl3.Hide()
-                 
+
                     ix += 1
                     ctl4 = self.ModelTextCtrl(self, -1,
@@ -3166,7 +3166,7 @@
                     sizer.Add(ctl4, (iy, ix), (1, 1),
                               wx.EXPAND | wx.ADJUST_MINSIZE, 0)
-                   
+
                     ctl4.Hide()
-                    
+
                     if self.data.__class__.__name__ == "Data2D" or \
                             self.enable2D:
@@ -3176,5 +3176,5 @@
                         ctl3.Show(True)
                         ctl4.Show(True)
-                    
+
                     ix += 1
                     # Units
@@ -3191,13 +3191,13 @@
                     else:
                         units.Hide()
-                    
+
                     sizer.Add(units, (iy, ix), (1, 1),
                               wx.EXPAND | wx.ADJUST_MINSIZE, 0)
-                                          
+
                     self.parameters.append([cb, item, ctl1,
                                             text2, ctl2, ctl3, ctl4, units])
                     self.orientation_params.append([cb, item, ctl1,
                                             text2, ctl2, ctl3, ctl4, units])
-              
+
         iy += 1
         box_description.SetForegroundColour(wx.BLUE)
@@ -3235,5 +3235,5 @@
             wx.PostEvent(self._manager.parent,
                         StatusEvent(status=msg, info=infor))
-        
+
     def _onModel2D(self, event):
         """
@@ -3243,5 +3243,5 @@
             self.model_view.SetLabel("Show 1D")
             self.enable2D = True
-              
+
         else:
             self.model_view.SetLabel("Show 2D")
@@ -3258,7 +3258,7 @@
         self.SetupScrolling()
         self._draw_model()
-        
+
         self.state.enable2D = copy.deepcopy(self.enable2D)
-    
+
     def _set_smear_buttons(self):
         """
@@ -3274,6 +3274,6 @@
             self.slit_smearer.Enable(True)
             self.pinhole_smearer.Enable(True)
-            
-            
+
+
 class BGTextCtrl(wx.TextCtrl):
     """
@@ -3286,10 +3286,10 @@
         self.SetEditable(False)
         self.SetBackgroundColour(self.GetParent().parent.GetBackgroundColour())
-        
+
         # Bind to mouse event to avoid text highlighting
         # The event will be skipped once the call-back
         # is called.
         self.Bind(wx.EVT_MOUSE_EVENTS, self._click)
-        
+
     def _click(self, event):
         """
Index: src/sas/perspectives/fitting/fitpanel.py
===================================================================
--- src/sas/perspectives/fitting/fitpanel.py	(revision 386ffe12ba023b3eab0fbbb16a6f958ed7c099a3)
+++ src/sas/perspectives/fitting/fitpanel.py	(revision 2f4b43041eaa7b7f496750f223a299cb33cd268e)
@@ -4,5 +4,5 @@
 :note: For Fit to be performed the user should check at least one parameter
     on fit Panel window.
-   
+
 """
 import wx
@@ -22,8 +22,8 @@
     """
     FitPanel class contains fields allowing to fit  models and  data
-    
+
     :note: For Fit to be performed the user should check at least one parameter
         on fit Panel window.
-       
+
     """
     ## Internal name for the AUI manager
@@ -32,11 +32,11 @@
     window_caption = "Fit Panel "
     CENTER_PANE = True
-    
+
     def __init__(self, parent, manager=None, *args, **kwargs):
         """
         """
         nb.__init__(self, parent, -1,
-                    style=wx.aui.AUI_NB_WINDOWLIST_BUTTON|
-                    wx.aui.AUI_NB_DEFAULT_STYLE|
+                    style=wx.aui.AUI_NB_WINDOWLIST_BUTTON |
+                    wx.aui.AUI_NB_DEFAULT_STYLE |
                     wx.CLIP_CHILDREN)
         PanelBase.__init__(self, parent)
@@ -51,5 +51,5 @@
         self.model_dictionary = self.menu_mng.get_model_dictionary()
         self.pageClosedEvent = wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE
-        
+
         self.Bind(self.pageClosedEvent, self.on_close_page)
         ## save the title of the last page tab added
@@ -71,5 +71,5 @@
         self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGED, self.on_page_changing)
         self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSED, self.on_closed)
-        
+
     def on_closed(self, event):
         """
@@ -78,5 +78,5 @@
             self.add_empty_page()
             self.enable_close_button()
-        
+
     def save_project(self, doc=None):
         """
@@ -109,5 +109,5 @@
                                                             info="warning"))
         return doc
-    
+
     def update_model_list(self):
         """
@@ -117,5 +117,5 @@
             self.model_list_box = temp
         return temp
-    
+
     def reset_pmodel_list(self):
         """
@@ -125,5 +125,5 @@
             self.model_list_box = temp
         return temp
-    
+
     def get_page_by_id(self, uid):
         """
@@ -134,5 +134,5 @@
         else:
             return self.opened_pages[uid]
-        
+
     def on_page_changing(self, event):
         """
@@ -141,5 +141,5 @@
         """
         wx.CallAfter(self.helper_on_page_change)
-        
+
     def helper_on_page_change(self):
         """
@@ -148,8 +148,8 @@
         if pos != -1:
             selected_page = self.GetPage(pos)
-            wx.PostEvent(self._manager.parent, 
+            wx.PostEvent(self._manager.parent,
                          PanelOnFocusEvent(panel=selected_page))
         self.enable_close_button()
-       
+
     def on_set_focus(self, event):
         """
@@ -158,7 +158,7 @@
         if pos != -1:
             selected_page = self.GetPage(pos)
-            wx.PostEvent(self._manager.parent, 
+            wx.PostEvent(self._manager.parent,
                          PanelOnFocusEvent(panel=selected_page))
-        
+
     def get_data(self):
         """
@@ -169,5 +169,5 @@
             selected_page = self.GetPage(pos)
             return selected_page.get_data()
-    
+
     def set_model_state(self, state):
         """
@@ -178,5 +178,5 @@
             selected_page = self.GetPage(pos)
             selected_page.set_model_state(state)
-            
+
     def get_state(self):
         """
@@ -187,10 +187,10 @@
             selected_page = self.GetPage(pos)
             return selected_page.get_state()
-    
+
     def close_all(self):
         """
         remove all pages, used when a svs file is opened
         """
-        
+
         #get number of pages
         nop = self.GetPageCount()
@@ -204,10 +204,10 @@
             self.DeletePage(0)
             nop = nop - 1
-            
+
         ## save the title of the last page tab added
         self.fit_page_name = {}
         ## list of existing fit page
         self.opened_pages = {}
-         
+
     def set_state(self, state):
         """
@@ -238,14 +238,14 @@
                     panel.reset_page(state=state)
                     panel.save_current_state()
-                    
+
     def clear_panel(self):
         """
         Clear and close all panels, used by guimanager
         """
-       
+
         #close all panels only when svs file opened
         self.close_all()
         self._manager.mypanels = []
-        
+
     def on_close_page(self, event=None):
         """
@@ -260,5 +260,5 @@
                 return
         self._close_helper(selected_page=selected_page)
-        
+
     def close_page_with_data(self, deleted_data):
         """
@@ -271,5 +271,5 @@
             if hasattr(selected_page, "get_data"):
                 data = selected_page.get_data()
-                
+
                 if data is None:
                     #the fitpanel exists and only the initial fit page is open
@@ -280,11 +280,11 @@
                     self.DeletePage(index)
                     break
-        
+
     def set_manager(self, manager):
         """
         set panel manager
-        
+
         :param manager: instance of plugin fitting
-        
+
         """
         self._manager = manager
@@ -297,10 +297,10 @@
         """
         copy a dictionary of model into its own dictionary
-        
+
         :param m_dict: dictionnary made of model name as key and model class
         as value
         """
         self.model_list_box = dict
-        
+
     def set_model_dict(self, m_dict):
         """
@@ -313,8 +313,8 @@
         """
         :return: the current page selected
-        
+
         """
         return self.GetPage(self.GetSelection())
-    
+
     def add_sim_page(self, caption="Const & Simul Fit"):
         """
@@ -325,5 +325,5 @@
         if caption == "Const & Simul Fit":
             self.sim_page = SimultaneousFitPage(self, page_finder=page_finder,
-                                                 id=-1, batch_on=False)
+                                                 id= -1, batch_on=False)
             self.sim_page.window_caption = caption
             self.sim_page.window_name = caption
@@ -343,5 +343,5 @@
             self.enable_close_button()
             return self.batch_page
- 
+
     def add_empty_page(self):
         """
@@ -385,5 +385,5 @@
         panel.on_set_focus(None)
         return panel
-    
+
     def enable_close_button(self):
         """
@@ -403,5 +403,5 @@
                 style |= wx.aui.AUI_NB_CLOSE_ON_ACTIVE_TAB
                 self.SetWindowStyle(style)
-            
+
     def delete_data(self, data):
         """
@@ -422,10 +422,10 @@
             if self.GetPageCount() == 0:
                 self._manager.on_add_new_page(event=None)
-        
+
     def set_data_on_batch_mode(self, data_list):
         """
         Add all data to a single tab when the application is on Batch mode.
-        However all data in the set of data must be either 1D or 2D type. 
-        This method presents option to select the data type before creating a 
+        However all data in the set of data must be either 1D or 2D type.
+        This method presents option to select the data type before creating a
         tab.
         """
@@ -445,5 +445,5 @@
             #check if there is an empty page to fill up
             if not check_data_validity(p.get_data()) and p.batch_on:
-                
+
                 #make sure data get placed in 1D empty tab if data is 1D
                 #else data get place on 2D tab empty tab
@@ -479,5 +479,5 @@
             elif not data_1d_list and data_2d_list:
                 page.fill_data_combobox(data_2d_list)
-                
+
         pos = self.GetPageIndex(page)
         page.batch_on = self.batch_on
@@ -486,14 +486,14 @@
         self.opened_pages[page.uid] = page
         return page
-    
+
     def set_data(self, data_list):
         """
         Add a fitting page on the notebook contained by fitpanel
-        
+
         :param data: data to fit
-        
+
         :return panel : page just added for further used.
         is used by fitting module
-        
+
         """
         if not data_list:
@@ -509,5 +509,5 @@
                 data_list = [data]
                 data = data_list[0]
-                
+
             if data is None:
                 return None
@@ -535,5 +535,5 @@
         self.SetSelection(pos)
         return page
-       
+
     def _onGetstate(self, event):
         """
@@ -543,5 +543,5 @@
         if page.uid in self.fit_page_name:
             self.fit_page_name[page.uid].appendItem(page.createMemento())
-            
+
     def _onUndo(self, event):
         """
@@ -556,5 +556,5 @@
                 page._redo.Enable(True)
             page.reset_page(state)
-        
+
     def _onRedo(self, event):
         """
@@ -571,5 +571,5 @@
                 state = self.fit_page_name[page.uid].getNextItem()
             page.reset_page(state)
-                 
+
     def _close_helper(self, selected_page):
         """
@@ -606,10 +606,10 @@
             for uid, list in self.opened_pages.iteritems():
                 #Don't return any panel is the exact same page is created
-                
+
                 if flag and selected_page.uid == uid:
                     self._manager.remove_plot(uid, theory=False)
                     break
             del page_finder[selected_page]
-  
+
         #Delete the name of the page into the list of open page
         for uid, list in self.opened_pages.iteritems():
Index: src/sas/perspectives/fitting/fitproblem.py
===================================================================
--- src/sas/perspectives/fitting/fitproblem.py	(revision 7a04dbb34bb699a5460b3ad23209d05b641f3265)
+++ src/sas/perspectives/fitting/fitproblem.py	(revision 2f4b43041eaa7b7f496750f223a299cb33cd268e)
@@ -27,5 +27,5 @@
         flag is 0 ingore smear value.
         """
-        
+
     def get_smearer(self):
         """
@@ -35,9 +35,9 @@
         """
         """
-        
+
     def get_name(self):
         """
         """
-        
+
     def set_model(self, model):
         """
@@ -46,10 +46,10 @@
         :param name: name created for model
         """
-        
+
     def get_model(self):
         """
         :return: saved model
         """
-        
+
     def set_residuals(self, residuals):
         """
@@ -57,10 +57,10 @@
         :param data: data selected
         """
-        
+
     def get_residuals(self):
         """
         :return: residuals
         """
-        
+
     def set_theory_data(self, data):
         """
@@ -68,10 +68,10 @@
         :param data: data selected
         """
-        
+
     def get_theory_data(self):
         """
         :return: list of data dList
         """
-        
+
     def set_fit_data(self, data):
         """
@@ -81,9 +81,9 @@
         :param data: list of data selected
         """
-        
+
     def get_fit_data(self):
         """
         """
-        
+
     def set_model_param(self, name, value=None):
         """
@@ -92,5 +92,5 @@
         :param value: value of that parameter
         """
-        
+
     def set_param2fit(self, list):
         """
@@ -98,65 +98,65 @@
         :param list: list of the param names
         """
-        
+
     def get_param2fit(self):
         """
         return the list param names to fit
         """
-        
+
     def get_model_param(self):
         """
         return list of couple of parameter name and value
         """
-        
+
     def schedule_tofit(self, schedule=0):
         """
         set schedule to true to decide if this fit  must be performed
         """
-        
+
     def get_scheduled(self):
         """
         return true or false if a problem as being schedule for fitting
         """
-        
+
     def set_range(self, qmin=None, qmax=None):
         """
         set fitting range
         """
-        
+
     def get_range(self):
         """
         :return: fitting range
         """
-        
+
     def set_weight(self, flag=None):
         """
         set fitting range
         """
-        
+
     def get_weight(self):
         """
         get fitting weight
         """
-        
+
     def clear_model_param(self):
         """
         clear constraint info
         """
-        
+
     def set_fit_tab_caption(self, caption):
         """
         store the caption of the page associated with object
         """
-        
+
     def get_fit_tab_caption(self):
         """
         Return the caption of the page associated with object
         """
-        
+
     def set_graph_id(self, id):
         """
-        Set graph id (from data_group_id at the time the graph produced) 
-        """
-        
+        Set graph id (from data_group_id at the time the graph produced)
+        """
+
     def get_graph_id(self):
         """
@@ -173,5 +173,5 @@
         """
 
-   
+
 class FitProblemDictionary(FitProblemComponent, dict):
     """
@@ -198,5 +198,5 @@
         self.batch_inputs = {}
         self.batch_outputs = {}
- 
+
     def enable_smearing(self, flag=False, fid=None):
         """
@@ -211,5 +211,5 @@
             if fid in self.iterkeys():
                 self[fid].enable_smearing(flag)
-        
+
     def set_smearer(self, smearer, fid=None):
         """
@@ -223,5 +223,5 @@
             if fid in self.iterkeys():
                 self[fid].set_smearer(smearer)
-                
+
     def get_smearer(self, fid=None):
         """
@@ -230,5 +230,5 @@
         if fid in self.iterkeys():
             return self[fid].get_smearer()
-     
+
     def save_model_name(self, name, fid=None):
         """
@@ -240,5 +240,5 @@
             if fid in self.iterkeys():
                 self[fid].save_model_name(name)
-                
+
     def get_name(self, fid=None):
         """
@@ -252,5 +252,5 @@
                 result.append(self[fid].get_name())
         return result
-    
+
     def set_model(self, model, fid=None):
         """
@@ -266,5 +266,5 @@
             if fid in self.iterkeys():
                 self[fid].set_model(self.model)
-      
+
     def get_model(self, fid):
         """
@@ -273,5 +273,5 @@
         if fid in self.iterkeys():
             return self[fid].get_model()
-       
+
     def set_fit_tab_caption(self, caption):
         """
@@ -279,5 +279,5 @@
         """
         self.fit_tab_caption = caption
-    
+
     def get_fit_tab_caption(self):
         """
@@ -285,5 +285,5 @@
         """
         return self.fit_tab_caption
-    
+
     def set_residuals(self, residuals, fid):
         """
@@ -293,5 +293,5 @@
         if fid in self.iterkeys():
             self[fid].set_residuals(residuals)
-            
+
     def get_residuals(self, fid):
         """
@@ -300,5 +300,5 @@
         if fid in self.iterkeys():
             return self[fid].get_residuals()
-        
+
     def set_theory_data(self, fid, data=None):
         """
@@ -308,5 +308,5 @@
         if fid in self.iterkeys():
             self[fid].set_theory_data(data)
-            
+
     def get_theory_data(self, fid):
         """
@@ -315,5 +315,5 @@
         if fid in self.iterkeys():
             return self[fid].get_theory_data()
-            
+
     def add_data(self, data):
         """
@@ -325,10 +325,10 @@
             self[data.id] = FitProblem()
         self[data.id].set_fit_data(data)
-        
+
     def set_fit_data(self, data):
         """
         save a copy of the data select to fit
         :param data: data selected
-        
+
         """
         self.clear()
@@ -342,5 +342,5 @@
                 self[d.id].set_model(self.model)
                 self[d.id].set_range(self.qmin, self.qmax)
-                
+
     def get_fit_data(self, fid):
         """
@@ -351,5 +351,5 @@
         if fid in self.iterkeys():
             return self[fid].get_fit_data()
-   
+
     def set_model_param(self, name, value=None, fid=None):
         """
@@ -364,5 +364,5 @@
             if fid in self.iterkeys():
                 self[fid].set_model_param(name, value)
-                
+
     def get_model_param(self, fid):
         """
@@ -371,5 +371,5 @@
         if fid in self.iterkeys():
             return self[fid].get_model_param()
-    
+
     def set_param2fit(self, list):
         """
@@ -378,5 +378,5 @@
         """
         self.list_param2fit = list
-        
+
     def get_param2fit(self):
         """
@@ -384,5 +384,5 @@
         """
         return self.list_param2fit
-          
+
     def schedule_tofit(self, schedule=0):
         """
@@ -392,5 +392,5 @@
         for value in self.itervalues():
             value.schedule_tofit(schedule)
-      
+
     def get_scheduled(self):
         """
@@ -398,5 +398,5 @@
         """
         return self.scheduled
-    
+
     def set_range(self, qmin=None, qmax=None, fid=None):
         """
@@ -411,5 +411,5 @@
             if fid in self.iterkeys():
                 self[fid].value.set_range(self.qmin, self.qmax)
-        
+
     def get_range(self, fid):
         """
@@ -418,5 +418,5 @@
         if fid in self.iterkeys():
             return self[fid].get_range()
-        
+
     def set_weight(self, is2d, flag=None, fid=None):
         """
@@ -429,5 +429,5 @@
             if fid in self.iterkeys():
                 self[fid].set_weight(flag=flag, is2d=is2d)
-                
+
     def get_weight(self, fid=None):
         """
@@ -436,5 +436,5 @@
         if fid in self.iterkeys():
             return self[fid].get_weight()
-                 
+
     def clear_model_param(self, fid=None):
         """
@@ -447,5 +447,5 @@
             if fid in self.iterkeys():
                 self[fid].clear_model_param()
-                
+
     def get_fit_problem(self):
         """
@@ -453,5 +453,5 @@
         """
         return self.itervalues()
-    
+
     def set_result(self, result, fid):
         """
@@ -459,5 +459,5 @@
         if fid in self.iterkeys():
             self[fid].set_result(result)
-            
+
     def set_batch_result(self, batch_inputs, batch_outputs):
         """
@@ -466,5 +466,5 @@
         self.batch_inputs = batch_inputs
         self.batch_outputs = batch_outputs
-             
+
     def get_result(self, fid):
         """
@@ -473,5 +473,5 @@
         if fid in self.iterkeys():
             return self[fid].get_result()
-            
+
     def get_batch_result(self):
         """
@@ -479,11 +479,11 @@
         """
         return self.batch_inputs, self.batch_outputs
-    
+
     def set_graph_id(self, id):
         """
-        Set graph id (from data_group_id at the time the graph produced) 
+        Set graph id (from data_group_id at the time the graph produced)
         """
         self.graph_id = id
-        
+
     def get_graph_id(self):
         """
@@ -491,6 +491,6 @@
         """
         return self.graph_id
-    
-    
+
+
 class FitProblem(FitProblemComponent):
     """
@@ -527,5 +527,5 @@
         self.weight = None
         self.result = None
-        
+
     def enable_smearing(self, flag=False):
         """
@@ -534,14 +534,14 @@
         """
         self.smearer_enable = flag
-        
+
     def set_smearer(self, smearer):
         """
         save reference of  smear object on fitdata
-        
+
         :param smear: smear object from DataLoader
-        
+
         """
         self.smearer_computer_value = smearer
-       
+
     def get_smearer(self):
         """
@@ -556,15 +556,15 @@
             self.smearer_computed = True
         return self.smearer_computer_value
-    
+
     def save_model_name(self, name):
         """
         """
         self.name_per_page = name
-        
+
     def get_name(self):
         """
         """
         return self.name_per_page
-    
+
     def set_model(self, model):
         """
@@ -577,5 +577,5 @@
                                                            self.model)
         self.smearer_computed = True
-        
+
     def get_model(self):
         """
@@ -583,5 +583,5 @@
         """
         return self.model
-   
+
     def set_residuals(self, residuals):
         """
@@ -590,5 +590,5 @@
         """
         self.residuals = residuals
-            
+
     def get_residuals(self):
         """
@@ -596,14 +596,14 @@
         """
         return self.residuals
-        
+
     def set_theory_data(self, data):
         """
         save a copy of the data select to fit
-        
+
         :param data: data selected
-        
+
         """
         self.theory_data = copy.deepcopy(data)
-        
+
     def get_theory_data(self):
         """
@@ -627,5 +627,5 @@
         self.smearer_computed = True
         self.result = None
-        
+
     def get_fit_data(self):
         """
@@ -633,10 +633,10 @@
         """
         return self.fit_data
-    
+
     def get_origin_data(self):
         """
         """
         return self.original_data
-    
+
     def set_weight(self, is2d, flag=None):
         """
@@ -658,5 +658,5 @@
         """
         return self.weight
-    
+
     def set_param2fit(self, list):
         """
@@ -665,5 +665,5 @@
         """
         self.list_param2fit = list
-        
+
     def get_param2fit(self):
         """
@@ -671,5 +671,5 @@
         """
         return self.list_param2fit
-    
+
     def set_model_param(self, name, value=None):
         """
@@ -679,5 +679,5 @@
         """
         self.list_param.append([name, value])
-        
+
     def get_model_param(self):
         """
@@ -685,5 +685,5 @@
         """
         return self.list_param
-        
+
     def schedule_tofit(self, schedule=0):
         """
@@ -691,5 +691,5 @@
         """
         self.schedule = schedule
-        
+
     def get_scheduled(self):
         """
@@ -697,5 +697,5 @@
         """
         return self.schedule
-    
+
     def set_range(self, qmin=None, qmax=None):
         """
@@ -706,12 +706,12 @@
         self.qmin = qmin
         self.qmax = qmax
-        
+
     def get_range(self):
         """
         :return: fitting range
-        
+
         """
         return self.qmin, self.qmax
-    
+
     def clear_model_param(self):
         """
@@ -719,15 +719,15 @@
         """
         self.list_param = []
-        
+
     def set_fit_tab_caption(self, caption):
         """
         """
         self.fit_tab_caption = str(caption)
-        
+
     def get_fit_tab_caption(self):
         """
         """
         return self.fit_tab_caption
-    
+
     def set_graph_id(self, id):
         """
@@ -735,5 +735,5 @@
         """
         self.graph_id = id
-        
+
     def get_graph_id(self):
         """
@@ -741,10 +741,10 @@
         """
         return self.graph_id
-    
+
     def set_result(self, result):
         """
         """
         self.result = result
-        
+
     def get_result(self):
         """
Index: src/sas/perspectives/fitting/fitting.py
===================================================================
--- src/sas/perspectives/fitting/fitting.py	(revision 39356b55b8440f4ad106471726ea9696e061cbf4)
+++ src/sas/perspectives/fitting/fitting.py	(revision 2f4b43041eaa7b7f496750f223a299cb33cd268e)
@@ -25,10 +25,10 @@
 from sas.guiframe.dataFitting import Data1D
 from sas.guiframe.dataFitting import check_data_validity
-from sas.guiframe.events import NewPlotEvent 
-from sas.guiframe.events import StatusEvent  
+from sas.guiframe.events import NewPlotEvent
+from sas.guiframe.events import StatusEvent
 from sas.guiframe.events import EVT_SLICER_PANEL
 from sas.guiframe.events import EVT_SLICER_PARS_UPDATE
 from sas.guiframe.gui_style import GUIFRAME_ID
-from sas.guiframe.plugin_base import PluginBase 
+from sas.guiframe.plugin_base import PluginBase
 from sas.guiframe.data_processor import BatchCell
 from sas.fit.Fitting import Fit
@@ -63,5 +63,5 @@
     def __init__(self, standalone=False):
         PluginBase.__init__(self, name="Fitting", standalone=standalone)
-        
+
         #list of panel to send to guiframe
         self.mypanels = []
@@ -69,7 +69,7 @@
         self.calc_2D = None
         self.calc_1D = None
-        
+
         self.color_dict = {}
-        
+
         self.fit_thread_list = {}
         self.residuals = None
@@ -107,5 +107,5 @@
         self.menu1 = None
         self.new_model_frame = None
-        
+
         self.temp_state = []
         self.state_index = 0
@@ -116,5 +116,5 @@
         logging.info("Fitting plug-in started")
         self.batch_capable = self.get_batch_capable()
-    
+
     def get_batch_capable(self):
         """
@@ -122,5 +122,5 @@
         """
         return True
-    
+
     def create_fit_problem(self, page_id):
         """
@@ -128,5 +128,5 @@
         """
         self.page_finder[page_id] = FitProblemDictionary()
-        
+
     def delete_fit_problem(self, page_id):
         """
@@ -135,5 +135,5 @@
         if page_id in self.page_finder.iterkeys():
             del self.page_finder[page_id]
-        
+
     def add_color(self, color, id):
         """
@@ -141,5 +141,5 @@
         """
         self.color_dict[id] = color
-        
+
     def on_batch_selection(self, flag):
         """
@@ -149,14 +149,14 @@
         if self.fit_panel is not None:
             self.fit_panel.batch_on = self.batch_on
-        
+
     def populate_menu(self, owner):
         """
         Create a menu for the Fitting plug-in
-        
+
         :param id: id to create a menu
         :param owner: owner of menu
-        
+
         :return: list of information to populate the main menu
-        
+
         """
         #Menu for fitting
@@ -194,5 +194,5 @@
         wx.EVT_MENU(owner, self.id_result_panel, lambda ev: self.result_frame.Show())
         self.menu1.AppendSeparator()
-        
+
         self.id_reset_flag = wx.NewId()
         resetf_help = "BatchFit: If checked, the initial param values will be "
@@ -207,5 +207,5 @@
         chain_menu.Check(not self.batch_reset_flag)
         chain_menu.Enable(self.batch_on)
-        
+
         self.menu1.AppendSeparator()
         self.edit_model_menu = wx.Menu()
@@ -215,5 +215,5 @@
         except:
             raise
-        
+
         self.id_edit = wx.NewId()
         editmodel_help = "Edit customized model sample file"
@@ -222,5 +222,5 @@
         #create  menubar items
         return [(self.menu1, self.sub_menu)]
-    
+
     def edit_custom_model(self, event):
         """
@@ -237,5 +237,5 @@
         self.put_icon(frame)
         frame.Show(True)
-    
+
     def delete_custom_model(self, event):
         """
@@ -266,12 +266,12 @@
                     if item.GetLabel() == label:
                         self.edit_menu.DeleteItem(item)
-                        msg = "The custom model, %s, has been deleted."% label
-                        wx.PostEvent(self.parent, StatusEvent(status=msg, 
+                        msg = "The custom model, %s, has been deleted." % label
+                        wx.PostEvent(self.parent, StatusEvent(status=msg,
                                                 type='stop', info='info'))
                         break
         except:
-            msg ='Delete Error: \nCould not delete the file; Check if in use.'
+            msg = 'Delete Error: \nCould not delete the file; Check if in use.'
             wx.MessageBox(msg, 'Error')
-    
+
     def make_sum_model(self, event):
         """
@@ -282,10 +282,10 @@
         model_list = model_manager.get_model_name_list()
         plug_dir = models.find_plugins_dir()
-        textdial = TextDialog(None, self, -1, 'Easy Sum/Multi(p1, p2) Editor', 
+        textdial = TextDialog(None, self, -1, 'Easy Sum/Multi(p1, p2) Editor',
                               model_list, plug_dir)
         self.put_icon(textdial)
         textdial.ShowModal()
         textdial.Destroy()
-    
+
     def make_new_model(self, event):
         """
@@ -332,6 +332,6 @@
         except:
             pass
-        
-        
+
+
     def set_edit_menu(self, owner):
         """
@@ -349,6 +349,6 @@
         e_id = wx.NewId()
         self.edit_menu = wx.Menu()
-        self.edit_model_menu.AppendMenu(e_id, 
-                                    'Advanced', self.edit_menu) 
+        self.edit_model_menu.AppendMenu(e_id,
+                                    'Advanced', self.edit_menu)
         self.set_edit_menu_helper(owner, self.edit_custom_model)
 
@@ -358,5 +358,5 @@
                                         'Delete', self.delete_menu)
         self.set_edit_menu_helper(owner, self.delete_custom_model)
-    
+
     def set_edit_menu_helper(self, owner=None, menu=None):
         """
@@ -409,5 +409,5 @@
             caption = "Combined Batch"
             page = self.batch_page
-            
+
         def set_focus_page(page):
             page.Show(True)
@@ -417,5 +417,5 @@
             msg = "%s already opened\n" % str(page.window_caption)
             wx.PostEvent(self.parent, StatusEvent(status=msg))
-            
+
         if page != None:
             return set_focus_page(page)
@@ -424,5 +424,5 @@
         else:
             self.batch_page = self.fit_panel.add_sim_page(caption=caption)
-        
+
     def help(self, evt):
         """
@@ -439,23 +439,23 @@
                     pass
         frame.Show(True)
-        
+
     def get_context_menu(self, plotpanel=None):
         """
         Get the context menu items available for P(r).them allow fitting option
         for Data2D and Data1D only.
-        
+
         :param graph: the Graph object to which we attach the context menu
-        
+
         :return: a list of menu items with call-back function
-        
+
         :note: if Data1D was generated from Theory1D
                 the fitting option is not allowed
-                
+
         """
         self.plot_panel = plotpanel
         graph = plotpanel.graph
         fit_option = "Select data for fitting"
-        fit_hint =  "Dialog with fitting parameters "
-        
+        fit_hint = "Dialog with fitting parameters "
+
         if graph.selected_plottable not in plotpanel.plots:
             return []
@@ -466,8 +466,8 @@
                     return [[fit_option, fit_hint, self._onSelect]]
                 else:
-                    return [] 
+                    return []
             return [[fit_option, fit_hint, self._onSelect]]
         else:
-            
+
             # if is_data is true , this in an actual data loaded
             #else it is a data created from a theory model
@@ -501,5 +501,5 @@
         self.result_panel = ResultPanel(parent=self.result_frame, manager=self)
         self.perspective.append(self.result_panel.window_name)
-       
+
         #index number to create random model name
         self.index_model = 0
@@ -517,10 +517,10 @@
         self.mypanels.append(self.result_panel)
         return self.mypanels
-    
+
     def clear_panel(self):
         """
         """
         self.fit_panel.clear_panel()
-        
+
     def delete_data(self, data):
         """
@@ -528,5 +528,5 @@
         """
         self.fit_panel.delete_data(data)
-        
+
     def set_data(self, data_list=None):
         """
@@ -545,5 +545,5 @@
                     selected_data_list = dlg.get_data()
                 dlg.Destroy()
-                
+
             else:
                 selected_data_list = data_list
@@ -562,5 +562,5 @@
                 msg = "Fitting Set_data: " + str(sys.exc_value)
                 wx.PostEvent(self.parent, StatusEvent(status=msg, info="error"))
-    
+
     def set_theory(self, theory_list=None):
         """
@@ -576,10 +576,10 @@
                 wx.PostEvent(self.parent,
                              StatusEvent(status=msg, info="error"))
-            
+
     def set_state(self, state=None, datainfo=None, format=None):
         """
         Call-back method for the fit page state reader.
         This method is called when a .fitv/.svs file is loaded.
-        
+
         : param state: PageState object
         : param datainfo: data
@@ -596,5 +596,5 @@
         # state file format
         self.sfile_ext = format
-        
+
         self.on_set_state_helper(event=None)
 
@@ -603,5 +603,5 @@
         Set_state_helper. This actually sets state
         after plotting data from state file.
-        
+
         : event: FitStateUpdateEvent called
             by dataloader.plot_data from guiframe
@@ -613,5 +613,5 @@
                 self.state_index = 0
             return
-        
+
         try:
             # Load fitting state
@@ -641,5 +641,5 @@
                         caption=caption)
                 self.mypanels.append(page)
-                
+
             # get ready for the next set_state
             self.state_index += 1
@@ -647,5 +647,5 @@
             #reset state variables to default when all set_state is finished.
             if len(self.temp_state) == self.state_index:
-                
+
                 self.temp_state = []
                 #self.state_index = 0
@@ -657,5 +657,5 @@
             self.temp_state = []
             raise
-        
+
     def set_param2fit(self, uid, param2fit):
         """
@@ -663,5 +663,5 @@
         """
         self.page_finder[uid].set_param2fit(param2fit)
-        
+
     def set_graph_id(self, uid, graph_id):
         """
@@ -669,5 +669,5 @@
         """
         self.page_finder[uid].set_graph_id(graph_id)
-        
+
     def get_graph_id(self, uid):
         """
@@ -675,5 +675,5 @@
         """
         return self.page_finder[uid].get_graph_id()
-                          
+
     def save_fit_state(self, filepath, fitstate):
         """
@@ -693,5 +693,5 @@
         if uid in self.page_finder.keys():
             self.page_finder[uid].set_weight(flag=flag, is2d=is2d)
-                    
+
     def set_fit_range(self, uid, qmin, qmax, fid=None):
         """
@@ -706,5 +706,5 @@
         if uid in self.page_finder.keys():
             self.page_finder[uid].set_range(qmin=qmin, qmax=qmax, fid=fid)
-      
+
     def schedule_for_fit(self, value=0, uid=None):
         """
@@ -717,5 +717,5 @@
         if uid in self.page_finder.keys():
             self.page_finder[uid].schedule_tofit(value)
-          
+
     def get_page_finder(self):
         """
@@ -723,9 +723,9 @@
         """
         return self.page_finder
-    
+
     def set_page_finder(self, modelname, names, values):
         """
         Used by simfitpage.py to reset a parameter given the string constrainst.
-         
+
         :param modelname: the name ot the model for with the parameter
                             has to reset
@@ -741,13 +741,13 @@
                     value.set_model_param(names, values)
                     break
-         
+
     def split_string(self, item):
         """
         receive a word containing dot and split it. used to split parameterset
         name into model name and parameter name example: ::
-        
+
             paramaterset (item) = M1.A
             Will return model_name = M1 , parameter name = A
-            
+
         """
         if item.find(".") >= 0:
@@ -760,5 +760,5 @@
                 param_name = param_names[1]
             return model_name, param_name
-   
+
     def on_bumps_options(self, event=None):
         from bumps.gui.fit_dialog import OpenFitOptions
@@ -786,5 +786,5 @@
                         panel = self.fit_panel.opened_pages[uid]
                         panel._on_fit_complete()
-  
+
     def set_smearer(self, uid, smearer, fid, qmin=None, qmax=None, draw=True,
                     enable_smearer=False):
@@ -792,5 +792,5 @@
         Get a smear object and store it to a fit problem of fid as id. If proper
         flag is enable , will plot the theory with smearing information.
-        
+
         :param smearer: smear object to allow smearing data of id fid
         :param enable_smearer: Define whether or not all (data, model) contained
@@ -828,5 +828,5 @@
                 qmin=qmin, qmax=qmax, weight=weight)
             self._mac_sleep(0.2)
-            
+
     def _mac_sleep(self, sec=0.2):
         """
@@ -835,5 +835,5 @@
         if ON_MAC:
             time.sleep(sec)
-        
+
     def draw_model(self, model, page_id, data=None, smearer=None,
                    enable1D=True, enable2D=False,
@@ -845,5 +845,5 @@
         """
         Draw model.
-        
+
         :param model: the model to draw
         :param name: the name of the model to draw
@@ -856,5 +856,5 @@
         :param qstep: number of step to divide the x and y-axis
         :param update_chisqr: update chisqr [bool]
-             
+
         """
         #self.weight = weight
@@ -889,5 +889,5 @@
                                 update_chisqr=update_chisqr,
                                 source=source)
-            
+
     def onFit(self, uid):
         """
@@ -934,5 +934,5 @@
                                      is2d=page._is_2D())
                     if not page.param_toFit:
-                        msg = "No fitting parameters for %s"%page.window_caption
+                        msg = "No fitting parameters for %s" % page.window_caption
                         wx.PostEvent(page.parent.parent,
                                      StatusEvent(status=msg, info="error",
@@ -979,5 +979,5 @@
         msg = "Fitting is in progress..."
         wx.PostEvent(self.parent, StatusEvent(status=msg, type="progress"))
-        
+
         #Handler used for fit engine displayed message
         handler = ConsoleUpdate(parent=self.parent,
@@ -1019,5 +1019,5 @@
         msg = "Fitting is in progress..."
         wx.PostEvent(self.parent, StatusEvent(status=msg, type="progress"))
-        
+
         return True
 
@@ -1043,5 +1043,5 @@
                                                    group_id=group_id,
                                                    action='remove'))
-           
+
     def store_data(self, uid, data_list=None, caption=None):
         """
@@ -1054,9 +1054,9 @@
         if data_list is None:
             data_list = []
-        
+
         self.page_finder[uid].set_fit_data(data=data_list)
         if caption is not None:
             self.page_finder[uid].set_fit_tab_caption(caption=caption)
-            
+
     def on_add_new_page(self, event=None):
         """
@@ -1074,7 +1074,7 @@
                                                        info="warning"))
         except:
-            msg = "Creating Fit page: %s"%sys.exc_value
+            msg = "Creating Fit page: %s" % sys.exc_value
             wx.PostEvent(self.parent, StatusEvent(status=msg, info="error"))
-        
+
     def add_fit_page(self, data):
         """
@@ -1105,5 +1105,5 @@
                     group_id = str(page.uid) + " Model2D"
                     data.group_id = theory_data.group_id
-                    wx.PostEvent(self.parent, 
+                    wx.PostEvent(self.parent,
                              NewPlotEvent(group_id=group_id,
                                                action="delete"))
@@ -1116,7 +1116,7 @@
         if self.batch_page is not None and self.batch_on:
             self.batch_page.draw_page()
-            
+
         return page
-            
+
     def _onEVT_SLICER_PANEL(self, event):
         """
@@ -1124,5 +1124,5 @@
         event.panel_name. this method update slicer panel
         for a given interactor.
-        
+
         :param event: contains type of slicer , paramaters for updating
             the panel and panel_name to find the slicer 's panel concerned.
@@ -1133,7 +1133,7 @@
             if self.parent.panels[item].window_caption.startswith(name):
                 self.parent.panels[item].set_slicer(event.type, event.params)
-                
+
         #self.parent._mgr.Update()
-   
+
     def _closed_fitpage(self, event):
         """
@@ -1147,5 +1147,5 @@
                 event.data.__class__.__name__ == "Data1D":
                 self.fit_panel.close_page_with_data(event.data)
-  
+
     def _reset_schedule_problem(self, value=0, uid=None):
         """
@@ -1160,5 +1160,5 @@
             if uid in self.page_finder.keys():
                 self.page_finder[uid].schedule_tofit(value)
-                
+
     def _add_problem_to_fit(self, fitproblem, pars, fitter, fit_id):
         """
@@ -1187,5 +1187,5 @@
                         qmax=qmax)
         fitter.select_problem_for_fit(id=fit_id, value=1)
-       
+
     def _onSelect(self, event):
         """
@@ -1198,5 +1198,5 @@
         Plugin.on_perspective(self, event=event)
         self.select_data(panel)
-        
+
     def select_data(self, panel):
         """
@@ -1212,10 +1212,10 @@
                 data = plottable
                 self.add_fit_page(data=[data])
-            
+
     def update_fit(self, result=None, msg=""):
         """
         """
         print "update_fit result", result
-        
+
     def _batch_fit_complete(self, result, pars, page_id,
                             batch_outputs, batch_inputs, elapsed=None):
@@ -1231,5 +1231,5 @@
         if uid in self.fit_thread_list.keys():
             del self.fit_thread_list[uid]
-          
+
         self._update_fit_button(page_id)
         t1 = time.time()
@@ -1239,8 +1239,8 @@
         wx.PostEvent(self.parent, StatusEvent(status=msg, info="info",
                                               type="stop"))
-       
+
         if batch_outputs is None:
             batch_outputs = {}
-        
+
         # format batch_outputs
         batch_outputs["Chi2"] = []
@@ -1278,5 +1278,5 @@
                 if data is not None and hasattr(data, "sas_data"):
                     data = data.sas_data
-                
+
                 is_data2d = issubclass(data.__class__, Data2D)
                 #check consistency of arrays
@@ -1327,5 +1327,5 @@
                     if res.pvec.__class__ == numpy.float64:
                         res.pvec = [res.pvec]
-                        
+
                     cell = BatchCell()
                     cell.label = res.fitness
@@ -1354,8 +1354,8 @@
                     if key not in param_list and key not in ["Chi2", "Data"]:
                         batch_outputs[key].append(EMPTY)
-                                
+
                 self.page_finder[pid].set_batch_result(batch_inputs=batch_inputs,
                                                        batch_outputs=batch_outputs)
-               
+
                 cpage = self.fit_panel.get_page_by_id(pid)
                 cpage._on_fit_complete()
@@ -1387,5 +1387,5 @@
                                          batch_outputs=batch_outputs,
                                          batch_inputs=batch_inputs)
-        
+
         wx.PostEvent(self.parent, StatusEvent(status=msg, error="info",
                                               type="stop"))
@@ -1397,8 +1397,8 @@
             if key in ["Chi2", "Data"] or shownkeystr.count(key) > 0:
                 tbatch_outputs[key] = batch_outputs[key]
-                
+
         wx.CallAfter(self.parent.on_set_batch_result, tbatch_outputs,
                      batch_inputs, self.sub_menu)
-        
+
     def on_set_batch_result(self, page_id, fid, batch_outputs, batch_inputs):
         """
@@ -1420,5 +1420,5 @@
         cell.label = data.name
         cell.value = index
-        
+
         if theory_data != None:
             #Suucessful fit
@@ -1430,5 +1430,5 @@
                 if group_id not in theory_data.list_group_id:
                     theory_data.list_group_id.append(group_id)
-                
+
             try:
                 # associate residuals plot
@@ -1454,5 +1454,5 @@
                 batch_inputs[param] = []
             batch_inputs[param].append(data.sample.temperature)
-        
+
     def _fit_completed(self, result, page_id, batch_outputs,
                        batch_inputs=None, pars=None, elapsed=None):
@@ -1522,5 +1522,5 @@
                                                               info="error",
                                                               type="stop"))
-                    
+
         except:
             msg = "Fit completed but Following"
@@ -1528,9 +1528,9 @@
             wx.PostEvent(self.parent, StatusEvent(status=msg, info="warning",
                                                   type="stop"))
-           
+
     def _update_fit_button(self, page_id):
         """
         Update Fit button when fit stopped
-        
+
         : parameter page_id: fitpage where the button is
         """
@@ -1540,10 +1540,10 @@
             page = self.fit_panel.get_page_by_id(uid)
             page._on_fit_complete()
-        
+
     def _on_show_panel(self, event):
         """
         """
         pass
-    
+
     def on_reset_batch_flag(self, event):
         """
@@ -1561,5 +1561,5 @@
             menu_item.Check(True)
             self.batch_reset_flag = False
-        
+
         ## post a message to status bar
         msg = "Set Chain Fitting: %s" % str(not self.batch_reset_flag)
@@ -1571,7 +1571,7 @@
         """
         Receive a panel as event and send it to guiframe
-        
+
         :param event: event containing a panel
-        
+
         """
         if event.panel is not None:
@@ -1582,5 +1582,5 @@
             event.panel.uid = event_id
             self.mypanels.append(event.panel)
-       
+
     def _onclearslicer(self, event):
         """
@@ -1590,5 +1590,5 @@
         for panel in self.slicer_panels:
             if panel.window_caption == name:
-                
+
                 for item in self.parent.panels:
                     if hasattr(self.parent.panels[item], "uid"):
@@ -1598,11 +1598,11 @@
                             break
                 break
-    
+
     def _on_model_panel(self, evt):
         """
-        react to model selection on any combo box or model menu.plot the model  
-        
+        react to model selection on any combo box or model menu.plot the model
+
         :param evt: wx.combobox event
-        
+
         """
         model = evt.model
@@ -1625,5 +1625,5 @@
         if self.batch_page is not None and self.batch_on:
             self.batch_page.draw_page()
-        
+
     def _update1D(self, x, output):
         """
@@ -1632,5 +1632,5 @@
         msg = "Plot updating ... "
         wx.PostEvent(self.parent, StatusEvent(status=msg, type="update"))
-        
+
     def _complete1D(self, x, y, page_id, elapsed, index, model,
                     weight=None, fid=None,
@@ -1643,5 +1643,5 @@
         try:
             numpy.nan_to_num(y)
-            
+
             new_plot = Data1D(x=x, y=y)
             new_plot.is_data = False
@@ -1661,11 +1661,11 @@
             #the same id
             theory_data = self.page_finder[page_id].get_theory_data(fid=data.id)
-            
+
             if data.is_data:
                 data_name = str(data.name)
             else:
                 data_name = str(model.__class__.__name__)
-            
-            new_plot.name = model.name + " [" + data_name +"]"
+
+            new_plot.name = model.name + " [" + data_name + "]"
             new_plot.xaxis(_xaxis, _xunit)
             new_plot.yaxis(_yaxis, _yunit)
@@ -1687,5 +1687,5 @@
             caption = current_pg.window_caption
             self.page_finder[page_id].set_fit_tab_caption(caption=caption)
-           
+
             self.page_finder[page_id].set_theory_data(data=new_plot,
                                                       fid=data.id)
@@ -1711,5 +1711,5 @@
         except:
             raise
-   
+
     def _update2D(self, output, time=None):
         """
@@ -1719,5 +1719,5 @@
         #updating ... ", type="update"))
         #self.ready_fit()
-  
+
     def _complete2D(self, image, data, model, page_id, elapsed, index, qmin,
                 qmax, fid=None, weight=None, toggle_mode_on=False, state=None,
@@ -1746,5 +1746,5 @@
         new_plot.xmax = data.xmax
         title = data.title
-        
+
         new_plot.is_data = False
         if data.is_data:
@@ -1754,9 +1754,9 @@
 
         if len(title) > 1:
-            new_plot.title = "Model2D for %s "% model.name + data_name
+            new_plot.title = "Model2D for %s " % model.name + data_name
         new_plot.name = model.name + " [" + \
                                     data_name + "]"
         theory_data = deepcopy(new_plot)
-        
+
         self.page_finder[page_id].set_theory_data(data=theory_data,
                                                   fid=data.id)
@@ -1787,5 +1787,5 @@
         msg = "Computation  completed!"
         wx.PostEvent(self.parent, StatusEvent(status=msg, type="stop"))
-    
+
     def _draw_model2D(self, model, page_id, qmin,
                       qmax,
@@ -1799,5 +1799,5 @@
         """
         draw model in 2D
-        
+
         :param model: instance of the model to draw
         :param description: the description of the model
@@ -1806,5 +1806,5 @@
         :param qmax: the maximum value to draw model 2D
         :param qstep: the number of division of Qx and Qy of the model to draw
-            
+
         """
         if not enable2D:
@@ -1829,5 +1829,5 @@
                                     qmin=qmin,
                                     qmax=qmax,
-                                    weight=weight, 
+                                    weight=weight,
                                     fid=fid,
                                     toggle_mode_on=toggle_mode_on,
@@ -1848,8 +1848,8 @@
         """
         Draw model 1D from loaded data1D
-        
+
         :param data: loaded data
         :param model: the model to plot
-        
+
         """
         if not enable1D:
@@ -1878,5 +1878,5 @@
             self.calc_1D = Calc1D(data=data,
                                   model=model,
-                                  page_id=page_id, 
+                                  page_id=page_id,
                                   qmin=qmin,
                                   qmax=qmax,
@@ -1895,8 +1895,8 @@
             msg += " %s" % sys.exc_value
             wx.PostEvent(self.parent, StatusEvent(status=msg))
-    
+
     def _cal_chisqr(self, page_id, data, weight, fid=None, index=None):
         """
-        Get handy Chisqr using the output from draw1D and 2D, 
+        Get handy Chisqr using the output from draw1D and 2D,
         instead of calling expansive CalcChisqr in guithread
         """
@@ -1929,5 +1929,5 @@
         else:
             # 1 d theory from model_thread is only in the range of index
-            if index == None: 
+            if index == None:
                 index = numpy.ones(len(data_copy.y), dtype=bool)
             if weight != None:
@@ -1941,5 +1941,5 @@
                 dy[dy == 0] = 1
             fn = data_copy.y[index]
-            
+
             theory_data = self.page_finder[page_id].get_theory_data(fid=data_copy.id)
             if theory_data == None:
@@ -1947,27 +1947,27 @@
             gn = theory_data.y
             en = dy[index]
-        
+
         # residual
         try:
             res = (fn - gn) / en
         except ValueError:
-            print "Unmatch lengths %s, %s, %s"% (len(fn), len(gn), len(en))
+            print "Unmatch lengths %s, %s, %s" % (len(fn), len(gn), len(en))
             return
-        
+
         residuals = res[numpy.isfinite(res)]
         # get chisqr only w/finite
         chisqr = numpy.average(residuals * residuals)
-        
+
         self._plot_residuals(page_id=page_id, data=data_copy,
                              fid=fid,
                              weight=weight, index=index)
-        
+
         return chisqr
-    
+
     def _plot_residuals(self, page_id, weight, fid=None,
                         data=None, index=None):
         """
         Plot the residuals
-        
+
         :param data: data
         :param index: index array (bool)
@@ -2040,6 +2040,6 @@
         theory_name = str(theory_data.name.split()[0])
         new_plot = residuals
-        new_plot.name = "Residuals for " + str(theory_name) + "[" +\
-                        str(data.name) +"]"
+        new_plot.name = "Residuals for " + str(theory_name) + "[" + \
+                        str(data.name) + "]"
         ## allow to highlight data when plotted
         new_plot.interactive = True
Index: src/sas/perspectives/fitting/fitting_widgets.py
===================================================================
--- src/sas/perspectives/fitting/fitting_widgets.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ src/sas/perspectives/fitting/fitting_widgets.py	(revision 2f4b43041eaa7b7f496750f223a299cb33cd268e)
@@ -21,6 +21,6 @@
         ScrolledPanel.__init__(self, *args, **kwds)
         self.SetupScrolling()
-        
-        
+
+
 class BatchDataDialog(wx.Dialog):
     """
@@ -35,5 +35,5 @@
         self.data_2d_selected = None
         self._do_layout()
-   
+
     def _do_layout(self):
         """
@@ -43,5 +43,5 @@
         box_description = wx.StaticBox(self, -1, str("Hint"))
         hint_sizer = wx.StaticBoxSizer(box_description, wx.VERTICAL)
-        selection_sizer = wx.GridBagSizer(5,5)
+        selection_sizer = wx.GridBagSizer(5, 5)
         button_sizer = wx.BoxSizer(wx.HORIZONTAL)
         self.data_1d_selected = wx.RadioButton(self, -1, 'Data1D',
@@ -60,21 +60,21 @@
         iy = 0
         selection_sizer.Add(self.data_1d_selected, (iy, ix),
-                           (1, 1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+                           (1, 1), wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
         iy += 1
         selection_sizer.Add(self.data_2d_selected, (iy, ix),
-                           (1, 1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+                           (1, 1), wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
         #contruction the sizer contaning button
-        button_sizer.Add((20, 20), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        button_sizer.Add((20, 20), 1, wx.EXPAND | wx.ADJUST_MINSIZE, 0)
         button_sizer.Add(button_cancel, 0,
-                         wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10)
+                         wx.LEFT | wx.RIGHT | wx.ADJUST_MINSIZE, 10)
         button_sizer.Add(button_OK, 0,
-                                wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10)
-        vbox.Add(hint_sizer, 0, wx.EXPAND|wx.ALL, 10)
-        vbox.Add(selection_sizer, 0, wx.TOP|wx.BOTTOM, 10)
-        vbox.Add(wx.StaticLine(self, -1),  0, wx.EXPAND, 0)
-        vbox.Add(button_sizer, 0, wx.TOP|wx.BOTTOM, 10)
+                                wx.LEFT | wx.RIGHT | wx.ADJUST_MINSIZE, 10)
+        vbox.Add(hint_sizer, 0, wx.EXPAND | wx.ALL, 10)
+        vbox.Add(selection_sizer, 0, wx.TOP | wx.BOTTOM, 10)
+        vbox.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
+        vbox.Add(button_sizer, 0, wx.TOP | wx.BOTTOM, 10)
         self.SetSizer(vbox)
         self.Layout()
-        
+
     def get_data(self):
         """
@@ -97,5 +97,5 @@
         self._max_data = nb_data
         self._nb_selected_data = nb_data
-        
+
         self.SetSize((WIDTH, HEIGHT))
         self.list_of_ctrl = []
@@ -104,5 +104,5 @@
         select_data_text = " %s Data selected.\n" % str(self._nb_selected_data)
         self._data_text_ctrl = wx.StaticText(self, -1, str(select_data_text))
-                               
+
         self._data_text_ctrl.SetForegroundColour('blue')
         self._sizer_main = wx.BoxSizer(wx.VERTICAL)
@@ -111,7 +111,7 @@
         self._choice_sizer = wx.GridBagSizer(5, 5)
         self._panel = DialogPanel(self, style=wx.RAISED_BORDER,
-                               size=(WIDTH-20, HEIGHT/3))
+                               size=(WIDTH - 20, HEIGHT / 3))
         self.__do_layout(data_list, text=text)
-        
+
     def __do_layout(self, data_list, text=''):
         """
@@ -141,25 +141,25 @@
             self.list_of_ctrl.append((cb, data_list[i]))
             self._choice_sizer.Add(cb, (iy, ix),
-                           (1, 1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+                           (1, 1), wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
             iy += 1
         self._panel.SetSizer(self._choice_sizer)
         #add sizer
-        self._sizer_button.Add((20, 20), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        self._sizer_button.Add((20, 20), 1, wx.EXPAND | wx.ADJUST_MINSIZE, 0)
         button_cancel = wx.Button(self, wx.ID_CANCEL, "Cancel")
         self._sizer_button.Add(button_cancel, 0,
-                          wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10)
+                          wx.LEFT | wx.RIGHT | wx.ADJUST_MINSIZE, 10)
         button_OK = wx.Button(self, wx.ID_OK, "Ok")
         button_OK.SetFocus()
         self._sizer_button.Add(button_OK, 0,
-                                wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10)
+                                wx.LEFT | wx.RIGHT | wx.ADJUST_MINSIZE, 10)
         static_line = wx.StaticLine(self, -1)
-        self._sizer_txt.Add(self._panel, 0, wx.EXPAND|wx.ALL, 10)
-        self._sizer_main.Add(self._sizer_txt, 0, wx.EXPAND|wx.ALL, 10)
-        self._sizer_main.Add(self._data_text_ctrl, 0,  wx.EXPAND|wx.ALL, 10)
+        self._sizer_txt.Add(self._panel, 0, wx.EXPAND | wx.ALL, 10)
+        self._sizer_main.Add(self._sizer_txt, 0, wx.EXPAND | wx.ALL, 10)
+        self._sizer_main.Add(self._data_text_ctrl, 0, wx.EXPAND | wx.ALL, 10)
         self._sizer_main.Add(static_line, 0, wx.EXPAND, 0)
-        self._sizer_main.Add(self._sizer_button, 0, wx.EXPAND|wx.ALL, 10)
+        self._sizer_main.Add(self._sizer_button, 0, wx.EXPAND | wx.ALL, 10)
         self.SetSizer(self._sizer_main)
         self.Layout()
-        
+
     def get_data(self):
         """
@@ -172,5 +172,5 @@
                 temp.append(data)
         return temp
-    
+
     def _count_selected_data(self, event):
         """
Index: src/sas/perspectives/fitting/hint_fitpage.py
===================================================================
--- src/sas/perspectives/fitting/hint_fitpage.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ src/sas/perspectives/fitting/hint_fitpage.py	(revision 2f4b43041eaa7b7f496750f223a299cb33cd268e)
@@ -13,13 +13,13 @@
     ## Title to appear on top of the window
     window_caption = "Hint page "
-    
+
     def __init__(self, parent):
         wx.ScrolledWindow.__init__(self, parent,
-                 style = wx.FULL_REPAINT_ON_RESIZE)
+                 style=wx.FULL_REPAINT_ON_RESIZE)
         PanelBase.__init__(self, parent)
         msg = "right click on the data when it is highlighted "
         msg += "the select option to fit for futher options"
         self.do_layout()
-        
+
     def do_layout(self):
         """
@@ -27,5 +27,5 @@
         """
         name = "Hint"
-        box_description= wx.StaticBox(self, -1, name)
+        box_description = wx.StaticBox(self, -1, name)
         boxsizer = wx.StaticBoxSizer(box_description, wx.VERTICAL)
         msg = "    How to link data to the control panel: \n \n"
@@ -34,5 +34,5 @@
         msg += "    Finally, select 'Select data for fitting' in the pop-up menu. \n"
         self.hint_txt = wx.StaticText(self, -1, msg, style=wx.ALIGN_LEFT)
-        boxsizer.Add(self.hint_txt, wx.ALL|wx.EXPAND, 20)
+        boxsizer.Add(self.hint_txt, wx.ALL | wx.EXPAND, 20)
         self.vbox = wx.BoxSizer(wx.VERTICAL)
         self.vbox.Add(boxsizer)
@@ -42,13 +42,13 @@
         self.SetScrollbars(20, 20, 25, 65)
         self.Layout()
-        
+
     def createMemento(self):
         return
-        
-        
+
+
 class HelpWindow(wx.Frame):
     def __init__(self, parent, id, title):
         wx.Frame.__init__(self, parent, id, title, size=(570, 400))
-       
+
         self.page = HintFitPage(self)
         self.Centre()
Index: src/sas/perspectives/fitting/model_thread.py
===================================================================
--- src/sas/perspectives/fitting/model_thread.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ src/sas/perspectives/fitting/model_thread.py	(revision 2f4b43041eaa7b7f496750f223a299cb33cd268e)
@@ -43,5 +43,5 @@
         self.update_chisqr = update_chisqr
         self.source = source
-        
+
     def compute(self):
         """
@@ -59,9 +59,9 @@
                                    math.fabs(self.data.ymin)), 2)
                 self.qmax = math.sqrt(newx + newy)
-        
+
         if self.data is None:
             msg = "Compute Calc2D receive data = %s.\n" % str(self.data)
             raise ValueError, msg
-            
+
         # Define matrix where data will be plotted
         radius = numpy.sqrt((self.data.qx_data * self.data.qx_data) + \
@@ -73,5 +73,5 @@
         index_model = index_model & self.data.mask
         index_model = index_model & numpy.isfinite(self.data.data)
-      
+
         if self.smearer is not None:
             # Set smearer w/ data, model and index.
@@ -112,5 +112,5 @@
                        update_chisqr=self.update_chisqr,
                        source=self.source)
-        
+
 
 class Calc1D(CalcThread):
@@ -156,5 +156,5 @@
         self.out = None
         self.index = None
-        
+
     def compute(self):
         """
@@ -164,5 +164,5 @@
         output = numpy.zeros((len(self.data.x)))
         index = (self.qmin <= self.data.x) & (self.data.x <= self.qmax)
-     
+
         ##smearer the ouput of the plot
         if self.smearer is not None:
@@ -174,7 +174,7 @@
         else:
             output[index] = self.model.evalDistribution(self.data.x[index])
-         
+
         elapsed = time.time() - self.starttime
-       
+
         self.complete(x=self.data.x[index], y=output[index],
                       page_id=self.page_id,
@@ -187,5 +187,5 @@
                       update_chisqr=self.update_chisqr,
                       source=self.source)
-        
+
     def results(self):
         """
@@ -196,23 +196,23 @@
 """
 Example: ::
-                     
+
     class CalcCommandline:
         def __init__(self, n=20000):
             #print thread.get_ident()
             from sas.models.CylinderModel import CylinderModel
-            
+
             model = CylinderModel()
-            
-             
+
+
             print model.runXY([0.01, 0.02])
-            
+
             qmax = 0.01
             qstep = 0.0001
             self.done = False
-            
+
             x = numpy.arange(-qmax, qmax+qstep*0.01, qstep)
             y = numpy.arange(-qmax, qmax+qstep*0.01, qstep)
-        
-        
+
+
             calc_thread_2D = Calc2D(x, y, None, model.clone(),None,
                                     -qmax, qmax,qstep,
@@ -220,18 +220,18 @@
                                             updatefn=self.update ,
                                             yieldtime=0.0)
-         
+
             calc_thread_2D.queue()
             calc_thread_2D.ready(2.5)
-            
+
             while not self.done:
                 time.sleep(1)
-    
+
         def update(self,output):
             print "update"
-    
+
         def complete(self, image, data, model, elapsed, qmin, qmax,index, qstep ):
             print "complete"
             self.done = True
-    
+
     if __name__ == "__main__":
         CalcCommandline()
Index: src/sas/perspectives/fitting/models.py
===================================================================
--- src/sas/perspectives/fitting/models.py	(revision 6f82ba1b683b11bceac4d67527c66113ea176632)
+++ src/sas/perspectives/fitting/models.py	(revision 2f4b43041eaa7b7f496750f223a299cb33cd268e)
@@ -20,5 +20,5 @@
 from sas.models.BaseComponent import BaseComponent
 from sas.guiframe.CategoryInstaller import CategoryInstaller
-   
+
 PLUGIN_DIR = 'plugin_models'
 
@@ -40,10 +40,10 @@
     """
     Do some checking before model adding plugins in the list
-    
+
     :param model: class model to add into the plugin list
     :param name:name of the module plugin
-    
+
     :return model: model if valid model or None if not valid
-    
+
     """
     #Check if the plugin is of type Model1DPlugin
@@ -63,5 +63,5 @@
         log(msg)
         return None
-   
+
     if hasattr(new_instance, "function"):
         try:
@@ -77,6 +77,6 @@
         return None
     return model
-  
-  
+
+
 def find_plugins_dir():
     """
@@ -85,9 +85,9 @@
     """
     dir = os.path.join(os.path.expanduser("~"), '.sasview', PLUGIN_DIR)
-    
+
     # If the plugin directory doesn't exist, create it
     if not os.path.isdir(dir):
         os.makedirs(dir)
-        
+
     # Find paths needed
     try:
@@ -132,5 +132,5 @@
             raise type, value, traceback
         return 1
-    
+
 report_problem = ReportProblem()
 
@@ -173,5 +173,5 @@
             if toks[1] == '.py' and not toks[0] == '__init__':
                 name = toks[0]
-            
+
                 path = [os.path.abspath(dir)]
                 file = None
@@ -194,5 +194,5 @@
                     log(msg)
                 finally:
-              
+
                     if not file == None:
                         file.close()
@@ -213,14 +213,14 @@
         """
         self.mydict = {}
-        
+
     def set_list(self, name, mylist):
         """
         :param name: the type of the list
         :param mylist: the list to add
-        
+
         """
         if name not in self.mydict.keys():
             self.reset_list(name, mylist)
-            
+
     def reset_list(self, name, mylist):
         """
@@ -229,5 +229,5 @@
         """
         self.mydict[name] = mylist
-            
+
     def get_list(self):
         """
@@ -235,6 +235,6 @@
         """
         return self.mydict
-        
-        
+
+
 class ModelManagerBase:
     """
@@ -262,5 +262,5 @@
     event_owner = None
     last_time_dir_modified = 0
-    
+
     def __init__(self):
         """
@@ -269,5 +269,5 @@
         self.stored_plugins = {}
         self._getModelList()
-        
+
     def findModels(self):
         """
@@ -280,12 +280,12 @@
         logging.info("pluging model : %s\n" % str(temp))
         return temp
-        
+
     def _getModelList(self):
         """
         List of models we want to make available by default
         for this application
-    
+
         :return: the next free event ID following the new menu events
-        
+
         """
 
@@ -702,5 +702,5 @@
             #        self.shape_indep_list.append(BEPolyelectrolyte)
             self.model_name_list.append(BEPolyelectrolyte.__name__)
-            self.form_factor_dict[str(wx.NewId())] =  [SphereModel]
+            self.form_factor_dict[str(wx.NewId())] = [SphereModel]
         except:
             pass
@@ -1013,5 +1013,5 @@
         #self.shape_indep_list.append(FractalO_Z)
         #self.model_name_list.append(FractalO_Z.__name__)
-    
+
         #Looking for plugins
         self.stored_plugins = self.findModels()
@@ -1019,7 +1019,7 @@
         for name, plug in self.stored_plugins.iteritems():
             self.model_dictionary[name] = plug
-            
+
         self._get_multifunc_models()
-       
+
         return 0
 
@@ -1036,7 +1036,7 @@
                 is_modified = True
                 self.last_time_dir_modified = temp
-        
+
         return is_modified
-    
+
     def update(self):
         """
@@ -1055,5 +1055,5 @@
         else:
             return {}
-    
+
     def pulgins_reset(self):
         """
@@ -1074,5 +1074,5 @@
         self.model_combobox.reset_list("Customized Models", self.plugins)
         return self.model_combobox.get_list()
-       
+
 ##   I believe the next four methods are for the old form factor GUI
 ##   where the dropdown showed a list of categories which then rolled out
@@ -1101,5 +1101,5 @@
         ## guiframe reference
 #        self.event_owner = event_owner
-        
+
 #        shape_submenu = wx.Menu()
 #        shape_indep_submenu = wx.Menu()
@@ -1112,19 +1112,19 @@
 #                                         " simple shape"],
 #                         list1=self.shape_list)
-        
+
 #        self._fill_simple_menu(menuinfo=["Shape-Independent",
 #                                         shape_indep_submenu,
 #                                         "List of shape-independent models"],
 #                         list1=self.shape_indep_list)
-        
+
 #        self._fill_simple_menu(menuinfo=["Structure Factors",
 #                                         structure_factor,
 #                                         "List of Structure factors models"],
 #                                list1=self.struct_list)
-        
+
 #        self._fill_plugin_menu(menuinfo=["Customized Models", added_models,
 #                                            "List of additional models"],
 #                                 list1=self.plugins)
-        
+
 #        self._fill_menu(menuinfo=["P(Q)*S(Q)", multip_models,
 #                                  "mulplication of 2 models"],
@@ -1132,5 +1132,5 @@
 #                                   list2=self.struct_list)
 #        return 0
-    
+
 #    def _fill_plugin_menu(self, menuinfo, list1):
 #        """
@@ -1143,5 +1143,5 @@
 #            menuinfo[1].Append(int(id), "Empty", msg)
 #        self._fill_simple_menu(menuinfo, list1)
-        
+
 #   def _fill_simple_menu(self, menuinfo, list1):
 #       """
@@ -1157,5 +1157,5 @@
 #       if len(list1) > 0:
 #           self.model_combobox.set_list(menuinfo[0], list1)
-            
+
 #            for item in list1:
 #                try:
@@ -1217,11 +1217,11 @@
 #        id = wx.NewId()
 #        self.modelmenu.AppendMenu(id, menuinfo[0], menuinfo[1], menuinfo[2])
-        
+
     def _on_model(self, evt):
         """
         React to a model menu event
-        
+
         :param event: wx menu event
-        
+
         """
         if int(evt.GetId()) in self.form_factor_dict.keys():
@@ -1232,10 +1232,10 @@
         else:
             model = self.struct_factor_dict[str(evt.GetId())]()
-        
+
         #TODO: investigate why the following two lines were left in the code
         #      even though the ModelEvent class doesn't exist
         #evt = ModelEvent(model=model)
         #wx.PostEvent(self.event_owner, evt)
-        
+
     def _get_multifunc_models(self):
         """
@@ -1250,9 +1250,9 @@
                 # pass to other items
                 pass
-                    
+
     def get_model_list(self):
         """
         return dictionary of models for fitpanel use
-        
+
         """
         ## Model_list now only contains attribute lists not category list.
@@ -1263,5 +1263,5 @@
         ##
         ## -PDB   April 26, 2014
-        
+
 #        self.model_combobox.set_list("Shapes", self.shape_list)
 #        self.model_combobox.set_list("Shape-Independent",
@@ -1274,5 +1274,5 @@
         self.model_combobox.set_list("Multi-Functions", self.multi_func_list)
         return self.model_combobox.get_list()
-    
+
     def get_model_name_list(self):
         """
@@ -1286,6 +1286,6 @@
         """
         return self.model_dictionary
-  
-        
+
+
 class ModelManager(object):
     """
@@ -1300,29 +1300,29 @@
     def findModels(self):
         return self.__modelmanager.findModels()
-    
+
     def _getModelList(self):
         return self.__modelmanager._getModelList()
-    
+
     def is_changed(self):
         return self.__modelmanager.is_changed()
-    
+
     def update(self):
         return self.__modelmanager.update()
-    
+
     def pulgins_reset(self):
         return self.__modelmanager.pulgins_reset()
-    
+
     def populate_menu(self, modelmenu, event_owner):
         return self.__modelmanager.populate_menu(modelmenu, event_owner)
-    
+
     def _on_model(self, evt):
         return self.__modelmanager._on_model(evt)
-    
+
     def _get_multifunc_models(self):
         return self.__modelmanager._get_multifunc_models()
-    
+
     def get_model_list(self):
         return self.__modelmanager.get_model_list()
-    
+
     def get_model_name_list(self):
         return self.__modelmanager.get_model_name_list()
Index: src/sas/perspectives/fitting/pagestate.py
===================================================================
--- src/sas/perspectives/fitting/pagestate.py	(revision d838715645ac898163603c42de5b97740d520c4b)
+++ src/sas/perspectives/fitting/pagestate.py	(revision 2f4b43041eaa7b7f496750f223a299cb33cd268e)
@@ -45,34 +45,30 @@
                       ["qmax", "qmax", "float"],
                       ["npts", "npts", "float"],
-                      #["shape_rbutton", "shape_rbutton", "bool"],
-                      #["shape_indep_rbutton", "shape_indep_rbutton", "bool"],
-                      #["plugin_rbutton", "plugin_rbutton", "bool"],
-                      #["struct_rbutton", "struct_rbutton", "bool"],
                       ["categorycombobox", "categorycombobox", "string"],
                       ["formfactorcombobox", "formfactorcombobox", "string"],
                       ["structurecombobox", "structurecombobox", "string"],
-                      ["multi_factor","multi_factor","float"],
-                      ["magnetic_on","magnetic_on", "bool"],
-                      ["enable_smearer","enable_smearer","bool"],
-                      ["disable_smearer","disable_smearer","bool"],
-                      ["pinhole_smearer","pinhole_smearer","bool"],
-                      ["slit_smearer","slit_smearer","bool"],
-                      ["enable_disp","enable_disp","bool"],
-                      ["disable_disp","disable_disp","bool"],
-                      ["dI_noweight","dI_noweight","bool"],
-                      ["dI_didata","dI_didata","bool"],
-                      ["dI_sqrdata","dI_sqrdata","bool"],
-                      ["dI_idata","dI_idata","bool"],
-                      ["enable2D","enable2D","bool"],
-                      ["cb1","cb1","bool"],
-                      ["tcChi","tcChi","float"],
+                      ["multi_factor", "multi_factor", "float"],
+                      ["magnetic_on", "magnetic_on", "bool"],
+                      ["enable_smearer", "enable_smearer", "bool"],
+                      ["disable_smearer", "disable_smearer", "bool"],
+                      ["pinhole_smearer", "pinhole_smearer", "bool"],
+                      ["slit_smearer", "slit_smearer", "bool"],
+                      ["enable_disp", "enable_disp", "bool"],
+                      ["disable_disp", "disable_disp", "bool"],
+                      ["dI_noweight", "dI_noweight", "bool"],
+                      ["dI_didata", "dI_didata", "bool"],
+                      ["dI_sqrdata", "dI_sqrdata", "bool"],
+                      ["dI_idata", "dI_idata", "bool"],
+                      ["enable2D", "enable2D", "bool"],
+                      ["cb1", "cb1", "bool"],
+                      ["tcChi", "tcChi", "float"],
                       ["smearer", "smearer", "float"],
-                      ["smear_type","smear_type", "string"],
+                      ["smear_type", "smear_type", "string"],
                       ["dq_l", "dq_l", "string"],
-                      ["dq_r","dq_r", "string"],
+                      ["dq_r", "dq_r", "string"],
                       ["dx_max", "dx_max", "float"],
-                      ["dx_min","dx_min", "float"],
+                      ["dx_min", "dx_min", "float"],
                       ["dxl", "dxl", "float"],
-                      ["dxw","dxw", "float"]]
+                      ["dxw", "dxw", "float"]]
 
 list_of_model_attributes = [["values", "values"],
@@ -110,10 +106,10 @@
     """
     Create a numpy list from value extrated from the node
-    
+
     :param node: node from each the value is stored
     :param item: list name of three strings.the two first are name of data
         attribute and the third one is the type of the value of that
         attribute. type can be string, float, bool, etc.
-    
+
     : return: numpy array
     """
@@ -124,5 +120,5 @@
             try:
                 return node.get(item[0]).strip() == "True"
-                
+
             except:
                 return None
@@ -132,6 +128,6 @@
             except:
                 return None
-            
-            
+
+
 class PageState(object):
     """
@@ -141,8 +137,8 @@
         """
         Initialize the current state
-        
+
         :param model: a selected model within a page
         :param data:
-        
+
         """
         self.file = None
@@ -159,5 +155,5 @@
         self.is_2D = False
         self.images = None
-        
+
         #save additional information on data that dataloader.reader does not read
         self.is_data = None
@@ -172,8 +168,8 @@
         if self.data is not None and hasattr(self.data, "group_id"):
             self.data_group_id = self.data.group_id
-        
+
         ## reset True change the state of exsiting button
         self.reset = False
-       
+
         #engine type
         self.engine_type = None
@@ -225,5 +221,5 @@
         self.values = {}
         self.weights = {}
-                    
+
         #contains link between a model and selected parameters to fit
         self.param_toFit = []
@@ -251,5 +247,5 @@
         self.qmax_x = None
         self.qmin_x = None
-        
+
         self.npts = None
         self.name = ""
@@ -269,10 +265,10 @@
         self.enable_disp = False
         self.disable_disp = True
-       
+
         ## state of selected all check button
         self.cb1 = False
         ## store value of chisqr
         self.tcChi = None
-    
+
     def clone(self):
         """
@@ -292,18 +288,18 @@
         obj.model_list_box = copy.deepcopy(self.model_list_box)
         obj.engine_type = copy.deepcopy(self.engine_type)
-        
+
         obj.categorycombobox = self.categorycombobox
         obj.formfactorcombobox = self.formfactorcombobox
         obj.structurecombobox = self.structurecombobox
-        
+
         #obj.shape_rbutton = self.shape_rbutton
         #obj.shape_indep_rbutton = self.shape_indep_rbutton
         #obj.struct_rbutton = self.struct_rbutton
         #obj.plugin_rbutton = self.plugin_rbutton
-        
+
         obj.manager = self.manager
         obj.event_owner = self.event_owner
         obj.disp_list = copy.deepcopy(self.disp_list)
-        
+
         obj.enable2D = copy.deepcopy(self.enable2D)
         obj.parameters = copy.deepcopy(self.parameters)
@@ -316,5 +312,5 @@
         obj.disable_disp = copy.deepcopy(self.disable_disp)
         obj.tcChi = self.tcChi
-  
+
         if len(self._disp_obj_dict) > 0:
             for k, v in self._disp_obj_dict.iteritems():
@@ -343,5 +339,5 @@
         obj.dx_min = copy.deepcopy(self.dx_min)
         obj.dxl = copy.deepcopy(self.dxl)
-        obj.dxw = copy.deepcopy(self.dxw)        
+        obj.dxw = copy.deepcopy(self.dxw)
         obj.disp_box = copy.deepcopy(self.disp_box)
         obj.qmin = copy.deepcopy(self.qmin)
@@ -352,5 +348,5 @@
         obj.cb1 = copy.deepcopy(self.cb1)
         obj.smearer = copy.deepcopy(self.smearer)
-        
+
         for name, state in self.saved_states.iteritems():
             copy_name = copy.deepcopy(name)
@@ -358,5 +354,5 @@
             obj.saved_states[copy_name] = copy_state
         return obj
-    
+
     def _repr_helper(self, list, rep):
         """
@@ -375,5 +371,5 @@
             rep += "parameter unit: %s\n\n" % str(item[7])
         return rep
-    
+
     def __repr__(self):
         """
@@ -399,5 +395,5 @@
         #rep += "model type (form factor) selected: %s\n" % self.shape_rbutton 
         rep += "multi_factor : %s\n" % str(self.multi_factor)
-        rep += "magnetic_on : %s\n"% str(self.magnetic_on)
+        rep += "magnetic_on : %s\n" % str(self.magnetic_on)
         rep += "model type (Category) selected: %s\n" % self.categorycombobox
         #rep += "model type (shape independent) selected: %s\n" % self.shape_indep_rbutton
@@ -415,10 +411,10 @@
         rep += "Dispersity disable : %s\n" % str(self.disable_disp)
         rep += "Slit smearer enable: %s\n" % str(self.slit_smearer)
-        
+
         rep += "dI_noweight : %s\n" % str(self.dI_noweight)
         rep += "dI_didata : %s\n" % str(self.dI_didata)
         rep += "dI_sqrdata : %s\n" % str(self.dI_sqrdata)
         rep += "dI_idata : %s\n" % str(self.dI_idata)
-        
+
         rep += "2D enable : %s\n" % str(self.enable2D)
         rep += "All parameters checkbox selected: %s\n" % (self.cb1)
@@ -429,7 +425,7 @@
         rep += "dq_r  : %s\n" % self.dq_r
         rep += "dx_max  : %s\n" % str(self.dx_max)
-        rep += "dx_min : %s\n" % str(self.dx_min)  
+        rep += "dx_min : %s\n" % str(self.dx_min)
         rep += "dxl  : %s\n" % str(self.dxl)
-        rep += "dxw : %s\n" % str(self.dxw)    
+        rep += "dxw : %s\n" % str(self.dxw)
         rep += "model  : %s\n\n" % str(self.model)
         temp_parameters = []
@@ -450,5 +446,5 @@
                 temp_parameters = self.parameters
                 temp_fittable_param = self.fittable_param
-                
+
             rep += "number parameters(self.parameters): %s\n" % len(temp_parameters)
             rep = self._repr_helper(list=temp_parameters, rep=rep)
@@ -550,5 +546,5 @@
                     modelname = "Model name:" + " NAN"
                 model_name = CENTRE % modelname
-                 
+
             if name == "Plotting Range":
                 try:
@@ -572,14 +568,14 @@
                     paramval += param + "\n"
                     paramval_string += CENTRE % param + "\n"
-        
+
         text_string = "\n\n\n" + title + "\n\n" + file + \
                       "\n" + q_name + \
                       "\n" + chi2 + \
                       "\n\n" + paramval
-        
+
         title_name = self._check_html_format(title_name)
         file_name = self._check_html_format(file_name)
         title = self._check_html_format(title)
-                                  
+
         html_string = title_name + "\n" + file_name + \
                                    "\n" + model_name + \
@@ -591,7 +587,7 @@
                                    "\n" + FEET_1 % title + \
                                    "\n" + FEET_2
-                                                                      
+
         return html_string, text_string, title
-    
+
     def _check_html_format(self, name):
         """
@@ -600,11 +596,11 @@
         if name.count('%'):
             name = name.replace('%', '&#37')
-        
+
         return name
-    
+
     def report(self, figs=None, canvases=None):
         """
         Invoke report dialog panel
-        
+
         : param figs: list of pylab figures [list]
         """
@@ -638,5 +634,5 @@
         dialog = ReportDialog(report_list, None, -1, "")
         dialog.Show()
-        
+
     def _toXML_helper(self, thelist, element, newdoc):
         """
@@ -656,17 +652,17 @@
             sub_element.setAttribute('unit', str(item[7]))
             element.appendChild(sub_element)
-        
+
     def toXML(self, file="fitting_state.fitv", doc=None, entry_node=None):
         """
         Writes the state of the InversionControl panel to file, as XML.
-        
+
         Compatible with standalone writing, or appending to an
         already existing XML document. In that case, the XML document
         is required. An optional entry node in the XML document may also be given.
-        
+
         :param file: file to write to
         :param doc: XML document object [optional]
         :param entry_node: XML node within the XML document at which we will append the data [optional]
-        
+
         """
         from xml.dom.minidom import getDOMImplementation
@@ -697,9 +693,9 @@
                     entry_node = node_list.item(0)
                     entry_node.appendChild(top_element)
-                    
+
         attr = newdoc.createAttribute("version")
         attr.nodeValue = '1.0'
         top_element.setAttributeNode(attr)
-        
+
         # File name
         element = newdoc.createElement("filename")
@@ -709,5 +705,5 @@
             element.appendChild(newdoc.createTextNode(str(file)))
         top_element.appendChild(element)
-        
+
         element = newdoc.createElement("timestamp")
         element.appendChild(newdoc.createTextNode(time.ctime(self.timestamp)))
@@ -719,5 +715,5 @@
         inputs = newdoc.createElement("Attributes")
         top_element.appendChild(inputs)
-       
+
         if self.data is not None and hasattr(self.data, "group_id"):
             self.data_group_id = self.data.group_id
@@ -728,15 +724,15 @@
         if self.data is not None and hasattr(self.data, "id"):
             self.data_id = self.data.id
-       
+
         for item in list_of_data_attributes:
             element = newdoc.createElement(item[0])
             exec "element.setAttribute(item[0], str(self.%s))" % (item[1])
             inputs.appendChild(element)
-        
+
         for item in list_of_state_attributes:
             element = newdoc.createElement(item[0])
             exec "element.setAttribute(item[0], str(self.%s))" % (item[1])
             inputs.appendChild(element)
-            
+
         # For self.values ={ disp_param_name: [vals,...],...}
         # and for self.weights ={ disp_param_name: [weights,...],...}
@@ -752,8 +748,8 @@
                     com += "(newdoc.createTextNode(str(%s)))"
                     exec com % val
-                   
+
                 element.appendChild(sub_element)
             inputs.appendChild(element)
-        
+
         # Create doc for the dictionary of self._disp_obj_dic
         for item in list_of_obj_dic:
@@ -767,5 +763,5 @@
                 element.appendChild(sub_element)
             inputs.appendChild(element)
-                 
+
         for item in list_of_state_parameters:
             element = newdoc.createElement(item[0])
@@ -774,5 +770,5 @@
             exec com % item[1]
             inputs.appendChild(element)
-        
+
         # Save the file
         if doc is None:
@@ -783,5 +779,5 @@
         else:
             return newdoc
-        
+
     def _fromXML_helper(self, node, list):
         """
@@ -833,12 +829,12 @@
                          [minimum_displayed, minimum_value],
                          [maximum_displayed, maximum_value], unit])
-       
+
     def fromXML(self, file=None, node=None):
         """
         Load fitting state from a file
-        
+
         :param file: .fitv file
         :param node: node of a XML document to read from
-        
+
         """
         if file is not None:
@@ -846,12 +842,12 @@
             msg += " format for fitting files"
             raise RuntimeError, msg
-            
+
         if node.get('version')and node.get('version') == '1.0':
-            
+
             # Get file name
             entry = get_content('ns:filename', node)
             if entry is not None:
                 self.file = entry.text.strip()
-                
+
             # Get time stamp
             entry = get_content('ns:timestamp', node)
@@ -863,5 +859,5 @@
                     msg += " read timestamp\n %s" % sys.exc_value
                     logging.error(msg)
-            
+
             # Parse fitting attributes
             entry = get_content('ns:Attributes', node)
@@ -870,10 +866,10 @@
                 try:
                     exec "self.%s = parse_entry_helper(node, item)" % item[0]
-                    
+
                 except:
                     raise
 
             if entry is not None:
-                
+
                 for item in list_of_state_attributes:
                     node = get_content('ns:%s' % item[0], entry)
@@ -883,10 +879,10 @@
                     except:
                         raise
-                    
+
                 for item in list_of_state_parameters:
                     node = get_content("ns:%s" % item[0], entry)
                     exec "self._fromXML_helper(node=node, list=self.%s)" % \
                                                                     item[1]
-                
+
                 # Recover _disp_obj_dict from xml file
                 self._disp_obj_dict = {}
@@ -910,5 +906,5 @@
                         except:
                             pass
-                        
+
                 # get self.values and self.weights dic. if exists
                 for item in list_of_model_attributes:
@@ -929,5 +925,5 @@
                     dic[name] = numpy.array(list)
                     exec "self.%s = dic" % item[1]
-                    
+
     def set_plot_state(self, figs, canvases):
         """
@@ -943,9 +939,9 @@
         self.imgRAM = None
         wx.MemoryFSHandler()
-        
+
         # For no figures in the list, prepare empty plot
         if figs == None or len(figs) == 0:
             figs = [None]
-            
+
         # Loop over the list of figures
         # use wx.MemoryFSHandler
@@ -955,18 +951,18 @@
                 ind = figs.index(fig)
                 canvas = canvases[ind]
-                
+
             #store the image in wx.FileSystem Object 
             wx.FileSystem.AddHandler(wx.MemoryFSHandler())
-            
+
             # index of the fig
             ind = figs.index(fig)
-            
+
             #AddFile, image can be retrieved with 'memory:filename'
             self.imgRAM.AddFile('img_fit%s.png' % ind,
                                 canvas.bitmap, wx.BITMAP_TYPE_PNG)
-            
+
             #append figs
             images.append(fig)
-            
+
         return images
 
@@ -978,5 +974,5 @@
     ## File type
     type_name = "Fitting"
-    
+
     ## Wildcards
     type = ["Fitting files (*.fitv)|*.fitv"
@@ -984,5 +980,5 @@
     ## List of allowed extensions
     ext = ['.fitv', '.FITV', '.svs', 'SVS']
-    
+
     def __init__(self, call_back=None, cansas=True):
         CansasReader.__init__(self)
@@ -990,9 +986,9 @@
         Initialize the call-back method to be called
         after we load a file
-        
+
         :param call_back: call-back method
         :param cansas:  True = files will be written/read in CanSAS format
                         False = write CanSAS format
-            
+
         """
         ## Call back method to be executed after a file is read
@@ -1001,28 +997,28 @@
         self.cansas = cansas
         self.state = None
-        
+
     def get_state(self):
         return self.state
-        
+
     def read(self, path):
         """
         Load a new P(r) inversion state from file
-        
+
         :param path: file path
-        
+
         """
         if self.cansas == True:
             return self._read_cansas(path)
-     
+
     def _data2d_to_xml_doc(self, datainfo):
         """
         Create an XML document to contain the content of a Data2D
-        
+
         :param datainfo: Data2D object
-        
+
         """
         if not issubclass(datainfo.__class__, Data2D):
             raise RuntimeError, "The cansas writer expects a Data2D instance"
-        
+
         doc = xml.dom.minidom.Document()
         main_node = doc.createElement("SASroot")
@@ -1031,10 +1027,10 @@
         main_node.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance")
         main_node.setAttribute("xsi:schemaLocation", "cansas1d/%s http://svn.smallangles.net/svn/canSAS/1dwg/trunk/cansas1d.xsd" % self.version)
-        
+
         doc.appendChild(main_node)
-        
+
         entry_node = doc.createElement("SASentry")
         main_node.appendChild(entry_node)
-       
+
         write_node(doc, entry_node, "Title", datainfo.title)
         if datainfo is not None:
@@ -1042,5 +1038,5 @@
         for item in datainfo.run:
             runname = {}
-            if datainfo.run_name.has_key(item) and len(str(datainfo.run_name[item]))>1:
+            if datainfo.run_name.has_key(item) and len(str(datainfo.run_name[item])) > 1:
                 runname = {'name': datainfo.run_name[item] }
             write_node(doc, entry_node, "Run", item, runname)
@@ -1052,5 +1048,5 @@
             exec "element.setAttribute(item[0], str(datainfo.%s))" % (item[1])
             new_node.appendChild(element)
-            
+
         for item in list_of_data2d_values:
             root_node = doc.createElement(item[0])
@@ -1059,5 +1055,5 @@
             exec "temp_list = datainfo.%s" % item[1]
 
-            if temp_list is None or len(temp_list)== 0:
+            if temp_list is None or len(temp_list) == 0:
                 element = doc.createElement(item[0])
                 exec "element.appendChild(doc.createTextNode(str(%s)))" % temp_list
@@ -1068,5 +1064,5 @@
                     exec "element.setAttribute(item[0], str(%s))" % value
                     root_node.appendChild(element)
-       
+
         # Sample info
         sample = doc.createElement("SASsample")
@@ -1080,8 +1076,8 @@
         write_node(doc, sample, "temperature", datainfo.sample.temperature,
                    {"unit": datainfo.sample.temperature_unit})
-        
+
         for item in datainfo.sample.details:
             write_node(doc, sample, "details", item)
-        
+
         pos = doc.createElement("position")
         written = write_node(doc, pos, "x", datainfo.sample.position.x,
@@ -1095,5 +1091,5 @@
         if written == True:
             sample.appendChild(pos)
-        
+
         ori = doc.createElement("orientation")
         written = write_node(doc, ori, "roll", datainfo.sample.orientation.x,
@@ -1107,11 +1103,11 @@
         if written == True:
             sample.appendChild(ori)
-        
+
         # Instrument info
         instr = doc.createElement("SASinstrument")
         entry_node.appendChild(instr)
-        
+
         write_node(doc, instr, "name", datainfo.instrument)
-        
+
         #   Source
         source = doc.createElement("SASsource")
@@ -1119,5 +1115,5 @@
             source.setAttribute("name", str(datainfo.source.name))
         instr.appendChild(source)
-        
+
         write_node(doc, source, "radiation", datainfo.source.radiation)
         write_node(doc, source, "beam_shape", datainfo.source.beam_shape)
@@ -1135,5 +1131,5 @@
         if written == True:
             source.appendChild(size)
-            
+
         write_node(doc, source, "wavelength", datainfo.source.wavelength,
                    {"unit": datainfo.source.wavelength_unit})
@@ -1147,5 +1143,5 @@
                    datainfo.source.wavelength_spread,
                    {"unit": datainfo.source.wavelength_spread_unit})
-        
+
         #   Collimation
         for item in datainfo.collimation:
@@ -1154,8 +1150,8 @@
                 coll.setAttribute("name", str(item.name))
             instr.appendChild(coll)
-            
+
             write_node(doc, coll, "length", item.length,
                        {"unit": item.length_unit})
-            
+
             for apert in item.aperture:
                 ap = doc.createElement("aperture")
@@ -1165,8 +1161,8 @@
                     ap.setAttribute("type", str(apert.type))
                 coll.appendChild(ap)
-                
+
                 write_node(doc, ap, "distance", apert.distance,
                            {"unit": apert.distance_unit})
-                
+
                 size = doc.createElement("size")
                 if apert.size_name is not None:
@@ -1192,5 +1188,5 @@
             if written == True:
                 instr.appendChild(det)
-            
+
             off = doc.createElement("offset")
             written = write_node(doc, off, "x", item.offset.x,
@@ -1202,5 +1198,5 @@
             if written == True:
                 det.appendChild(off)
-            
+
             center = doc.createElement("beam_center")
             written = write_node(doc, center, "x", item.beam_center.x,
@@ -1214,5 +1210,5 @@
             if written == True:
                 det.appendChild(center)
-                
+
             pix = doc.createElement("pixel_size")
             written = write_node(doc, pix, "x", item.pixel_size.x,
@@ -1224,5 +1220,5 @@
             if written == True:
                 det.appendChild(pix)
-                
+
             ori = doc.createElement("orientation")
             written = write_node(doc, ori, "roll", item.orientation.x,
@@ -1235,5 +1231,5 @@
             if written == True:
                 det.appendChild(ori)
-                
+
         # Processes info
         for item in datainfo.process:
@@ -1253,15 +1249,15 @@
         # the data we just wrote
         return doc, entry_node
-   
+
     def _parse_state(self, entry):
         """
         Read a fit result from an XML node
-        
+
         :param entry: XML node to read from
-        
+
         :return: PageState object
         """
         # Create an empty state
-        state = None   
+        state = None
         # Locate the P(r) node
         try:
@@ -1272,18 +1268,18 @@
                 state = PageState()
                 state.fromXML(node=nodes[0])
-                
+
         except:
             logging.info("XML document does not contain fitting information.\n %s" % sys.exc_value)
-            
+
         return state
-      
+
     def _parse_save_state_entry(self, dom):
         """
         Parse a SASentry
-        
+
         :param node: SASentry node
-        
+
         :return: Data1D/Data2D object
-        
+
         """
         node = dom.xpath('ns:data_class', namespaces={'ns': CANSAS_NS})
@@ -1305,13 +1301,13 @@
                 numpy.trim_zeros(return_value.dxl)
                 numpy.trim_zeros(return_value.dxw)
-                            
+
             return return_value, _
-        
+
         #Parse 2D
         data_info = Data2D()
-        
+
         # Look up title
         self._store_content('ns:Title', dom, 'title', data_info)
-        
+
         # Look up run number
         nodes = dom.xpath('ns:Run', namespaces={'ns': CANSAS_NS})
@@ -1323,5 +1319,5 @@
                     if item.get('name') is not None:
                         data_info.run_name[value] = item.get('name')
-                           
+
         # Look up instrument name
         self._store_content('ns:SASinstrument/ns:name', dom,
@@ -1340,10 +1336,10 @@
                 self.errors.append(err_mess)
                 logging.error(err_mess)
-        
+
         # Sample info ###################
         entry = get_content('ns:SASsample', dom)
         if entry is not None:
             data_info.sample.name = entry.get('name')
-            
+
         self._store_content('ns:SASsample/ns:ID',
                      dom, 'ID', data_info.sample)
@@ -1354,5 +1350,5 @@
         self._store_float('ns:SASsample/ns:temperature',
                      dom, 'temperature', data_info.sample)
-        
+
         nodes = dom.xpath('ns:SASsample/ns:details',
                           namespaces={'ns': CANSAS_NS})
@@ -1367,5 +1363,5 @@
                 self.errors.append(err_mess)
                 logging.error(err_mess)
-        
+
         # Position (as a vector)
         self._store_float('ns:SASsample/ns:position/ns:x',
@@ -1375,5 +1371,5 @@
         self._store_float('ns:SASsample/ns:position/ns:z',
                      dom, 'position.z', data_info.sample)
-        
+
         # Orientation (as a vector)
         self._store_float('ns:SASsample/ns:orientation/ns:roll',
@@ -1383,10 +1379,10 @@
         self._store_float('ns:SASsample/ns:orientation/ns:yaw',
                      dom, 'orientation.z', data_info.sample)
-       
+
         # Source info ###################
         entry = get_content('ns:SASinstrument/ns:SASsource', dom)
         if entry is not None:
             data_info.source.name = entry.get('name')
-        
+
         self._store_content('ns:SASinstrument/ns:SASsource/ns:radiation',
                      dom, 'radiation', data_info.source)
@@ -1401,10 +1397,10 @@
         self._store_float('ns:SASinstrument/ns:SASsource/ns:wavelength_spread',
                      dom, 'wavelength_spread', data_info.source)
-        
+
         # Beam size (as a vector)
         entry = get_content('ns:SASinstrument/ns:SASsource/ns:beam_size', dom)
         if entry is not None:
             data_info.source.beam_size_name = entry.get('name')
-            
+
         self._store_float('ns:SASinstrument/ns:SASsource/ns:beam_size/ns:x',
                      dom, 'beam_size.x', data_info.source)
@@ -1413,5 +1409,5 @@
         self._store_float('ns:SASinstrument/ns:SASsource/ns:beam_size/ns:z',
                      dom, 'beam_size.z', data_info.source)
-        
+
         # Collimation info ###################
         nodes = dom.xpath('ns:SASinstrument/ns:SAScollimation',
@@ -1422,5 +1418,5 @@
                 collim.name = item.get('name')
             self._store_float('ns:length', item, 'length', collim)
-            
+
             # Look for apertures
             apert_list = item.xpath('ns:aperture',
@@ -1428,38 +1424,38 @@
             for apert in apert_list:
                 aperture = Aperture()
-                
+
                 # Get the name and type of the aperture
                 aperture.name = apert.get('name')
                 aperture.type = apert.get('type')
-                    
+
                 self._store_float('ns:distance', apert, 'distance', aperture)
-                
+
                 entry = get_content('ns:size', apert)
                 if entry is not None:
                     aperture.size_name = entry.get('name')
-                
+
                 self._store_float('ns:size/ns:x', apert, 'size.x', aperture)
                 self._store_float('ns:size/ns:y', apert, 'size.y', aperture)
                 self._store_float('ns:size/ns:z', apert, 'size.z', aperture)
-                
+
                 collim.aperture.append(aperture)
-                
+
             data_info.collimation.append(collim)
-        
+
         # Detector info ######################
         nodes = dom.xpath('ns:SASinstrument/ns:SASdetector',
                           namespaces={'ns': CANSAS_NS})
         for item in nodes:
-            
+
             detector = Detector()
-            
+
             self._store_content('ns:name', item, 'name', detector)
             self._store_float('ns:SDD', item, 'distance', detector)
-            
+
             # Detector offset (as a vector)
             self._store_float('ns:offset/ns:x', item, 'offset.x', detector)
             self._store_float('ns:offset/ns:y', item, 'offset.y', detector)
             self._store_float('ns:offset/ns:z', item, 'offset.z', detector)
-            
+
             # Detector orientation (as a vector)
             self._store_float('ns:orientation/ns:roll', item,
@@ -1469,5 +1465,5 @@
             self._store_float('ns:orientation/ns:yaw', item,
                               'orientation.z', detector)
-            
+
             # Beam center (as a vector)
             self._store_float('ns:beam_center/ns:x', item,
@@ -1477,5 +1473,5 @@
             self._store_float('ns:beam_center/ns:z', item,
                               'beam_center.z', detector)
-            
+
             # Pixel size (as a vector)
             self._store_float('ns:pixel_size/ns:x', item,
@@ -1485,7 +1481,7 @@
             self._store_float('ns:pixel_size/ns:z', item,
                               'pixel_size.z', detector)
-            
+
             self._store_float('ns:slit_length', item, 'slit_length', detector)
-            
+
             data_info.detector.append(detector)
 
@@ -1497,5 +1493,5 @@
             self._store_content('ns:date', item, 'date', process)
             self._store_content('ns:description', item, 'description', process)
-            
+
             term_list = item.xpath('ns:term', namespaces={'ns': CANSAS_NS})
             for term in term_list:
@@ -1511,5 +1507,5 @@
                     self.errors.append(err_mess)
                     logging.error(err_mess)
-            
+
             note_list = item.xpath('ns:SASprocessnote',
                                    namespaces={'ns': CANSAS_NS})
@@ -1517,12 +1513,12 @@
                 if note.text is not None:
                     process.notes.append(note.text.strip())
-            
+
             data_info.process.append(process)
-            
+
         # Data info ######################
         nodes = dom.xpath('ns:SASdata', namespaces={'ns': CANSAS_NS})
         if len(nodes) > 1:
             raise RuntimeError, "CanSAS reader is not compatible with multiple SASdata entries"
-       
+
         for entry in nodes:
             for item in list_of_data_2d_attr:
@@ -1530,5 +1526,5 @@
                 node = get_content('ns:%s' % item[0], entry)
                 exec "data_info.%s = parse_entry_helper(node, item)" % item[1]
-                    
+
             for item in list_of_data2d_values:
                 field = get_content('ns:%s' % item[0], entry)
@@ -1540,5 +1536,5 @@
                 else:
                     exec "data_info.%s = numpy.array(list)" % item[0]
-        
+
         return data_info
 
@@ -1546,14 +1542,14 @@
         """
         Load data and P(r) information from a CanSAS XML file.
-        
+
         :param path: file path
-        
+
         :return: Data1D object if a single SASentry was found,
                     or a list of Data1D objects if multiple entries were found,
                     or None of nothing was found
-                    
+
         :raise RuntimeError: when the file can't be opened
         :raise ValueError: when the length of the data vectors are inconsistent
-        
+
         """
         output = []
@@ -1563,10 +1559,10 @@
         try:
             if os.path.isfile(path):
-                
+
                 #TODO: eventually remove the check for .xml once
                 # the P(r) writer/reader is truly complete.
                 if  ext in self.ext or \
                     ext == '.xml':
-                    
+
                     tree = etree.parse(path, parser=etree.ETCompatXMLParser())
                     # Check the format version number
@@ -1581,5 +1577,5 @@
                             raise
                         fitstate = self._parse_state(entry)
-                        
+
                         #state could be None when .svs file is loaded
                         #in this case, skip appending to output
@@ -1608,8 +1604,8 @@
                     original_fname = state.file[0:max_char]
                     state.file = original_fname + ' [' + time_str + ']'
-                     
+
                     if state is not None and state.is_data is not None:
                         exec 'output[%d].is_data = state.is_data' % ind
-                     
+
                     output[ind].filename = state.file
                     state.data = output[ind]
@@ -1629,18 +1625,18 @@
                     self.state = state
                 return output
-              
+
         except:
             self.call_back(format=ext)
             #self.state= state
             raise
-           
+
     def write(self, filename, datainfo=None, fitstate=None):
         """
         Write the content of a Data1D as a CanSAS XML file only for standalone
-        
+
         :param filename: name of the file to write
         :param datainfo: Data1D object
         :param fitstate: PageState object
-        
+
         """
         # Sanity check
@@ -1651,15 +1647,15 @@
         else:
             doc = fitstate.toXML(file=filename)
-        
+
         # Save the document no matter the type
         fd = open(filename, 'w')
         fd.write(doc.toprettyxml())
         fd.close()
-        
+
     def write_toXML(self, datainfo=None, state=None):
         """
         Write toXML, a helper for write(),
         could be used by guimanager._on_save()
-        
+
         : return: xml doc
         """
@@ -1677,5 +1673,5 @@
                 state.data.run = [str(state.data.name)]
                 state.data.run_name[0] = state.data.name
-            
+
             if issubclass(state.data.__class__,
                           sas.dataloader.data_info.Data1D):
@@ -1685,10 +1681,10 @@
                 data = state.data
                 doc, sasentry = self._data2d_to_xml_doc(data)
-            
+
         if state is not None:
             doc = state.toXML(doc=doc, file=data.filename, entry_node=sasentry)
-        
+
         return doc
-    
+
 # Simple html report templet
 HEADER = "<html>\n"
@@ -1736,5 +1732,5 @@
     #state.toXML()
     """
-    
+
     file = open("test_state", "w")
     pickle.dump(state, file)
@@ -1769,4 +1765,4 @@
     db.keys().sort()
     print pickle.loads(db['state2'])
-  
+
     db.close()
Index: src/sas/perspectives/fitting/report_dialog.py
===================================================================
--- src/sas/perspectives/fitting/report_dialog.py	(revision e8bb5b62d717c7b44481a4b621030699e4efdaf4)
+++ src/sas/perspectives/fitting/report_dialog.py	(revision 2f4b43041eaa7b7f496750f223a299cb33cd268e)
@@ -1,4 +1,4 @@
 """
-Dialog report panel to show and summarize the results of 
+Dialog report panel to show and summarize the results of
 the fitting calculation.
 """
@@ -23,9 +23,9 @@
     The report dialog box.
     """
-    
+
     def __init__(self, report_list, *args, **kwds):
         """
         Initialization. The parameters added to Dialog are:
-        
+
         :param report_list: list of html_str, text_str, image
         from invariant_state
@@ -38,5 +38,5 @@
         # number of images of plot
         self.nimages = len(self.report_list[2])
-        
+
         if self.report_list[2] != None:
             # put image path in the report string
@@ -58,5 +58,5 @@
         # layout
         self._setup_layout()
-        
+
     def onSave(self, event=None):
         """
@@ -66,5 +66,5 @@
         dlg = wx.FileDialog(self, "Choose a file",
                             wildcard=self.wild_card,
-                            style=wx.SAVE|wx.OVERWRITE_PROMPT|wx.CHANGE_DIR)
+                            style=wx.SAVE | wx.OVERWRITE_PROMPT | wx.CHANGE_DIR)
         dlg.SetFilterIndex(0)  # Set .html files to be default
 
@@ -72,5 +72,5 @@
             dlg.Destroy()
             return
-        
+
         fName = dlg.GetPath()
         ext_num = dlg.GetFilterIndex()
@@ -83,5 +83,5 @@
             # TODO: Sort this case out
             ext = '.pdf'
-            
+
             fName = os.path.splitext(fName)[0] + ext
             dlg.Destroy()
@@ -112,5 +112,5 @@
             # write pdf as a pdf file
             pdf = self.HTML2PDF(data=html, filename=fName)
-            
+
             #open pdf
             if pdf:
@@ -121,5 +121,5 @@
                     try:
                         #Mac
-                        os.system("open %s"% fName)
+                        os.system("open %s" % fName)
                     except:
                         #DO not open
@@ -145,9 +145,9 @@
         else:
             return
-        
+
         #file name
         fName = os.path.splitext(fName)[0] + ext
         dlg.Destroy()
-        
+
         #pic (png) file path/name
         for num in range(self.nimages):
@@ -172,3 +172,2 @@
         for num in range(self.nimages):
             self.report_list[2][num].savefig(pic_fname[num])
-        
Index: src/sas/perspectives/fitting/resultpanel.py
===================================================================
--- src/sas/perspectives/fitting/resultpanel.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ src/sas/perspectives/fitting/resultpanel.py	(revision 2f4b43041eaa7b7f496750f223a299cb33cd268e)
@@ -4,5 +4,5 @@
 :note: For Fit to be performed the user should check at least one parameter
     on fit Panel window.
-   
+
 """
 import wx
@@ -19,8 +19,8 @@
     """
     FitPanel class contains fields allowing to fit  models and  data
-    
+
     :note: For Fit to be performed the user should check at least one parameter
         on fit Panel window.
-       
+
     """
     ## Internal name for the AUI manager
@@ -29,13 +29,13 @@
     window_caption = "Result Panel"
     CENTER_PANE = True
-    
+
     def __init__(self, parent, manager=None, *args, **kwargs):
         """
         """
         style = ((wx.aui.AUI_NB_WINDOWLIST_BUTTON
-                 |wx.aui.AUI_NB_DEFAULT_STYLE
-                 |wx.CLIP_CHILDREN)
+                 | wx.aui.AUI_NB_DEFAULT_STYLE
+                 | wx.CLIP_CHILDREN)
                  & ~wx.aui.AUI_NB_CLOSE_ON_ACTIVE_TAB)
-        Notebook.__init__(self, parent, -1, style = style)
+        Notebook.__init__(self, parent, -1, style=style)
         PanelBase.__init__(self, parent)
         self.frame = parent
@@ -56,13 +56,13 @@
         if hasattr(result, 'convergence'):
             from bumps.gui.convergence_view import ConvergenceView
-            best, pop = result.convergence[:,0], result.convergence[:,1:]
+            best, pop = result.convergence[:, 0], result.convergence[:, 1:]
             self.get_panel(ConvergenceView).update(best, pop)
         if hasattr(result, 'uncertainty_state'):
             from bumps.gui.uncertainty_view import UncertaintyView, CorrelationView, TraceView
-            from bumps.dream.stats import var_stats,format_vars
+            from bumps.dream.stats import var_stats, format_vars
             stats = var_stats(result.uncertainty_state.draw())
             msg = format_vars(stats)
             self.get_panel(CorrelationView).update(result.uncertainty_state)
-            self.get_panel(UncertaintyView).update((result.uncertainty_state,stats))
+            self.get_panel(UncertaintyView).update((result.uncertainty_state, stats))
             self.get_panel(TraceView).update(result.uncertainty_state)
             # TODO: stats should be stored in result rather than computed in bumps UncertaintyView
Index: src/sas/perspectives/fitting/simfitpage.py
===================================================================
--- src/sas/perspectives/fitting/simfitpage.py	(revision 386ffe12ba023b3eab0fbbb16a6f958ed7c099a3)
+++ src/sas/perspectives/fitting/simfitpage.py	(revision 2f4b43041eaa7b7f496750f223a299cb33cd268e)
@@ -2,7 +2,7 @@
     Simultaneous fit page
 """
-import sys,re,string, wx
+import sys, re, string, wx
 import wx.lib.newevent
-from sas.guiframe.events import StatusEvent 
+from sas.guiframe.events import StatusEvent
 from sas.guiframe.panel_base import PanelBase
 from wx.lib.scrolledpanel import ScrolledPanel
@@ -15,12 +15,12 @@
     PANEL_WID = 490
     FONT_VARIANT = 1
-       
-            
+
+
 def get_fittableParam(model):
     """
     return list of fittable parameters name of a model
-    
+
     :param model: the model used
-    
+
     """
     fittable_param = []
@@ -29,8 +29,8 @@
             if not item in model.non_fittable:
                 fittable_param.append(item)
-            
+
     for item in model.fixed:
         fittable_param.append(item)
-        
+
     return fittable_param
 
@@ -46,6 +46,6 @@
     ## Title to appear on top of the window
     window_caption = "Simultaneous Fit Page"
-    
-    def __init__(self, parent, page_finder={}, id=-1, batch_on=False,
+
+    def __init__(self, parent, page_finder={}, id= -1, batch_on=False,
                      *args, **kwargs):
         ScrolledPanel.__init__(self, parent, id=id,
@@ -84,5 +84,5 @@
         self.set_layout()
         self._set_save_flag(False)
-        
+
     def define_page_structure(self):
         """
@@ -100,10 +100,10 @@
         self.vbox.Add(self.sizer2)
         self.vbox.Add(self.sizer3)
-        
+
     def set_scroll(self):
         """
         """
         self.Layout()
-         
+
     def set_layout(self):
         """
@@ -115,5 +115,5 @@
         self.set_scroll()
         self.Centre()
-        
+
     def onRemove(self, event):
         """
@@ -140,9 +140,9 @@
 
         #self._onAdd_constraint(None)
-             
+
     def onFit(self, event):
         """
         signal for fitting
-        
+
         """
         flag = False
@@ -161,5 +161,5 @@
             for item in self.model_list:
                 if item[0].GetValue():
-                    self.manager.schedule_for_fit(value=1, uid=item[2]) 
+                    self.manager.schedule_for_fit(value=1, uid=item[2])
             try:
                 if not self.manager.onFit(uid=self.uid):
@@ -171,14 +171,14 @@
             msg = "Select at least one model check box to fit "
             wx.PostEvent(self.parent.parent, StatusEvent(status=msg))
-           
+
     def set_manager(self, manager):
         """
         set panel manager
-        
+
         :param manager: instance of plugin fitting
-        
+
         """
         self.manager = manager
-       
+
     def check_all_model_name(self, event=None):
         """
@@ -191,5 +191,5 @@
                     item[0].SetValue(True)
                     self.model_toFit.append(item)
-                
+
             ## constraint info
             self._store_model()
@@ -198,19 +198,19 @@
                 if self.show_constraint.GetValue() and\
                                  len(self.constraints_list) == 0:
-                    self._show_all_constraint() 
+                    self._show_all_constraint()
                     self._show_constraint()
         else:
             for item in self.model_list:
-                item[0].SetValue(False) 
-                
+                item[0].SetValue(False)
+
             self.model_toFit = []
             if not self.batch_on:
                 ##constraint info
                 self._hide_constraint()
-            
+
         self._update_easy_setup_cb()
         self.Layout()
         self.Refresh()
-        
+
     def check_model_name(self, event):
         """
@@ -226,5 +226,5 @@
                     self.model_toFit.remove(item)
                     self.cb1.SetValue(False)
-        
+
         ## display constraint fields
         if len(self.model_toFit) >= 1:
@@ -238,5 +238,5 @@
             ##constraint info
             self._hide_constraint()
-                        
+
         self._update_easy_setup_cb()
         ## set the value of the main check button
@@ -248,5 +248,5 @@
             self.cb1.SetValue(False)
             self.Layout()
-            
+
     def _update_easy_setup_cb(self):
         """
@@ -276,8 +276,8 @@
             self.sizer2.Layout()
             self.sizer3.Layout()
-        
+
     def draw_page(self):
         """
-        Draw a sizer containing couples of data and model 
+        Draw a sizer containing couples of data and model
         """
         self.model_list = []
@@ -288,10 +288,10 @@
         self.model_cbox_left = None
         self.model_cbox_right = None
-        
+
         if len(self.model_list) > 0:
             for item in self.model_list:
                 item[0].SetValue(False)
                 self.manager.schedule_for_fit(value=0, uid=item[2])
-                
+
         self.sizer1.Clear(True)
         box_description = wx.StaticBox(self, -1, "Fit Combinations")
@@ -308,15 +308,15 @@
             ## store model
             self._store_model()
-        
+
             self.cb1 = wx.CheckBox(self, -1, 'Select all')
             self.cb1.SetValue(False)
-            
+
             wx.EVT_CHECKBOX(self, self.cb1.GetId(), self.check_all_model_name)
-            
+
             sizer_title.Add((10, 10), 0,
-                wx.TOP|wx.BOTTOM|wx.EXPAND|wx.ADJUST_MINSIZE, border=5)
+                wx.TOP | wx.BOTTOM | wx.EXPAND | wx.ADJUST_MINSIZE, border=5)
             sizer_title.Add(self.cb1, 0,
-                wx.TOP|wx.BOTTOM|wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, border=5)
-            
+                wx.TOP | wx.BOTTOM | wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, border=5)
+
             ## draw list of model and data name
             self._fill_sizer_model_list(sizer_couples)
@@ -327,7 +327,7 @@
             self._fill_sizer_fit()
         #--------------------------------------------------------
-        boxsizer1.Add(sizer_title, flag = wx.TOP|wx.BOTTOM, border=5) 
-        boxsizer1.Add(sizer_couples, 1, flag = wx.TOP|wx.BOTTOM, border=5)
-       
+        boxsizer1.Add(sizer_title, flag=wx.TOP | wx.BOTTOM, border=5)
+        boxsizer1.Add(sizer_couples, 1, flag=wx.TOP | wx.BOTTOM, border=5)
+
         self.sizer1.Add(boxsizer1, 1, wx.EXPAND | wx.ALL, 10)
         self.sizer1.Layout()
@@ -335,5 +335,5 @@
         self.AdjustScrollbars()
         self.Layout()
-        
+
     def _store_model(self):
         """
@@ -346,5 +346,5 @@
             page_id = item[2]
             self.constraint_dict[page_id] = model
-                   
+
     def _display_constraint(self, event):
         """
@@ -366,11 +366,11 @@
             self.Layout()
             return
-       
+
     def _show_all_constraint(self):
         """
         Show constraint fields
         """
-        box_description = wx.StaticBox(self, -1,"Easy Setup ")
-        boxsizer = wx.StaticBoxSizer(box_description, wx.HORIZONTAL)     
+        box_description = wx.StaticBox(self, -1, "Easy Setup ")
+        boxsizer = wx.StaticBoxSizer(box_description, wx.HORIZONTAL)
         sizer_constraint = wx.BoxSizer(wx.HORIZONTAL)
         self.model_cbox_left = wx.ComboBox(self, -1, style=wx.CB_READONLY)
@@ -388,5 +388,5 @@
         self.set_button.SetToolTipString(set_tip)
         self.set_button.Disable()
-        
+
         for id, model in self.constraint_dict.iteritems():
             ## check if all parameters have been selected for constraint
@@ -399,23 +399,23 @@
             self.model_cbox_right.Append(str(model.name), model)
         boxsizer.Add(self.model_cbox_left,
-                             flag=wx.RIGHT|wx.EXPAND, border=10)
+                             flag=wx.RIGHT | wx.EXPAND, border=10)
         boxsizer.Add(wx.StaticText(self, -1, ".parameters"),
-                             flag=wx.RIGHT|wx.EXPAND, border=5)
-        boxsizer.Add(egal_txt, flag= wx.RIGHT|wx.EXPAND, border=5)
+                             flag=wx.RIGHT | wx.EXPAND, border=5)
+        boxsizer.Add(egal_txt, flag=wx.RIGHT | wx.EXPAND, border=5)
         boxsizer.Add(self.model_cbox_right,
-                             flag=wx.RIGHT|wx.EXPAND, border=10)
+                             flag=wx.RIGHT | wx.EXPAND, border=10)
         boxsizer.Add(wx.StaticText(self, -1, ".parameters"),
-                             flag=wx.RIGHT|wx.EXPAND,border=5)
+                             flag=wx.RIGHT | wx.EXPAND, border=5)
         boxsizer.Add((20, -1))
-        boxsizer.Add(self.set_button, flag=wx.RIGHT|wx.EXPAND, border=5)
-        sizer_constraint.Add(boxsizer, flag=wx.RIGHT|wx.EXPAND, border=5)
+        boxsizer.Add(self.set_button, flag=wx.RIGHT | wx.EXPAND, border=5)
+        sizer_constraint.Add(boxsizer, flag=wx.RIGHT | wx.EXPAND, border=5)
         self.sizer_all_constraints.Insert(before=0,
                              item=sizer_constraint,
-                             flag=wx.TOP|wx.BOTTOM|wx.EXPAND, border=5)
+                             flag=wx.TOP | wx.BOTTOM | wx.EXPAND, border=5)
 
         self.sizer_all_constraints.Layout()
         self.sizer2.Layout()
         #self.SetScrollbars(20,20,25,65)
-    
+
     def _on_select_modelcb(self, event):
         """
@@ -428,9 +428,9 @@
         if self.model_cbox_right.GetValue().strip() == '':
             flag = False
-        if self.model_cbox_left.GetValue() ==\
+        if self.model_cbox_left.GetValue() == \
                 self.model_cbox_right.GetValue():
             flag = False
         self.set_button.Enable(flag)
-        
+
     def _on_set_all_equal(self, event):
         """
@@ -471,5 +471,5 @@
                     break
                 self._show_constraint()
-        
+
         self.sizer_constraints.Layout()
         self.sizer2.Layout()
@@ -509,19 +509,19 @@
             self.sizer2.Layout()
             return
-            
+
         sizer_constraint = wx.BoxSizer(wx.HORIZONTAL)
         model_cbox = wx.ComboBox(self, -1, style=wx.CB_READONLY)
         model_cbox.Clear()
-        param_cbox = wx.ComboBox(self, -1,style=wx.CB_READONLY, size=(100, -1), )
+        param_cbox = wx.ComboBox(self, -1, style=wx.CB_READONLY, size=(100, -1),)
         param_cbox.Hide()
-        
+
         #This is for GetCLientData() _on_select_param: Was None return on MAC.
         self.param_cbox = param_cbox
-        
-        wx.EVT_COMBOBOX(param_cbox,-1, self._on_select_param)
+
+        wx.EVT_COMBOBOX(param_cbox, -1, self._on_select_param)
         self.ctl2 = wx.TextCtrl(self, -1)
         egal_txt = wx.StaticText(self, -1, " = ")
-        self.btRemove = wx.Button(self,wx.NewId(),'Remove')
-        self.btRemove.Bind(wx.EVT_BUTTON, self.onRemove, 
+        self.btRemove = wx.Button(self, wx.NewId(), 'Remove')
+        self.btRemove.Bind(wx.EVT_BUTTON, self.onRemove,
                            id=self.btRemove.GetId())
         self.btRemove.SetToolTipString("Remove constraint.")
@@ -533,26 +533,26 @@
             ## then do not allow add constraint on parameters
             model_cbox.Append(str(model.name), model)
-            
+
         #This is for GetCLientData() passing to self._on_select_param: Was None return on MAC.
         self.model_cbox = model_cbox
-           
+
         wx.EVT_COMBOBOX(model_cbox, -1, self._on_select_model)
         sizer_constraint.Add((5, -1))
-        sizer_constraint.Add(model_cbox, flag=wx.RIGHT|wx.EXPAND, border=10)
-        sizer_constraint.Add(param_cbox, flag=wx.RIGHT|wx.EXPAND, border=5)
-        sizer_constraint.Add(egal_txt, flag=wx.RIGHT|wx.EXPAND, border=5)
-        sizer_constraint.Add(self.ctl2, flag=wx.RIGHT|wx.EXPAND, border=10)
-        sizer_constraint.Add(self.btRemove, flag=wx.RIGHT|wx.EXPAND, border=10)
-      
+        sizer_constraint.Add(model_cbox, flag=wx.RIGHT | wx.EXPAND, border=10)
+        sizer_constraint.Add(param_cbox, flag=wx.RIGHT | wx.EXPAND, border=5)
+        sizer_constraint.Add(egal_txt, flag=wx.RIGHT | wx.EXPAND, border=5)
+        sizer_constraint.Add(self.ctl2, flag=wx.RIGHT | wx.EXPAND, border=10)
+        sizer_constraint.Add(self.btRemove, flag=wx.RIGHT | wx.EXPAND, border=10)
+
         self.sizer_constraints.Insert(before=self.nb_constraint,
-                        item=sizer_constraint, flag=wx.TOP|wx.BOTTOM|wx.EXPAND,
+                        item=sizer_constraint, flag=wx.TOP | wx.BOTTOM | wx.EXPAND,
                         border=5)
         self.constraints_list.append([model_cbox, param_cbox, egal_txt,
                                     self.ctl2, self.btRemove, sizer_constraint])
-    
+
         self.nb_constraint += 1
         self.sizer_constraints.Layout()
         self.sizer2.Layout()
-        
+
     def _hide_constraint(self):
         """
@@ -561,5 +561,5 @@
         for id in  self.page_finder.iterkeys():
             self.page_finder[id].clear_model_param()
-               
+
         self.nb_constraint = 0
         self.constraint_dict = {}
@@ -585,5 +585,5 @@
         self.sizer_constraints.Layout()
         self.sizer2.Layout()
-            
+
     def _on_select_model(self, event):
         """
@@ -611,5 +611,5 @@
         self.btAdd.Show(True)
         self.sizer2.Layout()
-        
+
     def _on_select_param(self, event):
         """
@@ -620,5 +620,5 @@
         #model = self.param_cbox.GetClientData(n)
         #param = event.GetString()
-      
+
         length = len(self.constraints_list)
         if length < 1:
@@ -626,8 +626,8 @@
         egal_txt = self.constraints_list[length - 1][2]
         egal_txt.Show(True)
-        
+
         ctl2 = self.constraints_list[length - 1][3]
         ctl2.Show(True)
-        
+
     def _onAdd_constraint(self, event):
         """
@@ -645,10 +645,10 @@
                 msg = " Select a model Name! "
                 wx.PostEvent(self.parent.parent, StatusEvent(status=msg))
-                return 
+                return
             param_cbox = item[1]
             if param_cbox.GetString(0) == "":
                 msg = " Select a parameter Name! "
                 wx.PostEvent(self.parent.parent, StatusEvent(status=msg))
-                return 
+                return
             ctl2 = item[3]
             if ctl2.GetValue().lstrip().rstrip() == "":
@@ -656,5 +656,5 @@
                                             param_cbox.GetCurrentSelection())
                 if model != None:
-                    msg = " Enter a constraint for %s.%s! "%(model.name, 
+                    msg = " Enter a constraint for %s.%s! " % (model.name,
                                                         param_cbox.GetString(0))
                 else:
@@ -667,5 +667,5 @@
         self.Layout()
         self.Refresh()
-        
+
     def _fill_sizer_fit(self):
         """
@@ -673,8 +673,8 @@
         """
         self.sizer3.Clear(True)
-        box_description= wx.StaticBox(self, -1, "Fit ")
+        box_description = wx.StaticBox(self, -1, "Fit ")
         boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL)
         sizer_button = wx.BoxSizer(wx.HORIZONTAL)
-          
+
         self.btFit = wx.Button(self, wx.NewId(), 'Fit', size=wx.DefaultSize)
         self.btFit.Bind(wx.EVT_BUTTON, self.onFit, id=self.btFit.GetId())
@@ -686,12 +686,12 @@
             text = " and a model for fitting."
         text_hint = wx.StaticText(self, -1, text)
-        
-        sizer_button.Add(text_hint, wx.RIGHT|wx.EXPAND, 10)
-        sizer_button.Add(self.btFit, 0, wx.LEFT|wx.ADJUST_MINSIZE, 10)
-        
-        boxsizer1.Add(sizer_button, flag= wx.TOP|wx.BOTTOM,border=10)
+
+        sizer_button.Add(text_hint, wx.RIGHT | wx.EXPAND, 10)
+        sizer_button.Add(self.btFit, 0, wx.LEFT | wx.ADJUST_MINSIZE, 10)
+
+        boxsizer1.Add(sizer_button, flag=wx.TOP | wx.BOTTOM, border=10)
         self.sizer3.Add(boxsizer1, 0, wx.EXPAND | wx.ALL, 10)
         self.sizer3.Layout()
-        
+
     def _fill_sizer_constraint(self):
         """
@@ -700,5 +700,5 @@
         msg = "Select at least 2 model to add constraint "
         wx.PostEvent(self.parent.parent, StatusEvent(status=msg))
-        
+
         self.sizer2.Clear(True)
         if self.batch_on:
@@ -706,5 +706,5 @@
                 self.sizer2.Show(False)
             return
-        box_description= wx.StaticBox(self, -1, "Fit Constraints")
+        box_description = wx.StaticBox(self, -1, "Fit Constraints")
         boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL)
         sizer_title = wx.BoxSizer(wx.HORIZONTAL)
@@ -712,5 +712,5 @@
         self.sizer_constraints = wx.BoxSizer(wx.VERTICAL)
         sizer_button = wx.BoxSizer(wx.HORIZONTAL)
-        
+
         self.hide_constraint = wx.RadioButton(self, -1, 'No', (10, 10),
                                               style=wx.RB_GROUP)
@@ -725,15 +725,15 @@
         self.hide_constraint.SetValue(True)
         self.show_constraint.SetValue(False)
-        
+
         sizer_title.Add(wx.StaticText(self, -1, " Model"))
         sizer_title.Add((10, 10))
         sizer_title.Add(wx.StaticText(self, -1, " Parameter"))
         sizer_title.Add((10, 10))
-        sizer_title.Add( wx.StaticText(self,-1," Add Constraint?") )
+        sizer_title.Add(wx.StaticText(self, -1, " Add Constraint?"))
         sizer_title.Add((10, 10))
         sizer_title.Add(self.show_constraint)
         sizer_title.Add(self.hide_constraint)
         sizer_title.Add((10, 10))
-        
+
         self.btAdd = wx.Button(self, wx.NewId(), 'Add')
         self.btAdd.Bind(wx.EVT_BUTTON, self._onAdd_constraint,
@@ -741,22 +741,22 @@
         self.btAdd.SetToolTipString("Add another constraint?")
         self.btAdd.Hide()
-     
+
         text_hint = wx.StaticText(self, -1,
                                   "Example: [M0][paramter] = M1.parameter")
-        sizer_button.Add(text_hint, 0 , wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 10)
-        sizer_button.Add(self.btAdd, 0, wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 10)
-       
-        boxsizer1.Add(sizer_title, flag=wx.TOP|wx.BOTTOM,border=10)
-        boxsizer1.Add(self.sizer_all_constraints, flag=wx.TOP|wx.BOTTOM,
+        sizer_button.Add(text_hint, 0 , wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 10)
+        sizer_button.Add(self.btAdd, 0, wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 10)
+
+        boxsizer1.Add(sizer_title, flag=wx.TOP | wx.BOTTOM, border=10)
+        boxsizer1.Add(self.sizer_all_constraints, flag=wx.TOP | wx.BOTTOM,
                       border=10)
-        boxsizer1.Add(self.sizer_constraints, flag=wx.TOP|wx.BOTTOM,
+        boxsizer1.Add(self.sizer_constraints, flag=wx.TOP | wx.BOTTOM,
                       border=10)
-        boxsizer1.Add(sizer_button, flag=wx.TOP|wx.BOTTOM, border=10)
-        
+        boxsizer1.Add(sizer_button, flag=wx.TOP | wx.BOTTOM, border=10)
+
         self.sizer2.Add(boxsizer1, 0, wx.EXPAND | wx.ALL, 10)
         self.sizer2.Layout()
-       
+
         #self.SetScrollbars(20,20,25,65)
-    
+
     def _set_constraint(self):
         """
@@ -805,5 +805,5 @@
                                 StatusEvent(info="error", status=msg))
                         return False
-                        
+
                     for fid in self.page_finder[id].iterkeys():
                         # wrap in param/constraint in str() to remove unicode
@@ -812,5 +812,5 @@
                     break
         return True
-    
+
     def _fill_sizer_model_list(self, sizer):
         """
@@ -821,11 +821,11 @@
         list = []
         sizer.Clear(True)
-        
+
         new_name = wx.StaticText(self, -1, '  Model Title ',
                                  style=wx.ALIGN_CENTER)
         new_name.SetBackgroundColour('orange')
         new_name.SetForegroundColour(wx.WHITE)
-        sizer.Add(new_name,(iy, ix),(1,1),
-                            wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        sizer.Add(new_name, (iy, ix), (1, 1),
+                            wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
         ix += 2
         model_type = wx.StaticText(self, -1, '  Model ')
@@ -833,5 +833,5 @@
         model_type.SetForegroundColour(wx.WHITE)
         sizer.Add(model_type, (iy, ix), (1, 1),
-                            wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+                            wx.EXPAND | wx.ADJUST_MINSIZE, 0)
         ix += 1
         data_used = wx.StaticText(self, -1, '  Data ')
@@ -839,5 +839,5 @@
         data_used.SetForegroundColour(wx.WHITE)
         sizer.Add(data_used, (iy, ix), (1, 1),
-                            wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+                            wx.EXPAND | wx.ADJUST_MINSIZE, 0)
         ix += 1
         tab_used = wx.StaticText(self, -1, '  FitPage ')
@@ -845,5 +845,5 @@
         tab_used.SetForegroundColour(wx.WHITE)
         sizer.Add(tab_used, (iy, ix), (1, 1),
-                            wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+                            wx.EXPAND | wx.ADJUST_MINSIZE, 0)
         for id, value in self.page_finder.iteritems():
             if id not in self.parent.opened_pages:
@@ -852,10 +852,10 @@
             if self.batch_on != self.parent.get_page_by_id(id).batch_on:
                 continue
-            
+
             data_list = []
             model_list = []
             # get data name and model objetta
             for fitproblem in value.get_fit_problem():
-                
+
                 data = fitproblem.get_fit_data()
                 if not data.is_data:
@@ -865,10 +865,10 @@
                     name = str(data.name)
                 data_list.append(name)
-                    
+
                 model = fitproblem.get_model()
                 if model is None:
                     continue
                 model_list.append(model)
-           
+
             if len(model_list) == 0:
                 continue
@@ -883,12 +883,12 @@
             cb.SetValue(False)
             cb.Enable(model is not None and data.is_data)
-            sizer.Add(cb, (iy, ix), (1, 1), 
-                       wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+            sizer.Add(cb, (iy, ix), (1, 1),
+                       wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
             wx.EVT_CHECKBOX(self, cb.GetId(), self.check_model_name)
-            ix += 2 
+            ix += 2
             type = model.__class__.__name__
             model_type = wx.StaticText(self, -1, str(type))
             sizer.Add(model_type, (iy, ix), (1, 1),
-                      wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+                      wx.EXPAND | wx.ADJUST_MINSIZE, 0)
             if self.batch_on:
                 data_used = wx.ComboBox(self, -1, style=wx.CB_READONLY)
@@ -897,21 +897,21 @@
             else:
                 data_used = wx.StaticText(self, -1, data_list[0])
-            
+
             ix += 1
             sizer.Add(data_used, (iy, ix), (1, 1),
-                      wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+                      wx.EXPAND | wx.ADJUST_MINSIZE, 0)
             ix += 1
             caption = value.get_fit_tab_caption()
             tab_caption_used = wx.StaticText(self, -1, str(caption))
             sizer.Add(tab_caption_used, (iy, ix), (1, 1),
-                      wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-            
+                      wx.EXPAND | wx.ADJUST_MINSIZE, 0)
+
             self.model_list.append([cb, value, id, model])
-            
+
         iy += 1
         sizer.Add((20, 20), (iy, ix), (1, 1),
-                  wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+                  wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
         sizer.Layout()
-    
+
     def on_set_focus(self, event=None):
         """
