- Timestamp:
- Jun 2, 2015 9:51:34 AM (9 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:
- b99a4552
- Parents:
- 422e7e8
- Location:
- src/sas
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/fit/BumpsFitting.py
r9f7fbd9 re1442d4 271 271 fitness = M.fitness 272 272 fitted_index = [varying.index(p) for p in fitness.fitted_pars] 273 param_list = fitness.fitted_par_names + fitness.computed_par_names 273 274 R = FResult(model=fitness.model, data=fitness.data, 274 param_list= fitness.fitted_par_names+fitness.computed_par_names)275 param_list=param_list) 275 276 R.theory = fitness.theory() 276 277 R.residuals = fitness.residuals() … … 278 279 R.fitter_id = self.fitter_id 279 280 # TODO: should scale stderr by sqrt(chisq/DOF) if dy is unknown 280 R.stderr = numpy.hstack((result['stderr'][fitted_index],281 numpy.NaN*numpy.ones(len(fitness.computed_pars))))282 R.pvec = numpy.hstack((result['value'][fitted_index],283 [p.value for p in fitness.computed_pars]))284 281 R.success = result['success'] 285 R.fitness = numpy.sum(R.residuals**2)/(fitness.numpoints() - len(fitted_index)) 282 if R.success: 283 R.stderr = numpy.hstack((result['stderr'][fitted_index], 284 numpy.NaN*numpy.ones(len(fitness.computed_pars)))) 285 R.pvec = numpy.hstack((result['value'][fitted_index], 286 [p.value for p in fitness.computed_pars])) 287 R.fitness = numpy.sum(R.residuals**2)/(fitness.numpoints() - len(fitted_index)) 288 else: 289 R.stderr = numpy.NaN*numpy.ones(len(param_list)) 290 R.pvec = numpy.asarray( [p.value for p in fitness.fitted_pars+fitness.computed_pars]) 291 R.fitness = numpy.NaN 286 292 R.convergence = result['convergence'] 287 293 if result['uncertainty'] is not None: … … 310 316 max_step = fitopts.options.get('steps', 0) + fitopts.options.get('burn', 0) 311 317 pars = [p.name for p in problem._parameters] 318 #x0 = numpy.asarray([p.value for p in problem._parameters]) 312 319 options['monitors'] = [ 313 320 BumpsMonitor(handler, max_step, pars, problem.dof), … … 317 324 abort_test=abort_test, **options) 318 325 omp_threads = int(os.environ.get('OMP_NUM_THREADS','0')) 319 mapper = MPMapper if omp_threads == 1 else SerialMapper 326 mapper = MPMapper if omp_threads == 1 else SerialMapper 320 327 fitdriver.mapper = mapper.start_mapper(problem, None) 321 328 #import time; T0 = time.time() … … 332 339 convergence = (2*numpy.asarray(convergence_list)/problem.dof 333 340 if convergence_list else numpy.empty((0,1),'d')) 341 342 success = best is not None 334 343 return { 335 'value': best ,336 'stderr': fitdriver.stderr() ,337 'success': True, # better success reporting in bumps344 'value': best if success else None, 345 'stderr': fitdriver.stderr() if success else None, 346 'success': success, 338 347 'convergence': convergence, 339 348 'uncertainty': getattr(fitdriver.fitter, 'state', None), -
src/sas/perspectives/fitting/fitting.py
r9776c82 re1442d4 1511 1511 1512 1512 except: 1513 msg = "Fit completed but Following" 1514 msg += " warning occurred: %s" % sys.exc_value 1513 msg = ("Fit completed but the following error occurred: %s" 1514 % sys.exc_value) 1515 #import traceback; msg = "\n".join((traceback.format_exc(), msg)) 1515 1516 wx.PostEvent(self.parent, StatusEvent(status=msg, info="warning", 1516 1517 type="stop"))
Note: See TracChangeset
for help on using the changeset viewer.