Changeset 40975f8 in sasview for src/sas/qtgui/Perspectives/Fitting/ModelThread.py
- Timestamp:
- Sep 7, 2018 3:24:34 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:
- d6c4987
- Parents:
- 66d4370
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/ModelThread.py
r2df558e r40975f8 215 215 output[index] = self.model.evalDistribution(self.data.x[index]) 216 216 217 sq_values = None 218 pq_values = None 219 s_model = None 220 p_model = None 221 if isinstance(self.model, MultiplicationModel): 222 s_model = self.model.s_model 223 p_model = self.model.p_model 224 elif hasattr(self.model, "calc_composition_models"): 225 results = self.model.calc_composition_models(self.data.x[index]) 226 if results is not None: 227 pq_values, sq_values = results 228 229 if pq_values is None or sq_values is None: 230 if p_model is not None and s_model is not None: 231 sq_values = numpy.zeros((len(self.data.x))) 232 pq_values = numpy.zeros((len(self.data.x))) 233 sq_values[index] = s_model.evalDistribution(self.data.x[index]) 234 pq_values[index] = p_model.evalDistribution(self.data.x[index]) 217 results_eval = {} 218 intermediate_results = getattr(self.model, "_intermediate_results", None) 219 if callable(intermediate_results): 220 # support for future sasmodels (beta approx support) - it returns a dict of intermediate results, keyed by 221 # name 222 results_eval = intermediate_results() 223 else: 224 sq_values = None 225 pq_values = None 226 s_model = None 227 p_model = None 228 if isinstance(self.model, MultiplicationModel): 229 s_model = self.model.s_model 230 p_model = self.model.p_model 231 elif hasattr(self.model, "calc_composition_models"): 232 results = self.model.calc_composition_models(self.data.x[index]) 233 if results is not None: 234 pq_values, sq_values = results 235 236 if pq_values is None or sq_values is None: 237 if p_model is not None and s_model is not None: 238 sq_values = numpy.zeros((len(self.data.x))) 239 pq_values = numpy.zeros((len(self.data.x))) 240 sq_values[index] = s_model.evalDistribution(self.data.x[index]) 241 pq_values[index] = p_model.evalDistribution(self.data.x[index]) 242 243 if pq_values is not None and sq_values is not None: 244 results_eval = { 245 "P(Q)": pq_values, 246 "S(Q)": sq_values 247 } 235 248 236 249 elapsed = time.time() - self.starttime … … 248 261 self.source, 249 262 unsmeared_output, unsmeared_data, unsmeared_error, 250 pq_values, sq_values)263 results_eval) 251 264 else: 252 265 self.completefn((self.data.x[index], output[index], … … 261 274 self.source, 262 275 unsmeared_output, unsmeared_data, unsmeared_error, 263 pq_values, sq_values))276 results_eval)) 264 277 265 278 def results(self):
Note: See TracChangeset
for help on using the changeset viewer.