Changeset 7db52f1 in sasview for park_integration/src/sans/fit
- Timestamp:
- Oct 12, 2011 1:40:24 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:
- 7643ba2
- Parents:
- 18253cd
- Location:
- park_integration/src/sans/fit
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
park_integration/src/sans/fit/AbstractFitEngine.py
rd8661fb r7db52f1 459 459 #import thread 460 460 self.model.set_params(self.paramlist, params) 461 461 print "params", params 462 462 self.true_res, theory = self.data.residuals(self.model.eval) 463 463 self.theory = copy.deepcopy(theory) … … 548 548 #Dictionnary of fitArrange element (fit problems) 549 549 self.fit_arrange_dict = {} 550 550 551 551 def set_model(self, model, id, pars=[], constraints=[], data=None): 552 552 """ … … 611 611 fitproblem.pars = pars 612 612 self.fit_arrange_dict[id] = fitproblem 613 613 vals = [] 614 for name in pars: 615 vals.append(new_model.model.getParam(name)) 616 self.fit_arrange_dict[id].vals = vals 614 617 else: 615 618 raise ValueError, "park_integration:missing parameters" … … 698 701 self.data_list = [] 699 702 self.pars = [] 703 self.vals = [] 700 704 #self.selected is zero when this fit problem is not schedule to fit 701 705 #self.selected is 1 when schedule to fit -
park_integration/src/sans/fit/Fitting.py
r634ca14 r7db52f1 50 50 raise ValueError, "enter the keyword scipy or park" 51 51 52 def fit(self, q=None, handler=None, curr_thread=None, ftol=1.49012e-8): 52 def fit(self, q=None, handler=None, 53 curr_thread=None, 54 ftol=1.49012e-8, 55 reset_flag=False): 53 56 """Perform the fit """ 54 57 return self._engine.fit(q, handler, curr_thread=curr_thread, 55 ftol=ftol )58 ftol=ftol, reset_flag=reset_flag) 56 59 57 60 def set_model(self, model, id, pars=[], constraints=[], data=None): -
park_integration/src/sans/fit/ParkFitting.py
r444c900e r7db52f1 338 338 self.param_list = [] 339 339 340 def create_assembly(self, curr_thread ):340 def create_assembly(self, curr_thread, reset_flag=False): 341 341 """ 342 342 Extract sansmodel and sansdata from … … 358 358 for item in fitproblems: 359 359 parkmodel = item.get_model() 360 if reset_flag: 361 # reset the initial value; useful for batch 362 for name in item.pars: 363 ind = item.pars.index(name) 364 parkmodel.model.setParam(name, item.vals[ind]) 365 360 366 for p in parkmodel.parameterset: 361 367 ## does not allow status change for constraint parameters … … 374 380 375 381 376 def fit(self, q=None, handler=None, curr_thread=None, ftol=1.49012e-8): 382 def fit(self, q=None, handler=None, curr_thread=None, 383 ftol=1.49012e-8, reset_flag=False): 377 384 """ 378 385 Performs fit with park.fit module.It can perform fit with one model … … 395 402 396 403 """ 397 self.create_assembly(curr_thread=curr_thread )404 self.create_assembly(curr_thread=curr_thread, reset_flag=reset_flag) 398 405 localfit = SansFitSimplex() 399 406 localfit.ftol = ftol -
park_integration/src/sans/fit/ScipyFitting.py
rd8661fb r7db52f1 56 56 # return profile(self._fit, *args, **kw) 57 57 58 def fit(self, q=None, handler=None, curr_thread=None, ftol=1.49012e-8): 58 def fit(self, q=None, handler=None, curr_thread=None, 59 ftol=1.49012e-8, reset_flag=False): 59 60 """ 60 61 """ … … 70 71 raise RuntimeError, "No Assembly scheduled for Scipy fitting." 71 72 return 72 73 model = fitproblem[0].get_model() 74 if reset_flag: 75 # reset the initial value; useful for batch 76 for name in fitproblem[0].pars: 77 ind = fitproblem[0].pars.index(name) 78 model.model.setParam(name, fitproblem[0].vals[ind]) 73 79 listdata = [] 74 model = fitproblem[0].get_model()75 80 listdata = fitproblem[0].get_data() 76 81 # Concatenate dList set (contains one or more data)before fitting
Note: See TracChangeset
for help on using the changeset viewer.