Changeset 72c969b in sasview for src/sans/perspectives
- Timestamp:
- Sep 8, 2014 5:57:17 AM (10 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:
- 1792311
- Parents:
- a9807efa (diff), 5b1392f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- src/sans/perspectives/fitting
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sans/perspectives/fitting/basepage.py
r116e1a7 rbf5e985 96 96 self.num_points = None 97 97 ## default fitengine type 98 self.engine_type = ' scipy'98 self.engine_type = 'bumps' 99 99 ## smear default 100 100 self.current_smearer = None … … 835 835 infor = "warning" 836 836 else: 837 msg = "Error was occured"838 msg += " :No valid parameter values to paste from the clipboard..."837 msg = "Error occured: " 838 msg += "No valid parameter values to paste from the clipboard..." 839 839 infor = "error" 840 840 wx.PostEvent(self._manager.parent, … … 2183 2183 else: 2184 2184 tcrtl.SetBackgroundColour("pink") 2185 msg = "Model Error: wrong value entered: %s" % sys.exc_value2185 msg = "Model Error: wrong value entered: %s" % sys.exc_value 2186 2186 wx.PostEvent(self.parent, StatusEvent(status=msg)) 2187 2187 return 2188 2188 except: 2189 2189 tcrtl.SetBackgroundColour("pink") 2190 msg = "Model Error: wrong value entered: %s" % sys.exc_value2190 msg = "Model Error: wrong value entered: %s" % sys.exc_value 2191 2191 wx.PostEvent(self.parent, StatusEvent(status=msg)) 2192 2192 return … … 2199 2199 #is_modified = True 2200 2200 else: 2201 msg = "Cannot Plot :No npts in that Qrange!!! "2201 msg = "Cannot plot: No points in Q range!!! " 2202 2202 wx.PostEvent(self.parent, StatusEvent(status=msg)) 2203 2203 else: 2204 2204 tcrtl.SetBackgroundColour("pink") 2205 msg = "Model Error: wrong value entered!!!"2205 msg = "Model Error: wrong value entered!!!" 2206 2206 wx.PostEvent(self.parent, StatusEvent(status=msg)) 2207 2207 self.save_current_state() … … 2240 2240 else: 2241 2241 tcrtl.SetBackgroundColour("pink") 2242 msg = "Model Error: wrong value entered: %s" % sys.exc_value2242 msg = "Model Error: wrong value entered: %s" % sys.exc_value 2243 2243 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 2244 2244 return 2245 2245 except: 2246 2246 tcrtl.SetBackgroundColour("pink") 2247 msg = "Model Error: wrong value entered: %s" % sys.exc_value2247 msg = "Model Error: wrong value entered: %s" % sys.exc_value 2248 2248 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 2249 2249 return … … 2256 2256 is_modified = True 2257 2257 else: 2258 msg = "Cannot Plot :No npts in that Qrange!!! "2258 msg = "Cannot Plot: No points in Q range!!! " 2259 2259 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 2260 2260 else: 2261 2261 tcrtl.SetBackgroundColour("pink") 2262 msg = "Model Error: wrong value entered!!!"2262 msg = "Model Error: wrong value entered!!!" 2263 2263 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 2264 2264 self.save_current_state() … … 2431 2431 self.qmax.SetBackgroundColour("pink") 2432 2432 self.qmax.Refresh() 2433 msg = " Npts of Data Error :"2434 msg += " No or too little npts of%s." % data.name2433 msg = "Data Error: " 2434 msg += "Too few points in %s." % data.name 2435 2435 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 2436 2436 self.fitrange = False … … 2466 2466 self.qmax.SetBackgroundColour("pink") 2467 2467 self.qmax.Refresh() 2468 msg = " Npts of Data Error :"2469 msg += " No or too little npts of%s." % data.name2468 msg = "Data Error: " 2469 msg += "Too few points in %s." % data.name 2470 2470 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 2471 2471 self.fitrange = False … … 2518 2518 2519 2519 except: 2520 msg = "Wrong Fit parameter range entered"2520 msg = "Wrong fit parameter range entered" 2521 2521 wx.PostEvent(self._manager.parent, 2522 2522 StatusEvent(status=msg)) … … 2986 2986 self.qmin.SetValue(str(self.qmin_x)) 2987 2987 self.qmax.SetValue(str(self.qmax_x)) 2988 self.s et_npts2fit()2988 self.show_npts2fit() 2989 2989 # At this point, some button and variables satatus (disabled?) 2990 2990 # should be checked such as color that should be reset to … … 3874 3874 to fit if implemented 3875 3875 """ 3876 def s et_npts2fit(self):3876 def show_npts2fit(self): 3877 3877 """ 3878 3878 setValue Npts for fitting if implemented -
src/sans/perspectives/fitting/console.py
r5777106 r35086c3 5 5 import time 6 6 import wx 7 import park 8 from park.fitresult import FitHandler 7 from sans.fit import FitHandler 9 8 10 9 class ConsoleUpdate(FitHandler): … … 88 87 Print result object 89 88 """ 90 msg = " \n %s \n" % s elf.result.__str__()89 msg = " \n %s \n" % str(self.result) 91 90 wx.PostEvent(self.parent, StatusEvent(status=msg)) 92 91 … … 129 128 130 129 131 def update_fit(self, msg="",last=False):130 def update_fit(self, last=False): 132 131 """ 133 132 """ … … 136 135 self.update_duration = t1 137 136 self.fit_duration += self.elapsed_time 138 str_time = time.strftime("% a, %d %b %Y%H:%M:%S ", time.localtime(t1))139 UPDATE_INTERVAL = 0.5137 str_time = time.strftime("%Y-%m-%d %H:%M:%S ", time.localtime(t1)) 138 UPDATE_INTERVAL = 5.0 140 139 u_flag = False 141 140 if self.fit_duration >= UPDATE_INTERVAL: 142 141 self.fit_duration = 0 143 142 u_flag = True 144 if not last: 145 msg += "Fit Updates ... %s \n" % str_time 146 else: 147 msg += "Final updates ........." 143 msg = str_time 148 144 if u_flag or last: 149 145 if self.result is not None: … … 164 160 msg += str(self.result) 165 161 msg += "\n" 166 if not last:167 msg += "About %s s elapsed......... \n" % \168 str (UPDATE_INTERVAL)169 162 else: 170 163 msg += "No result available\n" -
src/sans/perspectives/fitting/fit_thread.py
ra855fec re3efa6b3 18 18 19 19 def __init__(self, 20 21 22 23 24 batch_inputs=None,25 20 fn, 21 page_id, 22 handler, 23 batch_outputs, 24 batch_inputs=None, 25 pars=None, 26 26 completefn = None, 27 27 updatefn = None, … … 30 30 ftol = None, 31 31 reset_flag = False): 32 CalcThread.__init__(self,completefn, 32 CalcThread.__init__(self, 33 completefn, 33 34 updatefn, 34 35 yieldtime, … … 80 81 list_map_get_attr.append(map_getattr) 81 82 #from multiprocessing import Pool 82 inputs = zip(list_map_get_attr, self.fitter, list_fit_function,83 83 inputs = zip(list_map_get_attr, self.fitter, list_fit_function, 84 list_q, list_q, list_handler,list_curr_thread,list_ftol, 84 85 list_reset_flag) 85 86 result = map(map_apply, inputs) … … 87 88 self.complete(result=result, 88 89 batch_inputs=self.batch_inputs, 89 90 batch_outputs=self.batch_outputs, 90 91 page_id=self.page_id, 91 92 pars = self.pars, -
src/sans/perspectives/fitting/fitpage.py
rd44648e rbf5e985 661 661 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 662 662 663 if self.engine_type == "park": 664 self.text_disp_max.Show(True) 665 self.text_disp_min.Show(True) 663 self.text_disp_max.Show(True) 664 self.text_disp_min.Show(True) 666 665 667 666 for item in self.model.dispersion.keys(): … … 738 737 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 739 738 740 if self.engine_type == "park": 741 ctl3.Show(True) 742 ctl4.Show(True) 739 ctl3.Show(True) 740 ctl4.Show(True) 743 741 744 742 elif p == "npts": … … 1005 1003 return 1006 1004 1007 if len(self._manager.fit_thread_list) > 0 and\1008 self._manager._fit_engine != "park" and\1009 self._manager.sim_page != None and \1010 self._manager.sim_page.uid == self.uid:1005 if (len(self._manager.fit_thread_list) > 0 1006 and self._manager._fit_engine not in ("park","bumps") 1007 and self._manager.sim_page != None 1008 and self._manager.sim_page.uid == self.uid): 1011 1009 msg = "The FitEnging will be set to 'ParkMC'\n" 1012 1010 msg += " to fit with more than one data set..." … … 1268 1266 if check_float(tcrtl): 1269 1267 flag = self._onparamEnter_helper() 1270 self.s et_npts2fit()1268 self.show_npts2fit() 1271 1269 if self.fitrange: 1272 1270 temp_smearer = None … … 1468 1466 #self.data.mask = index_data 1469 1467 #self.Npts_fit.SetValue(str(len(self.data.mask))) 1470 self.s et_npts2fit()1468 self.show_npts2fit() 1471 1469 else: 1472 1470 index_data = ((self.qmin_x <= self.data.x) & \ … … 1766 1764 # try re draw the model plot if it exists 1767 1765 self._draw_model() 1768 self.s et_npts2fit()1766 self.show_npts2fit() 1769 1767 elif self.model == None: 1770 1768 self.panel.MakeModal(False) 1771 1769 event.Skip() 1772 self.s et_npts2fit()1770 self.show_npts2fit() 1773 1771 msg = "No model is found on updating MASK in the model plot... " 1774 1772 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) … … 2056 2054 return npts2fit 2057 2055 2058 def s et_npts2fit(self):2056 def show_npts2fit(self): 2059 2057 """ 2060 2058 setValue Npts for fitting … … 2068 2066 return self.tcChi.GetValue() 2069 2067 2070 def get_param_list(self):2071 """2072 :return self.param_toFit: list containing references to TextCtrl2073 checked.Theses TextCtrl will allow reference to parameters to fit.2074 2075 :raise: if return an empty list of parameter fit will nnote work2076 properly so raise ValueError,"missing parameter to fit"2077 """2078 if self.param_toFit != []:2079 return self.param_toFit2080 else:2081 msg = "missing parameters to fit"2082 wx.MessageBox(msg, 'warning')2083 return False2084 2085 2068 def onsetValues(self, chisqr, p_name, out, cov): 2086 2069 """ … … 2108 2091 if chisqr != None and numpy.isfinite(chisqr): 2109 2092 #format chi2 2110 if self.engine_type == "park":2111 npt_fit = float(self.get_npts2fit())2112 2093 chi2 = format_number(chisqr, True) 2113 2094 self.tcChi.SetValue(chi2) -
src/sans/perspectives/fitting/fitpanel.py
rb6a181b reff93b8 64 64 self.sim_page = None 65 65 self.batch_page = None 66 self.fit_engine_type = " scipy"66 self.fit_engine_type = "bumps" 67 67 ## get the state of a page 68 68 self.Bind(basepage.EVT_PAGE_INFO, self._onGetstate) -
src/sans/perspectives/fitting/fitproblem.py
r5777106 r5bf0331 454 454 return self.itervalues() 455 455 456 def 456 def set_result(self, result, fid): 457 457 """ 458 458 """ -
src/sans/perspectives/fitting/fitting.py
r9afebe1 ra9807efa 36 36 from .fitproblem import FitProblemDictionary 37 37 from .fitpanel import FitPanel 38 from .resultpanel import ResultPanel, PlotResultEvent 39 38 40 from .fit_thread import FitThread 39 41 from .pagestate import Reader … … 42 44 from sans.perspectives.calculator.model_editor import EditorWindow 43 45 from sans.guiframe.gui_manager import MDIFrame 46 47 # TODO: remove globals from interface to bumps options! 48 # Default bumps to use the levenberg-marquardt optimizer 49 import bumps.fitters 50 bumps.fitters.FIT_DEFAULT = 'lm' 44 51 45 52 MAX_NBR_DATA = 4 … … 78 85 # Start with a good default 79 86 self.elapsed = 0.022 80 # the type of optimizer selected, park or scipy81 self.fitter = None82 87 self.fit_panel = None 83 #let fit ready84 self.fitproblem_count = None85 88 #Flag to let the plug-in know that it is running stand alone 86 89 self.standalone = True … … 88 91 self.closed_page_dict = {} 89 92 ## Fit engine 90 self._fit_engine = ' scipy'93 self._fit_engine = 'bumps' 91 94 self._gui_engine = None 92 95 ## Relative error desired in the sum of squares (float); scipy only … … 111 114 self.scipy_id = wx.NewId() 112 115 self.park_id = wx.NewId() 116 self.bumps_id = wx.NewId() 113 117 self.menu1 = None 114 118 self.new_model_frame = None … … 198 202 wx.EVT_MENU(owner, self.park_id, self._onset_engine_park) 199 203 200 self.menu1.FindItemById(self.scipy_id).Check(True) 201 self.menu1.FindItemById(self.park_id).Check(False) 204 bumps_help = "Bumps: fitting and uncertainty analysis. More in Help window...." 205 self.menu1.AppendCheckItem(self.bumps_id, "Bumps fit", 206 bumps_help) 207 wx.EVT_MENU(owner, self.bumps_id, self._onset_engine_bumps) 208 209 self.menu1.FindItemById(self.scipy_id).Check(self._fit_engine=="scipy") 210 self.menu1.FindItemById(self.park_id).Check(self._fit_engine=="park") 211 self.menu1.FindItemById(self.bumps_id).Check(self._fit_engine=="bumps") 202 212 self.menu1.AppendSeparator() 203 213 self.id_tol = wx.NewId() … … 207 217 ftol_help) 208 218 wx.EVT_MENU(owner, self.id_tol, self.show_ftol_dialog) 219 220 self.id_bumps_options = wx.NewId() 221 bopts_help = "Bumps fitting options" 222 self.menu1.Append(self.id_bumps_options, 'Bumps &Options', bopts_help) 223 wx.EVT_MENU(owner, self.id_bumps_options, self.on_bumps_options) 224 self.bumps_options_menu = self.menu1.FindItemById(self.id_bumps_options) 225 self.bumps_options_menu.Enable(True) 226 227 self.id_result_panel = wx.NewId() 228 self.menu1.Append(self.id_result_panel, "Fit Results", "Show fit results panel") 229 wx.EVT_MENU(owner, self.id_result_panel, lambda ev: self.result_frame.Show()) 209 230 self.menu1.AppendSeparator() 210 231 … … 511 532 self.perspective = [] 512 533 self.perspective.append(self.fit_panel.window_name) 534 535 self.result_frame = MDIFrame(self.parent, None, ResultPanel.window_caption, (220, 200)) 536 self.result_panel = ResultPanel(parent=self.result_frame, manager=self) 537 self.perspective.append(self.result_panel.window_name) 513 538 514 539 #index number to create random model name … … 525 550 #Send the fitting panel to guiframe 526 551 self.mypanels.append(self.fit_panel) 552 self.mypanels.append(self.result_panel) 527 553 return self.mypanels 528 554 … … 818 844 StatusEvent(status=msg, info='warning')) 819 845 dialog.Destroy() 846 847 def on_bumps_options(self, event=None): 848 from bumps.gui.fit_dialog import OpenFitOptions 849 OpenFitOptions() 820 850 821 851 def stop_fit(self, uid): … … 951 981 :param uid: id related to the panel currently calling this fit function. 952 982 """ 953 flag = True 954 ## count the number of fitproblem schedule to fit 955 fitproblem_count = 0 956 for value in self.page_finder.values(): 957 if value.get_scheduled() == 1: 958 fitproblem_count += 1 959 self._gui_engine = self._return_engine_type() 960 self.fitproblem_count = fitproblem_count 961 if self._fit_engine == "park": 962 engineType = "Simultaneous Fit" 983 if uid is None: raise RuntimeError("no page to fit") # Should never happen 984 985 # Remember the user selected fit engine before the fit. Simultaneous 986 # fitting may change the selected engine, so it needs to be restored 987 # when the fit is complete. 988 self._gui_engine = self._fit_engine 989 990 sim_page_uid = getattr(self.sim_page, 'uid', None) 991 batch_page_uid = getattr(self.batch_page, 'uid', None) 992 993 if uid == sim_page_uid: 994 fit_type = 'simultaneous' 995 elif uid == batch_page_uid: 996 fit_type = 'combined_batch' 963 997 else: 964 engineType = "Single Fit" 998 fit_type = 'single' 999 1000 # if constrained fit, don't use scipy leastsq directly 1001 if fit_type == 'simultaneous': 1002 if self._fit_engine not in ("park","bumps"): 1003 self._on_change_engine(engine='bumps') 1004 1005 965 1006 fitter_list = [] 966 1007 sim_fitter = None 967 is_single_fit = True 968 batch_on = False 969 if self.sim_page is not None and self.sim_page.uid == uid: 1008 if fit_type == 'simultaneous': 970 1009 #simulatanous fit only one engine need to be created 971 ## if simultaneous fit change automatically the engine to park972 self._on_change_engine(engine='park')973 1010 sim_fitter = Fit(self._fit_engine) 974 1011 sim_fitter.fitter_id = self.sim_page.uid 975 1012 fitter_list.append(sim_fitter) 976 is_single_fit = False 977 batch_on = self.sim_page.batch_on 978 979 self.fitproblem_count = fitproblem_count 980 if self._fit_engine == "park": 981 engineType = "Simultaneous Fit" 982 else: 983 engineType = "Single Fit" 984 1013 985 1014 self.current_pg = None 986 1015 list_page_id = [] 987 1016 fit_id = 0 988 batch_inputs = {} 989 batch_outputs = {} 990 for page_id, value in self.page_finder.iteritems(): 1017 for page_id, page_info in self.page_finder.iteritems(): 991 1018 # For simulfit (uid give with None), do for-loop 992 1019 # if uid is specified (singlefit), do it only on the page. 993 if engineType == "Single Fit": 994 #combine more than 1 batch page on single mode 995 if self.batch_page is None or self.batch_page.uid != uid: 996 if page_id != uid: 997 continue 1020 if page_id in (sim_page_uid, batch_page_uid): continue 1021 if fit_type == "single" and page_id != uid: continue 1022 998 1023 try: 999 if value.get_scheduled() == 1: 1000 value.nbr_residuals_computed = 0 1001 #Get list of parameters name to fit 1002 pars = [] 1003 templist = [] 1024 if page_info.get_scheduled() == 1: 1025 page_info.nbr_residuals_computed = 0 1004 1026 page = self.fit_panel.get_page_by_id(page_id) 1005 1027 self.set_fit_weight(uid=page.uid, 1006 1028 flag=page.get_weight_flag(), 1007 1029 is2d=page._is_2D()) 1008 templist = page.get_param_list() 1009 flag = page._update_paramv_on_fit() 1010 if not flag: 1030 if not page.param_toFit: 1031 msg = "No fitting parameters for %s"%page.window_caption 1032 wx.PostEvent(page.parent.parent, 1033 StatusEvent(status=msg, info="error", 1034 type="stop")) 1035 return False 1036 if not page._update_paramv_on_fit(): 1011 1037 msg = "Fitting range or parameter values are" 1012 1038 msg += " invalid in %s" % \ … … 1015 1041 StatusEvent(status=msg, info="error", 1016 1042 type="stop")) 1017 return flag 1018 for element in templist: 1019 name = str(element[1]) 1020 pars.append(name) 1021 fitproblem_list = value.values() 1043 return False 1044 1045 pars = [str(element[1]) for element in page.param_toFit] 1046 fitproblem_list = page_info.values() 1022 1047 for fitproblem in fitproblem_list: 1023 1048 if sim_fitter is None: 1024 1049 fitter = Fit(self._fit_engine) 1025 1050 fitter.fitter_id = page_id 1026 self._fit_helper(fitproblem=fitproblem,1027 pars=pars,1028 fitter=fitter,1029 fit_id=fit_id,1030 batch_inputs=batch_inputs,1031 batch_outputs=batch_outputs)1032 1051 fitter_list.append(fitter) 1033 1052 else: 1034 1053 fitter = sim_fitter 1035 self._fit_helper(fitproblem=fitproblem,1054 self._add_problem_to_fit(fitproblem=fitproblem, 1036 1055 pars=pars, 1037 1056 fitter=fitter, 1038 fit_id=fit_id, 1039 batch_inputs=batch_inputs, 1040 batch_outputs=batch_outputs) 1057 fit_id=fit_id) 1041 1058 fit_id += 1 1042 1059 list_page_id.append(page_id) 1043 current_page_id = page_id 1044 value.clear_model_param() 1060 page_info.clear_model_param() 1045 1061 except KeyboardInterrupt: 1046 flag = True1047 1062 msg = "Fitting terminated" 1048 1063 wx.PostEvent(self.parent, StatusEvent(status=msg, info="info", 1049 1064 type="stop")) 1050 return flag1065 return True 1051 1066 except: 1052 flag = False 1053 msg = "%s error: %s" % (engineType, sys.exc_value) 1067 msg = "Fitting error: %s" % str(sys.exc_value) 1054 1068 wx.PostEvent(self.parent, StatusEvent(status=msg, info="error", 1055 1069 type="stop")) 1056 return flag1070 return False 1057 1071 ## If a thread is already started, stop it 1058 1072 #if self.calc_fit!= None and self.calc_fit.isrunning(): … … 1066 1080 improvement_delta=0.1) 1067 1081 self._mac_sleep(0.2) 1068 ## perform single fit 1069 try: 1082 1083 # batch fit 1084 batch_inputs = {} 1085 batch_outputs = {} 1086 if fit_type == "simultaneous": 1087 page = self.sim_page 1088 elif fit_type == "combined_batch": 1089 page = self.batch_page 1090 else: 1070 1091 page = self.fit_panel.get_page_by_id(uid) 1071 batch_on = page.batch_on 1072 except: 1073 try: 1074 #if the id cannot be found then we deal with a self.sim_page 1075 #or a self.batch_page 1076 if self.sim_page is not None and uid == self.sim_page.uid: 1077 batch_on = self.sim_page.batch_on 1078 if self.batch_page is not None and uid == self.batch_page.uid: 1079 batch_on = self.batch_page.batch_on 1080 except: 1081 batch_on = False 1082 1083 # batch fit 1084 if batch_on: 1092 if page.batch_on: 1085 1093 calc_fit = FitThread(handler=handler, 1086 1094 fn=fitter_list, … … 1093 1101 reset_flag=self.batch_reset_flag) 1094 1102 else: 1095 # single fit: not batch and not simul fit1096 if not is_single_fit:1097 current_page_id = self.sim_page.uid1098 1103 ## Perform more than 1 fit at the time 1099 1104 calc_fit = FitThread(handler=handler, … … 1105 1110 completefn=self._fit_completed, 1106 1111 ftol=self.ftol) 1107 self.fit_thread_list[current_page_id] = calc_fit 1112 #self.fit_thread_list[current_page_id] = calc_fit 1113 self.fit_thread_list[uid] = calc_fit 1108 1114 calc_fit.queue() 1115 calc_fit.ready(2.5) 1109 1116 msg = "Fitting is in progress..." 1110 1117 wx.PostEvent(self.parent, StatusEvent(status=msg, type="progress")) 1111 1118 1112 self.ready_fit(calc_fit=calc_fit) 1113 return flag 1114 1115 def ready_fit(self, calc_fit): 1116 """ 1117 Ready for another fit 1118 """ 1119 if self.fitproblem_count != None and self.fitproblem_count > 1: 1120 calc_fit.ready(2.5) 1121 else: 1122 time.sleep(0.4) 1123 1119 return True 1120 1124 1121 def remove_plot(self, uid, fid=None, theory=False): 1125 1122 """ … … 1261 1258 self.page_finder[uid].schedule_tofit(value) 1262 1259 1263 def _fit_helper(self, fitproblem, pars, fitter, fit_id, 1264 batch_inputs, batch_outputs): 1260 def _add_problem_to_fit(self, fitproblem, pars, fitter, fit_id): 1265 1261 """ 1266 1262 Create and set fit engine with series of data and model … … 1571 1567 wx.PostEvent(self.parent, StatusEvent(status=msg, info="info", 1572 1568 type="stop")) 1569 wx.PostEvent(self.result_panel, PlotResultEvent(result=result)) 1573 1570 # reset fit_engine if changed by simul_fit 1574 1571 if self._fit_engine != self._gui_engine: … … 1682 1679 self._on_change_engine('scipy') 1683 1680 1681 def _onset_engine_bumps(self, event): 1682 """ 1683 set engine to bumps 1684 """ 1685 self._on_change_engine('bumps') 1686 1684 1687 def _on_slicer_event(self, event): 1685 1688 """ … … 1714 1717 break 1715 1718 1716 def _return_engine_type(self):1717 """1718 return the current type of engine1719 """1720 return self._fit_engine1721 1722 1719 def _on_change_engine(self, engine='park'): 1723 1720 """ … … 1733 1730 self.menu1.FindItemById(self.park_id).Check(True) 1734 1731 self.menu1.FindItemById(self.scipy_id).Check(False) 1732 self.menu1.FindItemById(self.bumps_id).Check(False) 1733 elif engine == "scipy": 1734 self.menu1.FindItemById(self.park_id).Check(False) 1735 self.menu1.FindItemById(self.scipy_id).Check(True) 1736 self.menu1.FindItemById(self.bumps_id).Check(False) 1735 1737 else: 1736 1738 self.menu1.FindItemById(self.park_id).Check(False) 1737 self.menu1.FindItemById(self.scipy_id).Check(True) 1739 self.menu1.FindItemById(self.scipy_id).Check(False) 1740 self.menu1.FindItemById(self.bumps_id).Check(True) 1738 1741 ## post a message to status bar 1739 1742 msg = "Engine set to: %s" % self._fit_engine -
src/sans/perspectives/fitting/simfitpage.py
r5777106 rbf5e985 138 138 self.Layout() 139 139 break 140 self._onAdd_constraint(None) 140 141 #self._onAdd_constraint(None) 141 142 142 143 def onFit(self, event): … … 152 153 ## making sure all parameters content a constraint 153 154 ## validity of the constraint expression is own by fit engine 154 if self.parent._manager._fit_engine != "park"and flag:155 if self.parent._manager._fit_engine not in ("park","bumps") and flag: 155 156 msg = "The FitEnging will be set to 'Park' fit engine\n" 156 157 msg += " for the simultaneous fit..." … … 378 379 box_description = wx.StaticBox(self, -1,"Easy Setup ") 379 380 boxsizer = wx.StaticBoxSizer(box_description, wx.HORIZONTAL) 380 sizer_constraint = wx.BoxSizer(wx.HORIZONTAL |wx.LEFT|wx.RIGHT|wx.EXPAND)381 sizer_constraint = wx.BoxSizer(wx.HORIZONTAL) 381 382 self.model_cbox_left = wx.ComboBox(self, -1, style=wx.CB_READONLY) 382 383 self.model_cbox_left.Clear() … … 814 815 815 816 for fid in self.page_finder[id].iterkeys(): 816 self.page_finder[id].set_model_param(param, 817 constraint, fid=fid) 817 # wrap in param/constraint in str() to remove unicode 818 self.page_finder[id].set_model_param(str(param), 819 str(constraint), fid=fid) 818 820 break 819 821 return True
Note: See TracChangeset
for help on using the changeset viewer.