Index: park_integration/AbstractFitEngine.py
===================================================================
--- park_integration/AbstractFitEngine.py	(revision d831626c10346da20b9b7a000586aa31c32ca89e)
+++ park_integration/AbstractFitEngine.py	(revision 388309d5e5ef39b5f0eb98585a131c6fe6a052c8)
@@ -34,5 +34,5 @@
         PARK wrapper for SANS models.
     """
-    def __init__(self, sans_model):
+    def __init__(self, sans_model, **kw):
         self.model = sans_model
         self.name=sans_model.name
@@ -44,5 +44,7 @@
         self.parameterset = park.ParameterSet(sans_model.name,pars=self.parkp)
         self.pars=[]
-        
+      
+    #def __call__(self, x, pars=[]):
+    #    return self.eval(x)   
     def getParams(self,fitparams):
         list=[]
@@ -62,6 +64,6 @@
         list.sort()
         for i in range(len(params)):
-            #self.parkp[i].value = params[i]
-            #print "abstractfitengine: set-params",list[i],params[i]
+            self.parkp[i].value = params[i]
+            print "abstractfitengine: set-params",list[i],params[i]
             
             self.model.setParam(list[i],params[i])
@@ -70,6 +72,16 @@
        
         return self.model.runXY(x)
-       
-
+   
+    #def set(self, **kw):
+        #"""
+            #Set the initial value for a set of parameters.
+            #E.g., model.set(width=3,center=5)
+        #"""
+        #print "Abstractfitting : set called"
+        # This is a convenience funciton for the user.
+        # 
+        #for k,v in kw.items(): 
+        #    self.parameterset[k].set(v)
+   
 class Data(object):
     """ Wrapper class  for SANS data """
Index: park_integration/ParkFitting.py
===================================================================
--- park_integration/ParkFitting.py	(revision 48882d14c03b61d8a22b600abadcccba552c8697)
+++ park_integration/ParkFitting.py	(revision 388309d5e5ef39b5f0eb98585a131c6fe6a052c8)
@@ -68,6 +68,7 @@
                 #if p.isfixed():
                 #print 'parameters',p.name
-                print "parkfitting: self.paramList",self.paramList
+                #print "parkfitting: self.paramList",self.paramList
                 if p.isfixed() and p._getname()in self.paramList:
+                #if p.isfixed():
                     p.set([-numpy.inf,numpy.inf])
             i+=1    
@@ -108,10 +109,18 @@
         localfit = FitSimplex()
         localfit.ftol = 1e-8
+        #localfit.ftol = 1e-6
         fitter = FitMC(localfit=localfit)
-        print "ParkFitting: result1"
+        print "ParkFitting: result1",pars
+        print "Parkfitting: in fit function fitness resid",self.problem[0].residuals()
+        
+        list=self.problem[0]._parameterset()
+        print "Parkfitting: in fit function fitness paramset",list
+        for item in list:
+            print "Parkfitting: in fit function fitness",item.name, item.value,item.path,item.range
         result = fit.fit(self.problem,
                      fitter=fitter,
                      handler= fitresult.ConsoleUpdate(improvement_delta=0.1))
-        print "ParkFitting: result",result
+        #result = fit.fit(self.problem)
+        print "ParkFitting: result",result.fitness,result.pvec,result.cov
         if result !=None:
             #for p in result.parameters:
Index: park_integration/test/constrainttestpark.py
===================================================================
--- park_integration/test/constrainttestpark.py	(revision 985c88b87a5cf7319bfda1d8af0737566479cd84)
+++ 	(revision )
@@ -1,98 +1,0 @@
-"""
-    Unit tests for fitting module 
-"""
-import unittest
-from sans.guitools.plottables import Theory1D
-from sans.guitools.plottables import Data1D
-from sans.fit.ScipyFitting import Parameter
-import math
-class testFitModule(unittest.TestCase):
-    
-    def test2models2dataonconstraint(self):
-        """ test fitting for two set of data  and one model with 2 constraint"""
-        from sans.fit.Loader import Load
-        load= Load()
-        #Load the first set of data
-        load.set_filename("testdata1.txt")
-        load.set_values()
-        data1 = Data1D(x=[], y=[],dx=None, dy=None)
-        load.load_data(data1)
-        
-        #Load the second set of data
-        load.set_filename("testdata2.txt")
-        load.set_values()
-        data2 = Data1D(x=[], y=[],dx=None, dy=None)
-        load.load_data(data2)
-        
-        #Importing the Fit module
-        from sans.fit.Fitting import Fit
-        fitter= Fit('park')
-        # Receives the type of model for the fitting
-        from sans.guitools.LineModel import LineModel
-        model1  = LineModel()
-        model2  = LineModel()
-        
-        #Do the fit
-        model1.setParam( 'A', 1)
-        model1.setParam( 'B', 2)
-        fitter.set_model(model1,"M1",1, ['A','B'])
-        fitter.set_data(data1,1)
-        
-        model2.setParam( 'A', 'M1.A')
-        model2.setParam( 'B','M1.B')
-        fitter.set_model(model2,"M2",2, ['A','B'])
-        fitter.set_data(data2,2)
-    
-        
-        chisqr2, out2, cov2,result= fitter.fit()
-        print "chisqr2",chisqr2
-        print "out2", out2
-        print " cov2", cov2
-        print chisqr2/len(data1.x)
-        
-        self.assert_(math.fabs(out2[1]-2.5)/math.sqrt(cov2[1][1]) < 2)
-        self.assert_(math.fabs(out2[0]-4.0)/math.sqrt(cov2[0][0]) < 2)
-        #self.assert_(chisqr2/len(data1.x) < 2)
-        #self.assert_(chisqr2/len(data2.x) < 2)
-    def testmodel1data1param1(self):
-        """ test fitting for two set of data  and one model with 2 constraint"""
-        from sans.fit.Loader import Load
-        load= Load()
-        #Load the first set of data
-        load.set_filename("testdata1.txt")
-        load.set_values()
-        data1 = Data1D(x=[], y=[],dx=None, dy=None)
-        load.load_data(data1)
-        
-        #Load the second set of data
-        load.set_filename("testdata2.txt")
-        load.set_values()
-        data2 = Data1D(x=[], y=[],dx=None, dy=None)
-        load.load_data(data2)
-        
-        #Importing the Fit module
-        from sans.fit.Fitting import Fit
-        fitter= Fit('park')
-        # Receives the type of model for the fitting
-        from sans.guitools.LineModel import LineModel
-        model1  = LineModel()
-       
-        
-        #Do the fit
-        model1.setParam( 'A', 1)
-        fitter.set_model(model1,"M1",1, ['A'])
-        fitter.set_data(data1,1)
-       
-     
-        
-        chisqr2, out2, cov2,result = fitter.fit()
-        print "chisqr2",chisqr2
-        print "out2", out2
-        print " cov2", cov2
-        print chisqr2/len(data1.x)
-        
-        self.assert_(math.fabs(out2[1]-2.5)/math.sqrt(cov2[1][1]) < 2)
-        self.assert_(math.fabs(out2[0]-4.0)/math.sqrt(cov2[0][0]) < 2)
-        #self.assert_(chisqr2/len(data1.x) < 2)
-        #self.assert_(chisqr2/len(data2.x) < 2)
-    
Index: park_integration/test/test_fitting_panel.py
===================================================================
--- park_integration/test/test_fitting_panel.py	(revision 985c88b87a5cf7319bfda1d8af0737566479cd84)
+++ 	(revision )
@@ -1,190 +1,0 @@
-"""
-    Unit tests for fitting module 
-"""
-import unittest
-from sans.guitools.plottables import Theory1D
-from sans.guitools.plottables import Data1D
-from sans.fit.ScipyFitting import Parameter
-import math
-import logging
-logging.basicConfig(level=logging.DEBUG,
-                    format='%(asctime)s %(levelname)s %(message)s',
-                    filename='test_log.txt',
-                    filemode='w')
-class testFitModule(unittest.TestCase):
-    def test0(self):
-        """ test fitting for two set of data  and 2 models no constraint"""
-        from sans.fit.Loader import Load
-        load= Load()
-        #Load the first set of data
-        load.set_filename("testdata1.txt")
-        load.set_values()
-        data1 = Data1D(x=[], y=[],dx=None, dy=None)
-        load.load_data(data1)
-        
-        #Load the second set of data
-        load.set_filename("testdata2.txt")
-        load.set_values()
-        data2 = Data1D(x=[], y=[],dx=None, dy=None)
-        load.load_data(data2)
-        
-        #Importing the Fit module
-        from sans.fit.Fitting import Fit
-        fitter= Fit('park')
-        # Receives the type of model for the fitting
-        from sans.guitools.LineModel import LineModel
-        model1  = LineModel()
-        model2  = LineModel()
-        
-        #Do the fit
-        model1.setParam( 'A', 1)
-        model1.setParam( 'B', 2)
-        fitter.set_model(model1,"M1",1, ['A','B'])
-        fitter.set_data(data1,1)
-        
-        model2.setParam( 'A', 1)
-        model2.setParam( 'B', 1)
-        fitter.set_model(model2,"M2",2, ['A','B'])
-        fitter.set_data(data2,2)
-    
-        
-        chisqr1, out1, cov1,result= fitter.fit()
-        print "chisqr1",chisqr1
-        print "out1", out1
-        print " cov1", cov1
-        self.assert_(chisqr1)
-        
-    def test01(self):
-        """ test fitting for two set of data  and 2 models and 2 constraints set on on model"""
-        from sans.fit.Loader import Load
-        load= Load()
-        #Load the first set of data
-        load.set_filename("testdata1.txt")
-        load.set_values()
-        data1 = Data1D(x=[], y=[],dx=None, dy=None)
-        load.load_data(data1)
-        
-        #Load the second set of data
-        load.set_filename("testdata2.txt")
-        load.set_values()
-        data2 = Data1D(x=[], y=[],dx=None, dy=None)
-        load.load_data(data2)
-        
-        #Importing the Fit module
-        from sans.fit.Fitting import Fit
-        fitter= Fit('park')
-        # Receives the type of model for the fitting
-        from sans.guitools.LineModel import LineModel
-        model1  = LineModel()
-        model2  = LineModel()
-        
-        #Do the fit
-        model1.setParam( 'A', 1)
-        model1.setParam( 'B', 1)
-        fitter.set_model(model1,"M1",1, ['A','B'])
-        fitter.set_data(data1,1)
-        
-        model2.setParam( 'A','M1.A')
-        model2.setParam( 'B', 'M1.B')
-        fitter.set_model(model2,"M2",2, ['A','B'])
-        fitter.set_data(data2,2)
-    
-        
-        chisqr1, out1, cov1= fitter.fit()
-        print "chisqr1",chisqr1
-        print "out1", out1
-        print " cov1", cov1
-        self.assert_(chisqr1)
-      
-    
-    
-    def test1(self):
-        """ test fitting for two set of data 2 model on constraint set on 1 model"""
-        from sans.fit.Loader import Load
-        load= Load()
-        #Load the first set of data
-        load.set_filename("testdata_line.txt")
-        load.set_values()
-        data1 = Data1D(x=[], y=[],dx=None, dy=None)
-        load.load_data(data1)
-        
-        #Load the second set of data
-        load.set_filename("testdata_line1.txt")
-        load.set_values()
-        data2 = Data1D(x=[], y=[],dx=None, dy=None)
-        load.load_data(data2)
-        
-        #Importing the Fit module
-        from sans.fit.Fitting import Fit
-        fitter= Fit('park')
-        # Receives the type of model for the fitting
-        from sans.guitools.LineModel import LineModel
-        model1  = LineModel()
-        model2  = LineModel()
-        
-        #Do the fit
-        model1.setParam( 'A',1)
-        model1.setParam( 'B',1)
-        fitter.set_model(model1,"M1",1, ['A','B'])
-        fitter.set_data(data1,1)
-        
-        model2.setParam( 'A','M1.A')
-        model2.setParam( 'B', 1)
-        fitter.set_model(model2,"M2",2, ['A','B'])
-        fitter.set_data(data2,2)
-    
-        
-        chisqr1, out1, cov1= fitter.fit()
-        print "chisqr1",chisqr1
-        print "out1", out1
-        print " cov1", cov1
-        self.assert_(chisqr1)
-      
-    
-    def test2(self):
-        """ test fitting for two data 2 model not equal nombre of parameters fit"""
-        from sans.fit.Loader import Load
-        load= Load()
-        #Load the first set of data
-        load.set_filename("testdata_line.txt")
-        load.set_values()
-        data1 = Data1D(x=[], y=[],dx=None, dy=None)
-        load.load_data(data1)
-        
-        #Load the second set of data
-        load.set_filename("testdata_line1.txt")
-        load.set_values()
-        data2 = Data1D(x=[], y=[],dx=None, dy=None)
-        load.load_data(data2)
-        
-        #Importing the Fit module
-        from sans.fit.Fitting import Fit
-        fitter= Fit('park')
-        # Receives the type of model for the fitting
-        from sans.guitools.LineModel import LineModel
-        model1  = LineModel()
-        model2  = LineModel()
-        
-        #Do the fit
-        model1.setParam( 'A',1)
-        model1.setParam( 'B',1)
-        fitter.set_model(model1,"M1",1, ['A','B'])
-        fitter.set_data(data1,1)
-        
-        model2.setParam( 'A',1)
-       
-        fitter.set_model(model2,"M2",2, ['A'])
-        fitter.set_data(data2,2)
-    
-        
-        chisqr1, out1, cov1= fitter.fit()
-        print "chisqr1",chisqr1
-        print "out1", out1
-        print " cov1", cov1
-        self.assert_(chisqr1)
-        
-       
-        
-       
-    
-      
Index: park_integration/test/test_large_model.py
===================================================================
--- park_integration/test/test_large_model.py	(revision d831626c10346da20b9b7a000586aa31c32ca89e)
+++ 	(revision )
@@ -1,82 +1,0 @@
-"""
-    Unit tests for fitting module 
-"""
-import unittest
-from sans.guitools.plottables import Theory1D
-from sans.guitools.plottables import Data1D
-from sans.fit.AbstractFitEngine import Data,Model
-import math
-class testFitModule(unittest.TestCase):
-    """ test fitting """
-    def test_cylinder_park(self):
-        """ test fitting large model with park"""
-        #load data
-        from sans.fit.Loader import Load
-        load= Load()
-        load.set_filename("cyl_testdata.txt")
-        load.set_values()
-        data11 = Data1D(x=[], y=[],dx=None, dy=None)
-        load.load_data(data11)
-        data1=Data(sans_data=data11)
-        
-        
-        #Importing the Fit module
-        from sans.fit.Fitting import Fit
-        fitter= Fit('park')
-        
-        # Receives the type of model for the fitting
-        from sans.models.CylinderModel import CylinderModel
-        model1  = CylinderModel()
-        model =Model(model1)
-        
-        #Do the fit SCIPY
-        
-        import math
-        #pars1=['background','contrast', 'length']
-        pars1=['background','contrast',\
-                'cyl_phi','cyl_theta','length','radius','scale']
-        pars1.sort()
-        fitter.set_model(model,"M1",1,pars1)
-        fitter.set_data(data1,1)
-      
-        result=fitter.fit()
-        print "park",result.fitness,result.cov, result.pvec
-        self.assert_(result.fitness)
-        
-     
-    def test_cylinder_scipy(self):
-        """ test fitting large model with scipy"""
-        #load data
-        from sans.fit.Loader import Load
-        load= Load()
-        load.set_filename("cyl_testdata.txt")
-        load.set_values()
-        data11 = Data1D(x=[], y=[],dx=None, dy=None)
-        load.load_data(data11)
-        data1=Data(sans_data=data11)
-        
-        
-        #Importing the Fit module
-        from sans.fit.Fitting import Fit
-        fitter= Fit('scipy')
-        
-        # Receives the type of model for the fitting
-        from sans.models.CylinderModel import CylinderModel
-        model1  = CylinderModel()
-        model =Model(model1)
-        
-        #Do the fit SCIPY
-        fitter.set_data(data1,1)
-        import math
-        #pars1=['background','contrast', 'length']
-        pars1=['background','contrast',\
-                'cyl_phi','cyl_theta','length','radius','scale']
-        pars1.sort()
-        fitter.set_model(model,"M1",1,pars1)
-        fitter.set_data(data1,1)
-      
-        result=fitter.fit()
-        print "scipy",result.fitness,result.cov, result.pvec
-        self.assert_(result.fitness)
-        
-    
Index: park_integration/test/testnewscipy.py
===================================================================
--- park_integration/test/testnewscipy.py	(revision 48882d14c03b61d8a22b600abadcccba552c8697)
+++ park_integration/test/testnewscipy.py	(revision 388309d5e5ef39b5f0eb98585a131c6fe6a052c8)
@@ -22,5 +22,5 @@
         #Importing the Fit module
         from sans.fit.Fitting import Fit
-        fitter= Fit('scipy')
+        fitter= Fit('park')
         
         # Receives the type of model for the fitting
@@ -31,14 +31,47 @@
         #Do the fit SCIPY
        
-        fitter.set_data_assembly(data1,1)
-        fitter.set_model_assembly(model,"M1",1,['A','B'])
+        fitter.set_data(data1,1)
+        fitter.set_model(model,"M1",1,['A','B'])
     
         result=fitter.fit()
-        print "scipy",result.pvec,
-        chisqr1, out1, cov1=fitter.fit()
-        """ testing SCIPy results"""
-        self.assert_(math.fabs(out1[1]-2.5)/math.sqrt(cov1[1][1]) < 2)
-        self.assert_(math.fabs(out1[0]-4.0)/math.sqrt(cov1[0][0]) < 2)
-        self.assert_(chisqr1/len(data1.x) < 2)
-       
+        print "park",result.pvec,
+        
+        self.assert_(result)
       
+    def test_cylinder_scipy(self):
+        """ test fitting large model with scipy"""
+        #load data
+        from sans.fit.Loader import Load
+        load= Load()
+        load.set_filename("cyl_testdata.txt")
+        load.set_values()
+        data11 = Data1D(x=[], y=[],dx=None, dy=None)
+        load.load_data(data11)
+        data1=Data(sans_data=data11)
+        
+        
+        #Importing the Fit module
+        from sans.fit.Fitting import Fit
+        fitter= Fit('park')
+        
+        # Receives the type of model for the fitting
+        from sans.models.CylinderModel import CylinderModel
+        model1  = CylinderModel()
+        model =Model(model1)
+        
+        #Do the fit SCIPY
+        fitter.set_data(data1,1)
+        import math
+        pars1=['background','contrast', 'length']
+        #pars1=['background','contrast',\
+        #        'cyl_phi','cyl_theta','length','radius','scale']
+        pars1.sort()
+        fitter.set_model(model,"M1",1,pars1)
+        fitter.set_data(data1,1)
+      
+        result=fitter.fit()
+        print "park",result.fitness,result.cov, result.pvec
+        self.assert_(result.fitness)
+        
+    
+      
Index: park_integration/test/testpark_line.py
===================================================================
--- park_integration/test/testpark_line.py	(revision 388309d5e5ef39b5f0eb98585a131c6fe6a052c8)
+++ park_integration/test/testpark_line.py	(revision 388309d5e5ef39b5f0eb98585a131c6fe6a052c8)
@@ -0,0 +1,62 @@
+"""
+    Unit tests for fitting module  using park integration
+    fitting 2 data with 2 model and one constraint on only one parameter is not working
+"""
+import unittest
+from sans.guitools.plottables import Theory1D
+from sans.guitools.plottables import Data1D
+from sans.fit.AbstractFitEngine import Model,Data
+import math
+class testFitModule(unittest.TestCase):
+    
+    def test2models2data2constraints(self):
+        """ test fitting for two data , 2 model , 2 constraints"""
+        from sans.fit.Loader import Load
+        load= Load()
+        #Load the first data
+        load.set_filename("testdata1.txt")
+        load.set_values()
+        data1 = Data1D(x=[], y=[],dx=None, dy=None)
+        load.load_data(data1)
+        
+        #Load the second data
+        load.set_filename("testdata2.txt")
+        load.set_values()
+        data2 = Data1D(x=[], y=[],dx=None, dy=None)
+        load.load_data(data2)
+        
+        #Load the third data
+        load.set_filename("testdata_line.txt")
+        load.set_values()
+        data3 = Data1D(x=[], y=[],dx=None, dy=None)
+        load.load_data(data3)
+        
+        #Importing the Fit module
+        from sans.fit.Fitting import Fit
+        fitter= Fit('park')
+        # Receives the type of model for the fitting
+        from sans.guitools.LineModel import LineModel
+        model1  = LineModel()
+        
+        #Do the fit
+        model1.setParam( 'A', 2.5)
+        model1.setParam( 'B', 4)
+        model1.name="M1"
+        fitter.set_model(Model(model1),"M1",1, ['A','B'])
+        fitter.set_data(Data(sans_data=data1),1)
+        
+        
+        result = fitter.fit()
+        chisqr1 = result.fitness
+        out1 = result.pvec
+        cov1 = result.cov
+        self.assert_(math.fabs(out1[1]-2.5)/math.sqrt(cov1[1][1]) < 2)
+        print math.fabs(out1[0]-4.0)/math.sqrt(cov1[0][0])
+        #self.assert_(math.fabs(out1[0]-4.0)/math.sqrt(cov1[0][0]) < 2)
+        self.assert_(math.fabs(out1[3]-2.5)/math.sqrt(cov1[3][3]) < 2)
+        self.assert_(math.fabs(out1[2]-4.0)/math.sqrt(cov1[2][2]) < 2)
+        print chisqr1/len(data1.x)
+        #self.assert_(chisqr1/len(data1.x) < 2)
+        print chisqr1/len(data2.x)
+        #self.assert_(chisqr2/len(data2.x) < 2)
+    
