Changeset 634ca14 in sasview for park_integration
- Timestamp:
- Oct 5, 2011 1:15:32 PM (13 years ago)
- 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:
- d91d2c9
- Parents:
- 41661a0
- Location:
- park_integration/src/sans/fit
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
park_integration/src/sans/fit/AbstractFitEngine.py
r1cff677 r634ca14 170 170 a way to get residuals from data. 171 171 """ 172 def __init__(self, x, y, dx=None, dy=None, smearer=None ):172 def __init__(self, x, y, dx=None, dy=None, smearer=None, data=None): 173 173 """ 174 174 :param smearer: is an object of class QSmearer or SlitSmearer … … 191 191 """ 192 192 Data1D.__init__(self, x=x, y=y, dx=dx, dy=dy) 193 193 self.sans_data = data 194 194 self.smearer = smearer 195 195 self._first_unsmeared_bin = None … … 309 309 self.radius = 0 310 310 self.res_err_data = [] 311 self.sans_data = sans_data2d 311 312 self.set_data(sans_data2d) 312 313 … … 625 626 fitdata = FitData1D(x=data.x, y=data.y , 626 627 dx=data.dx, dy=data.dy, smearer=smearer) 628 fitdata.sans_data = data 627 629 628 630 fitdata.set_fit_range(qmin=qmin, qmax=qmax) -
park_integration/src/sans/fit/Fitting.py
rcc83c649 r634ca14 55 55 ftol=ftol) 56 56 57 def set_model(self, model, id, pars=[], constraints=[] ):57 def set_model(self, model, id, pars=[], constraints=[], data=None): 58 58 """ 59 59 store a model model to fit at the position id of the fit engine 60 60 """ 61 self._engine.set_model(model, id, pars, constraints )61 self._engine.set_model(model, id, pars, constraints, data=data) 62 62 63 63 def set_data(self, data, id, smearer=None, qmin=None, qmax=None): -
park_integration/src/sans/fit/ParkFitting.py
r1cff677 r634ca14 24 24 from sans.fit.AbstractFitEngine import FitEngine 25 25 26 class SansFitResult(fitresult.FitResult): 27 def __init__(self, *args, **kwrds): 28 fitresult.FitResult.__init__(self, *args, **kwrds) 29 self.inputs = [] 30 26 31 class SansFitSimplex(FitSimplex): 27 32 """ … … 57 62 fitpars = [SansFitParameter(pars[i].name,pars[i].range,v, pars[i].model, pars[i].data) 58 63 for i,v in enumerate(result.x)] 59 res = fitresult.FitResult(fitpars, result.calls, result.fx) 64 res = SansFitResult(fitpars, result.calls, result.fx) 65 res.inputs = [(pars[i].model, pars[i].data) for i,v in enumerate(result.x)] 60 66 # Compute the parameter uncertainties from the jacobian 61 67 res.calc_cov(fitness) … … 384 390 self.problem.all_results(result) 385 391 386 #print "park------", self.problem.parts 392 #print "park------", result.inputs 393 #for (model, data) in result.inputs: 394 # print model.name, data.name 395 #for p in result.parameters: 396 # print "simul ----", p , p.__class__, p.model.name, p.data.name 387 397 388 398 if result != None: -
park_integration/src/sans/fit/ScipyFitting.py
r82bff0b r634ca14 14 14 from sans.fit.AbstractFitEngine import SansAssembly 15 15 from sans.fit.AbstractFitEngine import FitAbort 16 from sans.fit.AbstractFitEngine import Model 16 17 IS_MAC = True 17 18 if sys.platform.count("win32") > 0: … … 22 23 Storing fit result 23 24 """ 24 def __init__(self, model=None, param_list=None ):25 def __init__(self, model=None, param_list=None, data=None): 25 26 self.calls = None 26 27 self.fitness = None … … 34 35 self.parameters = None 35 36 self.is_mac = IS_MAC 37 if issubclass(model.__class__, Model): 38 model = model.model 36 39 self.model = model 40 self.data = data 37 41 self.param_list = param_list 38 42 self.iterations = 0 43 44 self.inputs = [(self.model, self.data)] 39 45 40 46 def set_model(self, model): … … 139 145 self._check_param_range(model) 140 146 141 result = fitresult(model=model, param_list=self.param_list)147 result = fitresult(model=model, data=data.sans_data, param_list=self.param_list) 142 148 if handler is not None: 143 149 handler.set_result(result=result) … … 182 188 result.pvec = out 183 189 result.success = success 190 print "scipy", result.inputs 184 191 if q is not None: 185 192 q.put(result)
Note: See TracChangeset
for help on using the changeset viewer.