Changes in / [ca1eaeb:9300bfa] in sasview
- Location:
- src/sas
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/fit/BumpsFitting.py
rb699768 r1a5d5f2 4 4 import os 5 5 from datetime import timedelta, datetime 6 import traceback 6 7 7 8 import numpy … … 293 294 R.success = result['success'] 294 295 if R.success: 295 R.stderr = numpy.hstack((result['stderr'][fitted_index], 296 numpy.NaN*numpy.ones(len(fitness.computed_pars)))) 296 if result['stderr'] is None: 297 R.stderr = numpy.NaN*numpy.ones(len(param_list)) 298 else: 299 R.stderr = numpy.hstack((result['stderr'][fitted_index], 300 numpy.NaN*numpy.ones(len(fitness.computed_pars)))) 297 301 R.pvec = numpy.hstack((result['value'][fitted_index], 298 302 [p.value for p in fitness.computed_pars])) … … 306 310 R.uncertainty_state = result['uncertainty'] 307 311 all_results.append(R) 312 all_results[0].mesg = result['errors'] 308 313 309 314 if q is not None: … … 344 349 try: 345 350 best, fbest = fitdriver.fit() 346 except: 347 import traceback; traceback.print_exc() 348 raise 351 errors = [] 352 except Exception as exc: 353 best, fbest = None, numpy.NaN 354 errors = [str(exc), traceback.traceback.format_exc()] 349 355 finally: 350 356 mapper.stop_mapper(fitdriver.mapper) … … 356 362 357 363 success = best is not None 364 try: 365 stderr = fitdriver.stderr() if success else None 366 except Exception as exc: 367 errors.append(str(exc)) 368 errors.append(traceback.format_exc()) 369 stderr = None 358 370 return { 359 371 'value': best if success else None, 360 'stderr': fitdriver.stderr() if success else None,372 'stderr': stderr, 361 373 'success': success, 362 374 'convergence': convergence, 363 375 'uncertainty': getattr(fitdriver.fitter, 'state', None), 376 'errors': '\n'.join(errors), 364 377 } 365 378 -
src/sas/sasgui/perspectives/fitting/fitting.py
rec72ceb r1a5d5f2 1521 1521 for uid in page_id: 1522 1522 res = result[index] 1523 fit_msg = res.mesg 1523 1524 if res.fitness is None or \ 1524 1525 not numpy.isfinite(res.fitness) or \ 1525 1526 numpy.any(res.pvec == None) or \ 1526 1527 not numpy.all(numpy.isfinite(res.pvec)): 1527 msg = "Fitting did not converge!!!" 1528 evt = StatusEvent(status=msg, info="warning", type="stop") 1529 wx.PostEvent(self.parent, evt) 1528 fit_msg += "\nFitting did not converge!!!" 1530 1529 wx.CallAfter(self._update_fit_button, page_id) 1531 1530 else: … … 1550 1549 wx.CallAfter(cpage._on_fit_complete) 1551 1550 except KeyboardInterrupt: 1552 msg = "Singular point: Fitting Stoped." 1553 evt = StatusEvent(status=msg, info="info", type="stop") 1554 wx.PostEvent(self.parent, evt) 1551 fit_msg += "\nSingular point: Fitting stopped." 1555 1552 except: 1556 msg = "Singular point: Fitting Error occurred." 1557 evt = StatusEvent(status=msg, info="error", type="stop") 1558 wx.PostEvent(self.parent, evt) 1553 fit_msg += "\nSingular point: Fitting error occurred." 1554 if fit_msg: 1555 evt = StatusEvent(status=fit_msg, info="warning", type="stop") 1556 wx.PostEvent(self.parent, evt) 1559 1557 1560 1558 except:
Note: See TracChangeset
for help on using the changeset viewer.