Changeset 922497f in sasview
- Timestamp:
- Aug 29, 2011 1:15:43 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:
- 59de3e43
- Parents:
- c832374d
- Location:
- fittingview/src/sans/perspectives/fitting
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
fittingview/src/sans/perspectives/fitting/fitting.py
rc832374d r922497f 638 638 update_chisqr=update_chisqr) 639 639 640 def onFit(self, uid =None):640 def onFit(self, uid): 641 641 """ 642 642 Get series of data, model, associates parameters and range and send then … … 650 650 if value.get_scheduled() == 1: 651 651 fitproblem_count += 1 652 653 652 ## if simultaneous fit change automatically the engine to park 654 653 if fitproblem_count > 1: … … 659 658 else: 660 659 engineType = "Single Fit" 661 fitter_list = [] 660 fitter_list = [] 661 sim_fitter = None 662 if self.sim_page is not None and self.sim_page.uid == uid: 663 #simulatanous fit only one engine need to be created 664 sim_fitter = Fit(self._fit_engine) 665 fitter_list.append(sim_fitter) 666 662 667 self.current_pg = None 663 668 list_page_id = [] 669 fit_id = 0 664 670 for page_id, value in self.page_finder.iteritems(): 665 671 # For simulfit (uid give with None), do for-loop … … 678 684 name = str(element[1]) 679 685 pars.append(name) 680 #Set Engine (model , data) related to the page on 681 self._fit_helper(value, pars, fitter_list) 686 687 for fitproblem in value.get_fit_problem(): 688 if sim_fitter is None: 689 fitter = Fit(self._fit_engine) 690 self._fit_helper(fitproblem, pars, fitter, fit_id) 691 fitter_list.append(fitter) 692 else: 693 fitter = sim_fitter 694 self._fit_helper(fitproblem, pars, fitter, fit_id) 695 fit_id += 1 682 696 list_page_id.append(page_id) 683 697 current_page_id = page_id 698 value.clear_model_param() 684 699 except: 700 raise 685 701 msg= "%s error: %s" % (engineType, sys.exc_value) 686 702 wx.PostEvent(self.parent, StatusEvent(status=msg, info="error", … … 865 881 self.page_finder[uid].schedule_tofit(value) 866 882 867 def _fit_helper(self, value, pars, fitter_list):883 def _fit_helper(self, fitproblem, pars, fitter, fit_id): 868 884 """ 869 885 Create and set fit engine with series of data and model … … 872 888 :param value: structure storing data mapped to their model, range etc.. 873 889 """ 874 fit_id = 0 875 for fitproblem in value.get_fit_problem(): 876 fitter = Fit(self._fit_engine) 877 data = fitproblem.get_fit_data() 878 model = fitproblem.get_model() 879 smearer = fitproblem.get_smearer() 880 qmin, qmax = fitproblem.get_range() 881 #Extra list of parameters and their constraints 882 listOfConstraint = [] 883 param = fitproblem.get_model_param() 884 if len(param) > 0: 885 for item in param: 886 ## check if constraint 887 if item[0] != None and item[1] != None: 888 listOfConstraint.append((item[0],item[1])) 889 fitter.set_model(model, fit_id, pars, constraints=listOfConstraint) 890 fitter.set_data(data=data, id=fit_id, smearer=smearer, qmin=qmin, 891 qmax=qmax) 892 fitter.select_problem_for_fit(id=fit_id, value=1) 893 fitter_list.append(fitter) 894 fit_id += 1 895 value.clear_model_param() 890 data = fitproblem.get_fit_data() 891 model = fitproblem.get_model() 892 smearer = fitproblem.get_smearer() 893 qmin, qmax = fitproblem.get_range() 894 #Extra list of parameters and their constraints 895 listOfConstraint = [] 896 param = fitproblem.get_model_param() 897 if len(param) > 0: 898 for item in param: 899 ## check if constraint 900 if item[0] != None and item[1] != None: 901 listOfConstraint.append((item[0],item[1])) 902 fitter.set_model(model, fit_id, pars, constraints=listOfConstraint) 903 fitter.set_data(data=data, id=fit_id, smearer=smearer, qmin=qmin, 904 qmax=qmax) 905 fitter.select_problem_for_fit(id=fit_id, value=1) 906 896 907 897 908 def _onSelect(self,event): … … 1022 1033 :param elapsed: time spent at the fitting level 1023 1034 """ 1024 result = result[0] 1035 result = result[0] 1025 1036 self.fit_thread_list = {} 1026 1037 if page_id is None: -
fittingview/src/sans/perspectives/fitting/simfitpage.py
rc647377 r922497f 52 52 ##Font size 53 53 self.SetWindowVariant(variant = FONT_VARIANT) 54 self.uid = None54 self.uid = wx.NewId() 55 55 self.parent = parent 56 56 ## store page_finder … … 128 128 break 129 129 130 def onFit(self, event):130 def onFit(self, event): 131 131 """ 132 132 signal for fitting … … 143 143 if item[0].GetValue(): 144 144 self.manager.schedule_for_fit(value=1, uid=item[2]) 145 self.manager.onFit( None)145 self.manager.onFit(uid=self.uid) 146 146 else: 147 147 msg= "Select at least one model to fit "
Note: See TracChangeset
for help on using the changeset viewer.