Changeset dc613d6 in sasview
- Timestamp:
- Jun 15, 2011 3:44:29 PM (14 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:
- 2446b66
- Parents:
- dfb6d38
- Location:
- sansview/perspectives/fitting
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/fitpage.py
r1180528 rdc613d6 952 952 Allow to fit 953 953 """ 954 if len(self.parent._manager.fit_thread_list)>0 and\ 955 self.parent._manager._fit_engine != "park": 956 msg = "The FitEnging will be set to 'ParkMC'\n" 957 msg += " to fit with more than one data set..." 958 wx.MessageBox(msg, 'Info') 959 #wx.PostEvent(self._manager.parent, StatusEvent(status=\ 960 # "Fitting: %s"%msg)) 961 954 962 if self.data is None: 955 963 msg = "Please get Data first..." … … 989 997 self.qmin_x = float(self.qmin.GetValue()) 990 998 self.qmax_x = float( self.qmax.GetValue()) 991 self._manager._reset_schedule_problem(value=0 )999 self._manager._reset_schedule_problem(value=0, uid=self.uid) 992 1000 self._manager.schedule_for_fit(uid=self.uid,value=1, fitproblem =None) 993 1001 self._manager.set_fit_range(uid=self.uid,qmin= self.qmin_x, … … 995 1003 996 1004 #single fit 997 self._manager.onFit( )1005 self._manager.onFit(uid=self.uid) 998 1006 self.btFit.SetLabel("Stop") 999 1007 self.bind_fit_button() -
sansview/perspectives/fitting/fitting.py
rdfb6d38 rdc613d6 34 34 from sans.guiframe.plugin_base import PluginBase 35 35 36 from .console import ConsoleUpdate36 #from .console import ConsoleUpdate 37 37 from .fitproblem import FitProblem 38 38 from .fitpanel import FitPanel … … 563 563 update_chisqr=update_chisqr) 564 564 565 def onFit(self ):565 def onFit(self, uid=None): 566 566 """ 567 567 perform fit 568 """ 568 569 : param type: uid for single fit, None for simultaneous fit 570 """ 571 from sans.fit.Fitting import Fit 569 572 from .fit_thread import FitThread 573 from .console import ConsoleUpdate 570 574 ## count the number of fitproblem schedule to fit 575 #if uid == None or self._fit_engine == "park": 571 576 fitproblem_count = 0 572 577 for value in self.page_finder.values(): … … 575 580 576 581 ## if simultaneous fit change automatically the engine to park 577 if fitproblem_count > 1: 582 # scipy can not handle two thread running at the same time 583 if fitproblem_count > 1 or len(self.fit_thread_list)>0: 578 584 self._on_change_engine(engine='park') 579 585 580 586 self.fitproblem_count = fitproblem_count 581 582 from sans.fit.Fitting import Fit 587 583 588 fitter = Fit(self._fit_engine) 584 585 589 if self._fit_engine == "park": 586 590 engineType = "Simultaneous Fit" … … 592 596 list_page_id = [] 593 597 for page_id, value in self.page_finder.iteritems(): 598 # For simulfit (uid give with None), do for-loop 599 # if uid is specified (singlefit), do it only on the page. 600 if engineType == "Single Fit": 601 if page_id != uid: 602 continue 594 603 try: 595 604 if value.get_scheduled() == 1: … … 651 660 completefn=self._simul_fit_completed, 652 661 ftol=self.ftol) 662 653 663 self.fit_thread_list[current_page_id] = calc_fit 654 664 time.sleep(0.3) … … 817 827 break 818 828 819 def _reset_schedule_problem(self, value=0 ):829 def _reset_schedule_problem(self, value=0, uid=None): 820 830 """ 821 831 unschedule or schedule all fitproblem to be fit 822 832 """ 823 for page_id in self.page_finder.keys(): 824 self.page_finder[page_id].schedule_tofit(value) 825 833 # case that uid is not specified 834 if uid == None: 835 for page_id in self.page_finder.keys(): 836 self.page_finder[page_id].schedule_tofit(value) 837 # when uid is given 838 else: 839 self.page_finder[uid].schedule_tofit(value) 840 826 841 def _fit_helper(self, pars, value, fitproblem_id,fitter, title="Single Fit " ): 827 842 """ … … 897 912 898 913 """ 914 del self.fit_thread_list[page_id[0]] 899 915 time.sleep(0.2) 900 916 try: … … 917 933 self._update_fit_button(page_id) 918 934 return 935 919 936 for uid in page_id: 920 937 value = self.page_finder[uid] … … 962 979 963 980 """ 981 self.fit_thread_list = {} 964 982 if page_id is None: 965 983 page_id = [] … … 1114 1132 ## send the current engine type to fitpanel 1115 1133 self.fit_panel._on_engine_change(name=self._fit_engine) 1134 1116 1135 1117 1136 def _on_model_panel(self, evt): -
sansview/perspectives/fitting/simfitpage.py
r4bd492f rdc613d6 52 52 ##Font size 53 53 self.SetWindowVariant(variant = FONT_VARIANT) 54 self. id = None54 self.uid = None 55 55 self.parent = parent 56 56 ## store page_finder … … 67 67 ## number of constraint 68 68 self.nb_constraint= 0 69 self. id = wx.NewId()69 self.uid = wx.NewId() 70 70 ## draw page 71 71 self.define_page_structure() … … 146 146 for item in self.model_list: 147 147 if item[0].GetValue(): 148 self.manager.schedule_for_fit( value=1, fitproblem =item[1])149 self.manager.onFit( )148 self.manager.schedule_for_fit( value=1, fitproblem =item[1]) 149 self.manager.onFit(None) 150 150 else: 151 151 msg= "Select at least one model to fit "
Note: See TracChangeset
for help on using the changeset viewer.