Changeset 5044543 in sasview for src/sans


Ignore:
Timestamp:
May 22, 2014 8:52:39 AM (10 years ago)
Author:
pkienzle
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:
ddfe1eb7
Parents:
278e86f
Message:

fix batch fit support for bumps

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sans/fit/BumpsFitting.py

    rbf5e985 r5044543  
    6262    Wrap SAS model as a bumps fitness object 
    6363    """ 
    64     def __init__(self, model, data, fitted=[], constraints={}, **kw): 
     64    def __init__(self, model, data, fitted=[], constraints={}, 
     65                 initial_values=None, **kw): 
    6566        self.name = model.name 
    6667        self.model = model.model 
     
    6869        self._define_pars() 
    6970        self._init_pars(kw) 
     71        if initial_values is not None: 
     72            self._reset_pars(fitted, initial_values) 
    7073        self.constraints = dict(constraints) 
    7174        self.set_fitted(fitted) 
    72         self._dirty = True 
     75        self.update() 
     76 
     77    def _reset_pars(self, names, values): 
     78        for k,v in zip(names, values): 
     79            self._pars[k].value = v 
    7380 
    7481    def _define_pars(self): 
     
    103110            else: 
    104111                self._pars[k].value = v 
    105         self.update() 
    106112 
    107113    def set_fitted(self, param_list): 
     
    168174                             data=M.get_data(), 
    169175                             constraints=M.constraints, 
    170                              fitted=M.pars) 
     176                             fitted=M.pars, 
     177                             initial_values=M.vals if reset_flag else None) 
    171178                  for M in self.fit_arrange_dict.values() 
    172179                  if M.get_to_fit()] 
     
    211218            R.theory = fitness.theory() 
    212219            R.residuals = fitness.residuals() 
     220            R.index = fitness.data.idx 
    213221            R.fitter_id = self.fitter_id 
    214222            # TODO: should scale stderr by sqrt(chisq/DOF) if dy is unknown 
Note: See TracChangeset for help on using the changeset viewer.