Changes in src/sas/sascalc/fit/BumpsFitting.py [b699768:345e7e4] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/fit/BumpsFitting.py
rb699768 r345e7e4 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
Note: See TracChangeset
for help on using the changeset viewer.