Changeset 35e36fd in sasview
- Timestamp:
- Sep 8, 2018 9:41:33 AM (6 years ago)
- Branches:
- ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
- Children:
- c0de493
- Parents:
- c8536d6c (diff), f3e5956 (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. - git-author:
- Torin Cooper-Bennun <40573959+tcbennun@…> (09/08/18 09:41:33)
- git-committer:
- GitHub <noreply@…> (09/08/18 09:41:33)
- Location:
- src/sas/qtgui/Perspectives/Fitting
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/FittingLogic.py
rdcabba7 r9ba91b7 161 161 Create a new 1D data instance based on fitting results 162 162 """ 163 164 163 return self._create1DPlot(tab_id, return_data['x'], return_data['y'], 165 164 return_data['model'], return_data['data']) … … 212 211 (pq_plot, sq_plot). If either are unavailable, the corresponding plot is None. 213 212 """ 214 215 pq_plot = None 216 sq_plot = None 217 218 if return_data.get('pq_values', None) is not None: 219 pq_plot = self._create1DPlot(tab_id, return_data['x'], 220 return_data['pq_values'], return_data['model'], 221 return_data['data'], component="P(Q)") 222 if return_data.get('sq_values', None) is not None: 223 sq_plot = self._create1DPlot(tab_id, return_data['x'], 224 return_data['sq_values'], return_data['model'], 225 return_data['data'], component="S(Q)") 226 227 return pq_plot, sq_plot 213 plots = [] 214 for name, result in return_data['intermediate_results'].items(): 215 plots.append(self._create1DPlot(tab_id, return_data['x'], result, 216 return_data['model'], return_data['data'], 217 component=name)) 218 return plots 228 219 229 220 def computeDataRange(self): -
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
rc8536d6c rf3e5956 2428 2428 2429 2429 # Create plots for intermediate product data 2430 pq_data, sq_data = self.logic.new1DProductPlots(return_data, self.tab_id) 2431 if pq_data is not None: 2432 pq_data.symbol = "Line" 2433 self.createNewIndex(pq_data) 2434 # self.communicate.plotUpdateSignal.emit([pq_data]) 2435 new_plots.append(pq_data) 2436 if sq_data is not None: 2437 sq_data.symbol = "Line" 2438 self.createNewIndex(sq_data) 2439 # self.communicate.plotUpdateSignal.emit([sq_data]) 2440 new_plots.append(sq_data) 2430 plots = self.logic.new1DProductPlots(return_data, self.tab_id) 2431 for plot in plots: 2432 plot.symbol = "Line" 2433 self.createNewIndex(plot) 2434 new_plots.append(plot) 2441 2435 2442 2436 for plot in new_plots: -
src/sas/qtgui/Perspectives/Fitting/ModelThread.py
rdcabba7 r5181e9b 164 164 index = (self.qmin <= self.data.x) & (self.data.x <= self.qmax) 165 165 166 intermediate_results = None 167 166 168 # If we use a smearer, also return the unsmeared model 167 169 unsmeared_output = None … … 174 176 mask = self.data.x[first_bin:last_bin+1] 175 177 unsmeared_output = numpy.zeros((len(self.data.x))) 176 unsmeared_output[first_bin:last_bin+1] = self.model.evalDistribution(mask) 178 179 return_data = self.model.calculate_Iq(mask) 180 if isinstance(return_data, tuple): 181 # see sasmodels beta_approx: SasviewModel.calculate_Iq 182 # TODO: implement intermediate results in smearers 183 return_data, _ = return_data 184 unsmeared_output[first_bin:last_bin+1] = return_data 177 185 output = self.smearer(unsmeared_output, first_bin, last_bin) 178 186 … … 193 201 unsmeared_error=unsmeared_error 194 202 else: 195 output[index] = self.model.evalDistribution(self.data.x[index]) 196 197 sq_values = None 198 pq_values = None 199 s_model = None 200 p_model = None 201 if isinstance(self.model, MultiplicationModel): 202 s_model = self.model.s_model 203 p_model = self.model.p_model 204 elif hasattr(self.model, "calc_composition_models"): 205 results = self.model.calc_composition_models(self.data.x[index]) 206 if results is not None: 207 pq_values, sq_values = results 208 209 if pq_values is None or sq_values is None: 210 if p_model is not None and s_model is not None: 211 sq_values = numpy.zeros((len(self.data.x))) 212 pq_values = numpy.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]) 203 return_data = self.model.calculate_Iq(self.data.x[index]) 204 if isinstance(return_data, tuple): 205 # see sasmodels beta_approx: SasviewModel.calculate_Iq 206 return_data, intermediate_results = return_data 207 output[index] = return_data 208 209 if intermediate_results: 210 # the model returns a callable which is then used to retrieve the data 211 intermediate_results = intermediate_results() 212 else: 213 # TODO: this conditional branch needs refactoring 214 sq_values = None 215 pq_values = None 216 s_model = None 217 p_model = None 218 219 if isinstance(self.model, MultiplicationModel): 220 s_model = self.model.s_model 221 p_model = self.model.p_model 222 223 elif hasattr(self.model, "calc_composition_models"): 224 results = self.model.calc_composition_models(self.data.x[index]) 225 if results is not None: 226 pq_values, sq_values = results 227 228 if pq_values is None or sq_values is None: 229 if p_model is not None and s_model is not None: 230 sq_values = numpy.zeros((len(self.data.x))) 231 pq_values = numpy.zeros((len(self.data.x))) 232 sq_values[index] = s_model.evalDistribution(self.data.x[index]) 233 pq_values[index] = p_model.evalDistribution(self.data.x[index]) 234 235 if pq_values is not None and sq_values is not None: 236 intermediate_results = { 237 "P(Q)": pq_values, 238 "S(Q)": sq_values 239 } 240 else: 241 intermediate_results = {} 215 242 216 243 elapsed = time.time() - self.starttime … … 223 250 source = self.source, unsmeared_output = unsmeared_output, 224 251 unsmeared_data = unsmeared_data, unsmeared_error = unsmeared_error, 225 pq_values = pq_values, sq_values = sq_values)252 intermediate_results = intermediate_results) 226 253 227 254 if LocalConfig.USING_TWISTED:
Note: See TracChangeset
for help on using the changeset viewer.