Index: rk_integration/src/sans/fit/.project
===================================================================
--- park_integration/src/sans/fit/.project	(revision e8929ad8f70b7cd0c385a9f36759321a76c836fe)
+++ 	(revision )
@@ -1,17 +1,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-	<name>park_integration</name>
-	<comment></comment>
-	<projects>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>org.python.pydev.PyDevBuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>org.python.pydev.pythonNature</nature>
-	</natures>
-</projectDescription>
Index: rk_integration/src/sans/fit/.pydevproject
===================================================================
--- park_integration/src/sans/fit/.pydevproject	(revision d0abc8e9ab4a474dc99af3a728d51f9452b11520)
+++ 	(revision )
@@ -1,9 +1,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<?eclipse-pydev version="1.0"?>
-
-<pydev_project>
-<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
-<path>/park_integration/src</path>
-</pydev_pathproperty>
-<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.5</pydev_property>
-</pydev_project>
Index: park_integration/src/sans/fit/AbstractFitEngine.py
===================================================================
--- park_integration/src/sans/fit/AbstractFitEngine.py	(revision 06e7c26e9840606d993e240d7b7adac9e7ccbb94)
+++ park_integration/src/sans/fit/AbstractFitEngine.py	(revision 1f9f3c8a26deaac9b3fe51f9d2f767ebc9c3c7c3)
@@ -8,5 +8,4 @@
 from sans.dataloader.data_info import Data1D
 from sans.dataloader.data_info import Data2D
-import time
 _SMALLVALUE = 1.0e-10    
     
@@ -19,7 +18,6 @@
     def __init__(self, name, model, data):
         """
-        :param name: the name of the model parameter
-        :param model: the sans model to wrap as a park model
-        
+            :param name: the name of the model parameter
+            :param model: the sans model to wrap as a park model
         """
         park.Parameter.__init__(self, name)
@@ -59,10 +57,6 @@
         if lo is None: lo = -numpy.inf
         if hi is None: hi = numpy.inf
-        #else:
-            #lo,hi = self._model.details[self.name][1:]
-            #if lo is None: lo = -numpy.inf
-            #if hi is None: hi = numpy.inf
         if lo > hi:
-            raise ValueError,"wrong fit range for parameters"
+            raise ValueError, "wrong fit range for parameters"
         
         return lo, hi
@@ -82,4 +76,5 @@
         self._model.details[self.name][1:3] = r
     range = property(_getrange, _setrange)
+    
     
 class Model(park.Model):
@@ -100,5 +95,5 @@
         #list of park parameter
         self.parkp = [SansParameter(p, sans_model, sans_data) for p in self.sansp]
-        #list of parameterset 
+        #list of parameter set
         self.parameterset = park.ParameterSet(sans_model.name, pars=self.parkp)
         self.pars = []
@@ -124,5 +119,5 @@
         Set value for parameters to fit
         
-        :param params: list of value for parameters to fit 
+        :param params: list of value for parameters to fit
         
         """
@@ -138,8 +133,7 @@
     def eval(self, x):
         """
-        override eval method of park model. 
-        
-        :param x: the x value used to compute a function
-        
+            Override eval method of park model.
+        
+            :param x: the x value used to compute a function
         """
         try:
@@ -162,31 +156,31 @@
         return []
 
-
     
 class FitData1D(Data1D):
-    """ 
-    Wrapper class  for SANS data 
-    FitData1D inherits from DataLoader.data_info.Data1D. Implements 
-    a way to get residuals from data.
+    """
+        Wrapper class  for SANS data
+        FitData1D inherits from DataLoader.data_info.Data1D. Implements
+        a way to get residuals from data.
     """
     def __init__(self, x, y, dx=None, dy=None, smearer=None, data=None):
         """
-        :param smearer: is an object of class QSmearer or SlitSmearer
-           that will smear the theory data (slit smearing or resolution 
-           smearing) when set.
-        
-        The proper way to set the smearing object would be to
-        do the following: ::
-        
-            from DataLoader.qsmearing import smear_selection
-            smearer = smear_selection(some_data)
-            fitdata1d = FitData1D( x= [1,3,..,], 
-                                    y= [3,4,..,8], 
-                                    dx=None,
-                                    dy=[1,2...], smearer= smearer)
-       
-        :Note: that some_data _HAS_ to be of class DataLoader.data_info.Data1D
-            Setting it back to None will turn smearing off.
-            
+            :param smearer: is an object of class QSmearer or SlitSmearer
+               that will smear the theory data (slit smearing or resolution
+               smearing) when set.
+            
+            The proper way to set the smearing object would be to
+            do the following: ::
+            
+                from DataLoader.qsmearing import smear_selection
+                smearer = smear_selection(some_data)
+                fitdata1d = FitData1D( x= [1,3,..,],
+                                        y= [3,4,..,8],
+                                        dx=None,
+                                        dy=[1,2...], smearer= smearer)
+           
+            :Note: that some_data _HAS_ to be of
+                class DataLoader.data_info.Data1D
+                Setting it back to None will turn smearing off.
+                
         """
         Data1D.__init__(self, x=x, y=y, dx=dx, dy=dy)
@@ -199,5 +193,5 @@
         # constant, or dy data
         if dy == None or dy == [] or dy.all() == 0:
-            self.dy = numpy.ones(len(y))  
+            self.dy = numpy.ones(len(y))
         else:
             self.dy = numpy.asarray(dy).copy()
@@ -205,8 +199,8 @@
         ## Min Q-value
         #Skip the Q=0 point, especially when y(q=0)=None at x[0].
-        if min (self.x) == 0.0 and self.x[0] == 0 and\
+        if min(self.x) == 0.0 and self.x[0] == 0 and\
                      not numpy.isfinite(self.y[0]):
-            self.qmin = min(self.x[self.x!=0])
-        else:                              
+            self.qmin = min(self.x[self.x != 0])
+        else:
             self.qmin = min(self.x)
         ## Max Q-value
@@ -227,6 +221,6 @@
         if qmin == 0.0 and not numpy.isfinite(self.y[qmin]):
             self.qmin = min(self.x[self.x != 0])
-        elif qmin != None:                       
-            self.qmin = qmin            
+        elif qmin != None:
+            self.qmin = qmin
         if qmax != None:
             self.qmax = qmax
@@ -234,8 +228,8 @@
         # the smeared Q range
         self._qmin_unsmeared = self.qmin
-        self._qmax_unsmeared = self.qmax    
+        self._qmax_unsmeared = self.qmax
         
         self._first_unsmeared_bin = 0
-        self._last_unsmeared_bin  = len(self.x) - 1
+        self._last_unsmeared_bin = len(self.x) - 1
         
         if self.smearer != None:
@@ -248,5 +242,5 @@
         self.idx = (self.x >= self.qmin) & (self.x <= self.qmax)
         ## zero error can not participate for fitting
-        self.idx = self.idx & (self.dy != 0)  
+        self.idx = self.idx & (self.dy != 0)
         self.idx_unsmeared = (self.x >= self._qmin_unsmeared) \
                             & (self.x <= self._qmax_unsmeared)
@@ -254,19 +248,18 @@
     def get_fit_range(self):
         """
-        return the range of data.x to fit
+            Return the range of data.x to fit
         """
         return self.qmin, self.qmax
         
     def residuals(self, fn):
-        """ 
-        Compute residuals.
-        
-        If self.smearer has been set, use if to smear
-        the data before computing chi squared.
-        
-        :param fn: function that return model value
-        
-        :return: residuals
-        
+        """
+            Compute residuals.
+            
+            If self.smearer has been set, use if to smear
+            the data before computing chi squared.
+            
+            :param fn: function that return model value
+            
+            :return: residuals
         """
         # Compute theory data f(x)
@@ -276,30 +269,31 @@
         ## Smear theory data
         if self.smearer is not None:
-            fx = self.smearer(fx, self._first_unsmeared_bin, 
+            fx = self.smearer(fx, self._first_unsmeared_bin,
                               self._last_unsmeared_bin)
         ## Sanity check
         if numpy.size(self.dy) != numpy.size(fx):
             msg = "FitData1D: invalid error array "
-            msg += "%d <> %d" % (numpy.shape(self.dy), numpy.size(fx))                                                      
-            raise RuntimeError, msg  
+            msg += "%d <> %d" % (numpy.shape(self.dy), numpy.size(fx))
+            raise RuntimeError, msg
         return (self.y[self.idx] - fx[self.idx]) / self.dy[self.idx], fx[self.idx]
             
-     
     def residuals_deriv(self, model, pars=[]):
-        """ 
-        :return: residuals derivatives .
-        
-        :note: in this case just return empty array
-        
+        """
+            :return: residuals derivatives .
+            
+            :note: in this case just return empty array 
         """
         return []
     
+    
 class FitData2D(Data2D):
-    """ Wrapper class  for SANS data """
+    """
+        Wrapper class  for SANS data
+    """
     def __init__(self, sans_data2d, data=None, err_data=None):
         Data2D.__init__(self, data=data, err_data=err_data)
         """
-        Data can be initital with a data (sans plottable)
-        or with vectors.
+            Data can be initital with a data (sans plottable)
+            or with vectors.
         """
         self.res_err_image = []
@@ -315,5 +309,5 @@
     def set_data(self, sans_data2d, qmin=None, qmax=None):
         """
-        Determine the correct qx_data and qy_data within range to fit
+            Determine the correct qx_data and qy_data within range to fit
         """
         self.data = sans_data2d.data
@@ -341,12 +335,12 @@
         
         # Note: mask = True: for MASK while mask = False for NOT to mask
-        self.idx = ((self.qmin <= self.radius)&\
+        self.idx = ((self.qmin <= self.radius) &\
                             (self.radius <= self.qmax))
         self.idx = (self.idx) & (self.mask)
         self.idx = (self.idx) & (numpy.isfinite(self.data))
 
-    def set_smearer(self, smearer):  
-        """
-        Set smearer
+    def set_smearer(self, smearer):
+        """
+            Set smearer
         """
         if smearer == None:
@@ -357,15 +351,17 @@
 
     def set_fit_range(self, qmin=None, qmax=None):
-        """ to set the fit range"""
+        """
+            To set the fit range
+        """
         if qmin == 0.0:
             self.qmin = 1e-16
-        elif qmin != None:                       
-            self.qmin = qmin            
+        elif qmin != None:
+            self.qmin = qmin
         if qmax != None:
-            self.qmax = qmax        
+            self.qmax = qmax
         self.radius = numpy.sqrt(self.qx_data**2 + self.qy_data**2)
-        self.idx = ((self.qmin <= self.radius)&\
+        self.idx = ((self.qmin <= self.radius) &\
                             (self.radius <= self.qmax))
-        self.idx = (self.idx) &(self.mask)
+        self.idx = (self.idx) & (self.mask)
         self.idx = (self.idx) & (numpy.isfinite(self.data))
         self.idx = (self.idx) & (self.res_err_data != 0)
@@ -377,8 +373,8 @@
         return self.qmin, self.qmax
      
-    def residuals(self, fn): 
+    def residuals(self, fn):
         """
         return the residuals
-        """ 
+        """
         if self.smearer != None:
             fn.set_index(self.idx)
@@ -386,15 +382,15 @@
             fn.get_data()
 
-            gn = fn.get_value()  
+            gn = fn.get_value()
         else:
             gn = fn([self.qx_data[self.idx],
                      self.qy_data[self.idx]])
         # use only the data point within ROI range
-        res = (self.data[self.idx] - gn)/self.res_err_data[self.idx]
-
-        return res, gn 
+        res = (self.data[self.idx] - gn) / self.res_err_data[self.idx]
+
+        return res, gn
         
     def residuals_deriv(self, model, pars=[]):
-        """ 
+        """
         :return: residuals derivatives .
         
@@ -403,4 +399,5 @@
         """
         return []
+    
     
 class FitAbort(Exception):
@@ -416,5 +413,5 @@
     Sans Assembly class a class wrapper to be call in optimizer.leastsq method
     """
-    def __init__(self, paramlist, model=None , data=None, fitresult=None,
+    def __init__(self, paramlist, model=None, data=None, fitresult=None,
                  handler=None, curr_thread=None, msg_q=None):
         """
@@ -424,5 +421,5 @@
         """
         self.model = model
-        self.data  = data
+        self.data = data
         self.paramlist = paramlist
         self.msg_q = msg_q
@@ -435,5 +432,4 @@
         self.theory = None
         
-    #def chisq(self, params):
     def chisq(self):
         """
@@ -445,18 +441,16 @@
         
         """
-        sum = 0
+        total = 0
         for item in self.true_res:
-            sum += item * item
+            total += item * item
         if len(self.true_res) == 0:
             return None
-        return sum / len(self.true_res)
+        return total / len(self.true_res)
     
     def __call__(self, params):
         """
-        Compute residuals
-        
-        :param params: value of parameters to fit
-        
-        """ 
+            Compute residuals
+            :param params: value of parameters to fit
+        """
         #import thread
         self.model.set_params(self.paramlist, params)
@@ -469,5 +463,5 @@
             # just silent return res = inf
             return self.res
-        self.res = self.true_res       
+        self.res = self.true_res
         
         if self.fitresult is not None:
@@ -488,14 +482,13 @@
                 self.handler.update_fit()
 
-            if self.curr_thread != None :
+            if self.curr_thread != None:
                 try:
                     self.curr_thread.isquit()
                 except:
-                    msg = "Fitting: Terminated...       Note: Forcing to stop " 
+                    msg = "Fitting: Terminated...       Note: Forcing to stop "
                     msg += "fitting may cause a 'Functor error message' "
                     msg += "being recorded in the log file....."
                     self.handler.error(msg)
                     raise
-                    #return 
          
         return self.res
@@ -521,10 +514,10 @@
                         # This value works on Scipy
                         # Do not change numbers below
-                        value = _SMALLVALUE 
+                        value = _SMALLVALUE
                     else:
                         value = p.value
                     # For leastsq, it needs a bit step back from the boundary
-                    val = p.range[0] - value * _SMALLVALUE 
-                    if p.value < val: 
+                    val = p.range[0] - value * _SMALLVALUE
+                    if p.value < val:
                         self.res *= 1e+6
                         
@@ -535,9 +528,9 @@
                     # Do not change numbers below
                     if p.value == 0:
-                        value = _SMALLVALUE 
+                        value = _SMALLVALUE
                     else:
                         value = p.value
                     # For leastsq, it needs a bit step back from the boundary
-                    val = p.range[1] + value * _SMALLVALUE 
+                    val = p.range[1] + value * _SMALLVALUE
                     if p.value > val:
                         self.res *= 1e+6
@@ -559,5 +552,5 @@
         self.fitter_id = None
         
-    def set_model(self, model,  id,  pars=[], constraints=[], data=None):
+    def set_model(self, model, id, pars=[], constraints=[], data=None):
         """
         set a model on a given  in the fit engine.
@@ -629,12 +622,11 @@
     
     def set_data(self, data, id, smearer=None, qmin=None, qmax=None):
-        """ 
+        """
         Receives plottable, creates a list of data to fit,set data
-        in a FitArrange object and adds that object in a dictionary 
+        in a FitArrange object and adds that object in a dictionary
         with key id.
         
         :param data: data added
         :param id: unique key corresponding to a fitArrange object with data
-        
         """
         if data.__class__.__name__ == 'Data2D':
@@ -642,5 +634,5 @@
                                  err_data=data.err_data)
         else:
-            fitdata = FitData1D(x=data.x, y=data.y ,
+            fitdata = FitData1D(x=data.x, y=data.y,
                                  dx=data.dx, dy=data.dy, smearer=smearer)
         fitdata.sans_data = data
@@ -648,5 +640,5 @@
         fitdata.set_fit_range(qmin=qmin, qmax=qmax)
         #A fitArrange is already created but contains model only at id
-        if self.fit_arrange_dict.has_key(id):
+        if id in self.fit_arrange_dict:
             self.fit_arrange_dict[id].add_data(fitdata)
         else:
@@ -654,16 +646,14 @@
             fitproblem = FitArrange()
             fitproblem.add_data(fitdata)
-            self.fit_arrange_dict[id] = fitproblem    
+            self.fit_arrange_dict[id] = fitproblem
    
     def get_model(self, id):
-        """ 
-        
+        """
         :param id: id is key in the dictionary containing the model to return
         
-        :return:  a model at this id or None if no FitArrange element was 
+        :return:  a model at this id or None if no FitArrange element was
             created with this id
-            
-        """
-        if self.fit_arrange_dict.has_key(id):
+        """
+        if id in self.fit_arrange_dict:
             return self.fit_arrange_dict[id].get_model()
         else:
@@ -672,5 +662,5 @@
     def remove_fit_problem(self, id):
         """remove   fitarrange in id"""
-        if self.fit_arrange_dict.has_key(id):
+        if id in self.fit_arrange_dict:
             del self.fit_arrange_dict[id]
             
@@ -680,9 +670,8 @@
         and set in self.selected value to value
         
-        :param value: the value to allow fitting. 
+        :param value: the value to allow fitting.
                 can only have the value one or zero
-                
-        """
-        if self.fit_arrange_dict.has_key(id):
+        """
+        if id in self.fit_arrange_dict:
             self.fit_arrange_dict[id].set_to_fit(value)
              
@@ -692,8 +681,8 @@
         
         :param id: the id of the problem
-        
-        """
-        if self.fit_arrange_dict.has_key(id):
+        """
+        if id in self.fit_arrange_dict:
             self.fit_arrange_dict[id].get_to_fit()
+    
     
 class FitArrange:
@@ -712,23 +701,19 @@
         self.pars = []
         self.vals = []
-        #self.selected  is zero when this fit problem is not schedule to fit 
-        #self.selected is 1 when schedule to fit 
         self.selected = 0
         
     def set_model(self, model):
-        """ 
+        """
         set_model save a copy of the model
         
         :param model: the model being set
-        
         """
         self.model = model
         
     def add_data(self, data):
-        """ 
+        """
         add_data fill a self.data_list with data to fit
         
-        :param data: Data to add in the list  
-        
+        :param data: Data to add in the list
         """
         if not data in self.data_list:
@@ -736,19 +721,14 @@
             
     def get_model(self):
-        """ 
-        
-        :return: saved model 
-        
-        """
-        return self.model   
+        """
+        :return: saved model
+        """
+        return self.model
      
     def get_data(self):
-        """ 
-        
+        """
         :return: list of data data_list
-        
-        """
-        #return self.data_list 
-        return self.data_list[0] 
+        """
+        return self.data_list[0]
       
     def remove_data(self, data):
@@ -757,15 +737,13 @@
         
         :param data: Data to remove from data_list
-        
         """
         if data in self.data_list:
             self.data_list.remove(data)
             
-    def set_to_fit (self, value=0):
+    def set_to_fit(self, value=0):
         """
         set self.selected to 0 or 1  for other values raise an exception
         
         :param value: integer between 0 or 1
-        
         """
         self.selected = value
@@ -781,5 +759,6 @@
 if sys.platform.count("win32") > 0:
     IS_MAC = False
-    
+
+
 class FResult(object):
     """
@@ -835,5 +814,5 @@
                 (p[0], p[1], p[1].value)\
                   for p in result_param if p[1].name in self.param_list]
-            msg =  msg1 + msg3 + msg2
+            msg = msg1 + msg3 + msg2
         else:
             msg = msg1 + msg3
@@ -844,3 +823,3 @@
         """
         """
-        print self  
+        print self
