Changeset acf8e4a5 in sasview for src/sas/perspectives/fitting
- Timestamp:
- Mar 31, 2015 9:52:01 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:
- 4342107f, c971c98
- Parents:
- 6987c8a
- Location:
- src/sas/perspectives/fitting
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/perspectives/fitting/basepage.py
r5ce7f17 racf8e4a5 98 98 self.npts = None 99 99 self.num_points = None 100 ## default fitengine type101 self.engine_type = 'bumps'102 100 ## smear default 103 101 self.current_smearer = None … … 947 945 Store current state 948 946 """ 949 self.state.engine_type = copy.deepcopy(self.engine_type)950 947 ## save model option 951 948 if self.model != None: … … 1045 1042 self.state.disp_list = copy.deepcopy(self.disp_list) 1046 1043 self.state.model = self.model.clone() 1047 if hasattr(self, "engine_type"):1048 self.state.engine_type = copy.deepcopy(self.engine_type)1049 1044 1050 1045 self.state.enable2D = copy.deepcopy(self.enable2D) … … 1299 1294 # Backward compatibility (for older state files) 1300 1295 self.magnetic_on = False 1301 self.engine_type = state.engine_type1302 1296 1303 1297 self.disp_cb_dict = state.disp_cb_dict … … 1355 1349 self.multifactorbox.SetSelection(state.multi_factor) 1356 1350 1357 #reset the fitting engine type 1358 self.engine_type = state.engine_type 1359 #draw the pnael according to the new model parameter 1351 #draw the panel according to the new model parameter 1360 1352 self._on_select_model(event=None) 1361 1353 -
src/sas/perspectives/fitting/fitpage.py
r682c432 racf8e4a5 183 183 return True 184 184 return False 185 186 def _on_engine_change(self, name):187 """188 get the current name of the fit engine type189 and update the panel accordingly190 """191 192 self.engine_type = str(name)193 self.state.engine_type = self.engine_type194 if not self.is_mac:195 if len(self.parameters) == 0:196 self.Layout()197 return198 self.Layout()199 self.Refresh()200 185 201 186 def _fill_range_sizer(self): … … 2834 2819 self.SetupScrolling() 2835 2820 return 2836 ## the panel is drawn using the current value of the fit engine2837 if self.engine_type == None and self._manager != None:2838 self.engine_type = self._manager._return_engine_type()2839 2821 2840 2822 box_description = wx.StaticBox(self, -1, str("Model Parameters")) -
src/sas/perspectives/fitting/fitpanel.py
r2f4b430 racf8e4a5 64 64 self.sim_page = None 65 65 self.batch_page = None 66 self.fit_engine_type = "bumps"67 66 ## get the state of a page 68 67 self.Bind(basepage.EVT_PAGE_INFO, self._onGetstate) -
src/sas/perspectives/fitting/fitting.py
ra3f125f0 racf8e4a5 32 32 from sas.guiframe.plugin_base import PluginBase 33 33 from sas.guiframe.data_processor import BatchCell 34 from sas.fit. Fitting importFit34 from sas.fit.BumpsFitting import BumpsFit as Fit 35 35 from sas.perspectives.fitting.console import ConsoleUpdate 36 36 from sas.perspectives.fitting.fitproblem import FitProblemDictionary … … 84 84 ## dictionary of page closed and id 85 85 self.closed_page_dict = {} 86 ## Fit engine87 self._fit_engine = 'bumps'88 self._gui_engine = None89 86 ## Relative error desired in the sum of squares (float) 90 87 self.batch_reset_flag = True … … 751 748 def stop_fit(self, uid): 752 749 """ 753 Stop the fit engine750 Stop the fit 754 751 """ 755 752 if uid in self.fit_thread_list.keys(): … … 877 874 """ 878 875 Get series of data, model, associates parameters and range and send then 879 to series of fit engines. Fit data and model, display result to876 to series of fitters. Fit data and model, display result to 880 877 corresponding panels. 881 878 :param uid: id related to the panel currently calling this fit function. … … 896 893 sim_fitter = None 897 894 if fit_type == 'simultaneous': 898 # simulatanous fit only one engine need to be created899 sim_fitter = Fit( self._fit_engine)895 # for simultaneous fitting only one fitter is needed 896 sim_fitter = Fit() 900 897 sim_fitter.fitter_id = self.sim_page.uid 901 898 fitter_list.append(sim_fitter) … … 936 933 for fitproblem in fitproblem_list: 937 934 if sim_fitter is None: 938 fitter = Fit( self._fit_engine)935 fitter = Fit() 939 936 fitter.fitter_id = page_id 940 937 fitter_list.append(fitter) … … 965 962 wx.PostEvent(self.parent, StatusEvent(status=msg, type="progress")) 966 963 967 #Handler used for fit engine displayedmessage964 #Handler used to display fit message 968 965 handler = ConsoleUpdate(parent=self.parent, 969 966 manager=self, … … 1148 1145 def _add_problem_to_fit(self, fitproblem, pars, fitter, fit_id): 1149 1146 """ 1150 Create and set fit engine with series of data and model 1151 :param pars: list of fittable parameters 1152 :param fitter_list: list of fit engine 1153 :param value: structure storing data mapped to their model, range etc. 1147 Create and set fitter with series of data and model 1154 1148 """ 1155 1149 data = fitproblem.get_fit_data() … … 1207 1201 """ 1208 1202 Display fit result in batch 1209 :param result: list of objects received from t fit engines1203 :param result: list of objects received from fitters 1210 1204 :param pars: list of fitted parameters names 1211 1205 :param page_id: list of page ids which called fit function … … 1308 1302 batch_inputs["error on %s" % str(param)].append(ERROR) 1309 1303 else: 1310 # T oDo: Why sometimes res.pvec comes with numpy.float64?1311 # Need to fix it within ScipyEngine1304 # TODO: Why sometimes res.pvec comes with numpy.float64? 1305 # probably from scipy lmfit 1312 1306 if res.pvec.__class__ == numpy.float64: 1313 1307 res.pvec = [res.pvec] … … 1921 1915 dy = numpy.ones(len(data_copy.y)) 1922 1916 else: 1923 ## Set consi tently w/AbstractFitengine:1917 ## Set consistently w/AbstractFitengine: 1924 1918 # But this should be corrected later. 1925 1919 dy = deepcopy(data_copy.dy) -
src/sas/perspectives/fitting/pagestate.py
rb1e609c racf8e4a5 42 42 ["name", "name", "string"], 43 43 ["data_name", "data_name", "string"]] 44 LIST_OF_STATE_ATTRIBUTES = [["engine_type", "engine_type", "string"], 45 ["qmin", "qmin", "float"], 44 LIST_OF_STATE_ATTRIBUTES = [["qmin", "qmin", "float"], 46 45 ["qmax", "qmax", "float"], 47 46 ["npts", "npts", "float"], … … 173 172 self.reset = False 174 173 175 #engine type176 self.engine_type = None177 174 # flag to allow data2D plot 178 175 self.enable2D = False … … 288 285 obj.is_data = self.is_data 289 286 obj.model_list_box = copy.deepcopy(self.model_list_box) 290 obj.engine_type = copy.deepcopy(self.engine_type)291 287 292 288 obj.categorycombobox = self.categorycombobox -
src/sas/perspectives/fitting/simfitpage.py
r2f4b430 racf8e4a5 152 152 153 153 ## making sure all parameters content a constraint 154 ## validity of the constraint expression is own by fit engine155 154 if not self.batch_on and self.show_constraint.GetValue(): 156 155 if not self._set_constraint():
Note: See TracChangeset
for help on using the changeset viewer.