Changeset 9a5097c in sasview for src/sas/sascalc/pr/fit/BumpsFitting.py
- Timestamp:
- Mar 26, 2017 11:33:16 PM (8 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.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- ed2276f
- Parents:
- 9146ed9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/pr/fit/BumpsFitting.py
rb699768 r9a5097c 5 5 from datetime import timedelta, datetime 6 6 7 import numpy 7 import numpy as np 8 8 9 9 from bumps import fitters … … 96 96 try: 97 97 p = history.population_values[0] 98 n,p = len(p), n umpy.sort(p)98 n,p = len(p), np.sort(p) 99 99 QI,Qmid, = int(0.2*n),int(0.5*n) 100 100 self.convergence.append((best, p[0],p[QI],p[Qmid],p[-1-QI],p[-1])) … … 193 193 194 194 def numpoints(self): 195 return n umpy.sum(self.data.idx) # number of fitted points195 return np.sum(self.data.idx) # number of fitted points 196 196 197 197 def nllf(self): 198 return 0.5*n umpy.sum(self.residuals()**2)198 return 0.5*np.sum(self.residuals()**2) 199 199 200 200 def theory(self): … … 293 293 R.success = result['success'] 294 294 if R.success: 295 R.stderr = n umpy.hstack((result['stderr'][fitted_index],296 numpy.NaN*numpy.ones(len(fitness.computed_pars))))297 R.pvec = n umpy.hstack((result['value'][fitted_index],295 R.stderr = np.hstack((result['stderr'][fitted_index], 296 np.NaN*np.ones(len(fitness.computed_pars)))) 297 R.pvec = np.hstack((result['value'][fitted_index], 298 298 [p.value for p in fitness.computed_pars])) 299 R.fitness = n umpy.sum(R.residuals**2)/(fitness.numpoints() - len(fitted_index))299 R.fitness = np.sum(R.residuals**2)/(fitness.numpoints() - len(fitted_index)) 300 300 else: 301 R.stderr = n umpy.NaN*numpy.ones(len(param_list))302 R.pvec = n umpy.asarray( [p.value for p in fitness.fitted_pars+fitness.computed_pars])303 R.fitness = n umpy.NaN301 R.stderr = np.NaN*np.ones(len(param_list)) 302 R.pvec = np.asarray( [p.value for p in fitness.fitted_pars+fitness.computed_pars]) 303 R.fitness = np.NaN 304 304 R.convergence = result['convergence'] 305 305 if result['uncertainty'] is not None: … … 331 331 max_step = steps + options.get('burn', 0) 332 332 pars = [p.name for p in problem._parameters] 333 #x0 = n umpy.asarray([p.value for p in problem._parameters])333 #x0 = np.asarray([p.value for p in problem._parameters]) 334 334 options['monitors'] = [ 335 335 BumpsMonitor(handler, max_step, pars, problem.dof), … … 352 352 353 353 convergence_list = options['monitors'][-1].convergence 354 convergence = (2*n umpy.asarray(convergence_list)/problem.dof355 if convergence_list else n umpy.empty((0,1),'d'))354 convergence = (2*np.asarray(convergence_list)/problem.dof 355 if convergence_list else np.empty((0,1),'d')) 356 356 357 357 success = best is not None
Note: See TracChangeset
for help on using the changeset viewer.