Changeset 73bbe35 in sasview for park_integration


Ignore:
Timestamp:
May 21, 2008 5:53:34 PM (17 years ago)
Author:
Gervaise Alina <gervyh@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
e94d1d3
Parents:
0954398
Message:

more changed done

File:
1 edited

Legend:

Unmodified
Added
Removed
  • park_integration/test/FittingModule.py

    r0954398 r73bbe35  
    5151        #the list of all data to fit  
    5252        self.data = data 
    53         #dictionary of models parameters 
    54         self.parameters={} 
     53        #list of models parameters 
     54        self.parameters=[] 
    5555        self.contraint =None 
    5656        self.residuals=[] 
    57          
    58     def fit_engine(self): 
     57        self.fitType =None 
     58         
     59    def fit_engine(self,word): 
    5960        """ 
    6061            Check the contraint value and specify what kind of fit to use 
    6162        """ 
     63        self.fitType = word 
    6264        return True 
    6365     
     
    7779        model =fitproblem.get_model() 
    7880        listdata= fitproblem.get_data() 
    79          
     81        self.set_param(model, pars) 
     82        print "this is self.parameters",self.parameters 
    8083        for data in listdata: 
    8184            for i in range(len(data.x)): 
     
    9295        if qmax==None: 
    9396            qmax= max(xtemp)   
    94         chisqr, out, cov = fitHelper(model, pars, xtemp,ytemp, dytemp ,qmin,qmax) 
     97        chisqr, out, cov = fitHelper(model,self.parameters, xtemp,ytemp, dytemp ,qmin,qmax) 
    9598        return chisqr, out, cov 
    9699     
     
    116119        return self.data 
    117120     
     121    def set_param(self,model, pars): 
     122        """ Recieve a dictionary of parameter and save it """ 
     123        self.parameters=[] 
     124        #for key ,value in pars: 
     125        for key, value in pars.iteritems(): 
     126            print "this is the key",key 
     127            print "this is the value",value 
     128            param = Parameter(model, key, value) 
     129            self.parameters.append(param) 
     130         
    118131    def add_contraint(self, contraint): 
    119132        """ User specify contraint to fit """ 
     
    215228    Fit.set_model(model,1 ) 
    216229    Fit.set_data(data1,1) 
    217     default_A = model.getParam('A')  
    218     default_B = model.getParam('B')  
    219     cstA = Parameter(model, 'A', default_A) 
    220     cstB  = Parameter(model, 'B', default_B) 
    221      
    222     chisqr, out, cov=Fit.fit([cstA,cstB],None,None) 
     230    #default_A = model.getParam('A')  
     231    #default_B = model.getParam('B')  
     232    #cstA = Parameter(model, 'A', default_A) 
     233    #cstB  = Parameter(model, 'B', default_B) 
     234     
     235    #chisqr, out, cov=Fit.fit([cstA,cstB],None,None) 
     236    chisqr, out, cov=Fit.fit({'A':2,'B':1},None,None) 
    223237    print"fit only one data",chisqr, out, cov  
    224238     
     
    240254    load.load_data(data3) 
    241255    Fit.set_data(data3,2) 
    242     chisqr, out, cov=Fit.fit([cstA,cstB],None,None) 
     256    chisqr, out, cov=Fit.fit({'A':2,'B':1},None,None) 
    243257    print"fit two data",chisqr, out, cov  
    244258     
Note: See TracChangeset for help on using the changeset viewer.