Changeset 7643ba2 in sasview for fittingview/src/sans
- Timestamp:
- Oct 12, 2011 2:06:19 PM (13 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:
- da6fd1a
- Parents:
- 7db52f1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fittingview/src/sans/perspectives/fitting/fitting.py
r7db52f1 r7643ba2 1100 1100 msg += "Data %s and Model %s did not fit.\n" % (data_name, 1101 1101 model_name) 1102 print msg1103 wx.PostEvent(self.parent, StatusEvent(status=msg,1104 error="error",1105 type="stop"))1106 1102 else: 1107 1103 #Separate result in to data corresponding to each page … … 1156 1152 self.page_finder[pid][data.id].set_result(res) 1157 1153 fitproblem = self.page_finder[pid][data.id] 1158 1159 1154 qmin, qmax = fitproblem.get_range() 1160 1155 flag = issubclass(data.__class__, Data2D) 1156 correct_result = False 1161 1157 if not flag: 1162 self._complete1D(x=data.x, y=res.theory, page_id=pid, 1158 if len(res.theory) == len(res.index) and \ 1159 len(res.index) == len(data.y): 1160 correct_result = True 1161 self._complete1D(x=data.x, y=res.theory, page_id=pid, 1163 1162 elapsed=None, 1164 1163 index=res.index, model=model, … … 1167 1166 data=data, update_chisqr=False, 1168 1167 source='fit') 1168 else: 1169 data_name = str(None) 1170 if data is not None: 1171 data_name = str(data.name) 1172 model_name = str(None) 1173 if model is not None: 1174 model_name = str(model.name) 1175 msg += "Data %s and Model %s did not fit.\n" % (data_name, 1176 model_name) 1177 1169 1178 else: 1170 self._complete2D(image=data.data, data=data, 1179 if len(res.theory)== len(res.index) and \ 1180 len(res.index) == len(data.data): 1181 correct_result = True 1182 self._complete2D(image=res.theory, data=data, 1171 1183 model=model, 1172 1184 page_id=pid, elapsed=None, … … 1177 1189 update_chisqr=False, 1178 1190 source='fit') 1179 1180 self.on_set_batch_result(page_id=pid, 1191 else: 1192 data_name = str(None) 1193 if data is not None: 1194 data_name = str(data.name) 1195 model_name = str(None) 1196 if model is not None: 1197 model_name = str(model.name) 1198 msg += "Data %s and Model %s did not fit.\n" % (data_name, 1199 model_name) 1200 1201 if correct_result : 1202 self.on_set_batch_result(page_id=pid, 1181 1203 fid=data.id, 1182 1204 batch_outputs=batch_outputs, 1183 1205 batch_inputs=batch_inputs) 1184 1206 1207 #print msg 1208 wx.PostEvent(self.parent, StatusEvent(status=msg, error="error", 1209 type="stop")) 1185 1210 wx.CallAfter(self.parent.on_set_batch_result,batch_outputs, 1186 1211 batch_inputs, … … 1207 1232 cell.label = data.name 1208 1233 cell.value = index 1209 theory_data.id = str(page_id) + "model"1210 theory_data.name = 1234 theory_data.id = wx.NewId() 1235 theory_data.name = model.name + "[%s]" % str(model.__class__.__name__) 1211 1236 cell.object = [data, theory_data] 1212 1237 batch_outputs["Data"].append(cell) … … 1248 1273 for uid in page_id: 1249 1274 res = result[index] 1250 if res.fitness is notNone or \1275 if res.fitness is None or \ 1251 1276 not numpy.isfinite(res.fitness) or \ 1252 1277 numpy.any(res.pvec == None) or \ … … 1258 1283 type="stop")) 1259 1284 self._update_fit_button(page_id) 1260 cpage = self.fit_panel.get_page_by_id(uid) 1261 # Make sure we got all results 1262 #(CallAfter is important to MAC) 1263 wx.CallAfter(cpage.onsetValues, res.fitness, res.param_list, 1285 else: 1286 cpage = self.fit_panel.get_page_by_id(uid) 1287 # Make sure we got all results 1288 #(CallAfter is important to MAC) 1289 wx.CallAfter(cpage.onsetValues, res.fitness, res.param_list, 1264 1290 res.pvec, res.stderr) 1265 index += 11266 cpage._on_fit_complete()1267 if res.stderr == None:1268 msg = "Fit Abort: "1269 else:1270 msg = "Fitting: "1271 msg += "Completed!!!"1272 wx.PostEvent(self.parent, StatusEvent(status=msg))1291 index += 1 1292 cpage._on_fit_complete() 1293 if res.stderr == None: 1294 msg = "Fit Abort: " 1295 else: 1296 msg = "Fitting: " 1297 msg += "Completed!!!" 1298 wx.PostEvent(self.parent, StatusEvent(status=msg)) 1273 1299 except ValueError: 1274 1300 raise … … 1455 1481 caption = current_pg.window_caption 1456 1482 self.page_finder[page_id].set_fit_tab_caption(caption=caption) 1457 new_plot.id = str(page_id) + "model"1483 1458 1484 self.page_finder[page_id].set_theory_data(data=new_plot, 1459 1485 fid=data.id)
Note: See TracChangeset
for help on using the changeset viewer.