Changeset 681f0dc in sasview


Ignore:
Timestamp:
Jan 15, 2009 5:35:45 PM (16 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:
e9b4cc4
Parents:
4853c04
Message:

added flexibility on handler choice for fit (park). allow to print some update on the sansview

Location:
park_integration
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • park_integration/AbstractFitEngine.py

    rb461b6d7 r681f0dc  
    364364            @param params: value of parameters to fit 
    365365        """ 
     366        #import thread 
    366367        self.model.setParams(self.paramlist,params) 
    367368        self.res= self.data.residuals(self.model.eval) 
     369        #print "residuals",thread.get_ident() 
    368370        return self.res 
    369371     
  • park_integration/Fitting.py

    r61cb28d r681f0dc  
    5252        return self._engine 
    5353     
    54     def fit(self, qmin=None, qmax=None): 
     54    def fit(self,handler=None, qmin=None, qmax=None): 
    5555        """Perform the fit """ 
    56         return self._engine.fit(qmin,qmax) 
     56     
     57        return self._engine.fit(handler, qmin,qmax) 
    5758     
    5859    def set_model(self,model,Uid,pars=[]): 
  • park_integration/ParkFitting.py

    r61cb28d r681f0dc  
    8383         
    8484     
    85     def fit(self, qmin=None, qmax=None): 
     85    def fit(self,handler=None, qmin=None, qmax=None): 
    8686        """ 
    8787            Performs fit with park.fit module.It can  perform fit with one model 
     
    103103        localfit = FitSimplex() 
    104104        localfit.ftol = 1e-8 
    105         # fitmc(fitness,localfit,n,handler): 
    106         #Run a monte carlo fit. 
    107         #This procedure maps a local optimizer across a set of n initial points. 
    108         #The initial parameter value defined by the fitness parameters defines 
    109         #one initial point.  The remainder are randomly generated within the 
    110         #bounds of the problem. 
    111         #localfit is the local optimizer to use.  It should be a bounded 
    112         #optimizer following the `park.fitmc.LocalFit` interface. 
    113         #handler accepts updates to the current best set of fit parameters. 
     105         
    114106        # See `park.fitresult.FitHandler` for details. 
    115107        fitter = FitMC(localfit=localfit) 
    116         #result = fit.fit(self.problem, 
    117         #             fitter=fitter, 
    118         #            handler= GuiUpdate(window)) 
     108        if handler == None: 
     109            print "no handler" 
     110            handler= fitresult.ConsoleUpdate(improvement_delta=0.1) 
     111        print "park handler", handler 
    119112        result = fit.fit(self.problem, 
    120113                         fitter=fitter, 
    121                          handler= fitresult.ConsoleUpdate(improvement_delta=0.1)) 
    122         #handler = fitresult.ConsoleUpdate(improvement_delta=0.1) 
    123         #models=self.problem 
    124         #service=None 
    125         #if models is None: raise RuntimeError('fit expected a list of models') 
    126         #from park.fit import LocalQueue,FitJob 
    127         #if service is None: service = LocalQueue() 
    128         #if fitter is None: fitter = fitmc.FitMC() 
    129         #if handler is None: handler = fitresult.FitHandler() 
    130      
    131         #objective = assembly.Assembly(models) if isinstance(models,list) else models 
    132         #job = FitJob(self.problem,fitter,handler) 
    133         #service.start(job) 
    134         #import wx 
    135         #while not self.job.handler.done: 
    136         #    time.sleep(interval) 
    137         #    wx.Yield() 
    138         #result=service.job.handler.result 
     114                         handler= handler) 
     115        
    139116         
    140117        if result !=None: 
  • park_integration/ScipyFitting.py

    r61cb28d r681f0dc  
    5959        self.fitArrangeDict={} 
    6060        self.paramList=[] 
    61     def fit(self,qmin=None, qmax=None): 
     61    def fit(self ,handler=None, qmin=None, qmax=None): 
    6262        # Protect against simultanous fitting attempts 
    6363        #if len(self.fitArrangeDict)>1:  
     
    6565        # fitproblem contains first fitArrange object(one model and a list of data) 
    6666        #list of fitproblem 
     67        
    6768        fitproblem=[] 
    6869        for id ,fproblem in self.fitArrangeDict.iteritems(): 
Note: See TracChangeset for help on using the changeset viewer.