- Timestamp:
- Apr 11, 2017 9:02:04 AM (8 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.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 426df2e
- Parents:
- d26f025
- Location:
- src/sas/sasgui/perspectives/fitting
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/fitting.py
r7432acb r24b3821 359 359 'Add a new model function') 360 360 wx.EVT_MENU(owner, wx_id, self.make_new_model) 361 361 362 362 wx_id = wx.NewId() 363 363 self.edit_model_menu.Append(wx_id, 'Sum|Multi(p1, p2)', … … 381 381 '(Re)Load all models present in user plugin_models folder') 382 382 wx.EVT_MENU(owner, wx_id, self.load_plugin_models) 383 383 384 384 def set_edit_menu_helper(self, owner=None, menu=None): 385 385 """ … … 1748 1748 dy=unsmeared_error) 1749 1749 # Comment this out until we can get P*S models with correctly populated parameters 1750 #if sq_model is not None and pq_model is not None:1751 #self.create_theory_1D(x, sq_model, page_id, model, data, state,1752 #data_description=model.name + " S(q)",1753 #data_id=str(page_id) + " " + data.name + " S(q)")1754 #self.create_theory_1D(x, pq_model, page_id, model, data, state,1755 #data_description=model.name + " P(q)",1756 #data_id=str(page_id) + " " + data.name + " P(q)")1750 if sq_model is not None and pq_model is not None: 1751 self.create_theory_1D(x, sq_model, page_id, model, data, state, 1752 data_description=model.name + " S(q)", 1753 data_id=str(page_id) + " " + data.name + " S(q)") 1754 self.create_theory_1D(x, pq_model, page_id, model, data, state, 1755 data_description=model.name + " P(q)", 1756 data_id=str(page_id) + " " + data.name + " P(q)") 1757 1757 1758 1758 current_pg = self.fit_panel.get_page_by_id(page_id) … … 1910 1910 ## and may be the cause of other noted instabilities 1911 1911 ## 1912 ## -PDB August 12, 2014 1912 ## -PDB August 12, 2014 1913 1913 while self.calc_2D.isrunning(): 1914 1914 time.sleep(0.1) … … 1952 1952 if (self.calc_1D is not None) and self.calc_1D.isrunning(): 1953 1953 self.calc_1D.stop() 1954 ## stop just raises the flag -- the thread is supposed to 1954 ## stop just raises the flag -- the thread is supposed to 1955 1955 ## then kill itself but cannot. Paul Kienzle came up with 1956 1956 ## this fix to prevent threads from stepping on each other … … 1964 1964 ## a request to stop the computation. 1965 1965 ## It seems thus that the whole thread approach used here 1966 ## May need rethinking 1966 ## May need rethinking 1967 1967 ## 1968 1968 ## -PDB August 12, 2014 … … 2129 2129 residuals.dxw = None 2130 2130 residuals.ytransform = 'y' 2131 # For latter scale changes 2131 # For latter scale changes 2132 2132 residuals.xaxis('\\rm{Q} ', 'A^{-1}') 2133 2133 residuals.yaxis('\\rm{Residuals} ', 'normalized') -
src/sas/sasgui/perspectives/fitting/model_thread.py
r7432acb r24b3821 71 71 (self.data.qy_data * self.data.qy_data)) 72 72 73 # For theory, qmax is based on 1d qmax 73 # For theory, qmax is based on 1d qmax 74 74 # so that must be mulitified by sqrt(2) to get actual max for 2d 75 75 index_model = (self.qmin <= radius) & (radius <= self.qmax) … … 91 91 self.data.qy_data[index_model] 92 92 ]) 93 output = np.zeros(len(self.data.qx_data)) 93 # Initialize output to NaN so masked elements do not get plotted. 94 output = np.empty_like(self.data.qx_data) 94 95 # output default is None 95 96 # This method is to distinguish between masked 96 97 #point(nan) and data point = 0. 97 output = output / output98 output[:] = np.NaN 98 99 # set value for self.mask==True, else still None to Plottools 99 100 output[index_model] = value … … 198 199 output[index] = self.model.evalDistribution(self.data.x[index]) 199 200 201 x=self.data.x[index] 202 y=output[index] 200 203 sq_values = None 201 204 pq_values = None 202 s_model = None203 p_model = None204 205 if isinstance(self.model, MultiplicationModel): 205 206 s_model = self.model.s_model 206 207 p_model = self.model.p_model 207 elif hasattr(self.model, "get_composition_models"): 208 p_model, s_model = self.model.get_composition_models() 209 210 if p_model is not None and s_model is not None: 211 sq_values = np.zeros((len(self.data.x))) 212 pq_values = np.zeros((len(self.data.x))) 213 sq_values[index] = s_model.evalDistribution(self.data.x[index]) 214 pq_values[index] = p_model.evalDistribution(self.data.x[index]) 208 #sq_values = np.zeros((len(self.data.x))) 209 #pq_values = np.zeros((len(self.data.x))) 210 #sq_values[index] = s_model.evalDistribution(self.data.x[index]) 211 #pq_values[index] = p_model.evalDistribution(self.data.x[index]) 212 sq_values = s_model.evalDistribution(x) 213 pq_values = p_model.evalDistribution(x) 214 elif hasattr(self.model, "calc_composition_models"): 215 results = self.model.calc_composition_models(x) 216 if results is not None: 217 sq_values = results[0] 218 pq_values = results[1] 219 215 220 216 221 elapsed = time.time() - self.starttime 217 222 218 self.complete(x= self.data.x[index], y=output[index],223 self.complete(x=x, y=y, 219 224 page_id=self.page_id, 220 225 state=self.state,
Note: See TracChangeset
for help on using the changeset viewer.