Ignore:
Timestamp:
Mar 26, 2017 11:33:16 PM (8 years ago)
Author:
andyfaff
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
Message:

MAINT: import numpy as np

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/pr/fit/BumpsFitting.py

    rb699768 r9a5097c  
    55from datetime import timedelta, datetime 
    66 
    7 import numpy 
     7import numpy as np 
    88 
    99from bumps import fitters 
     
    9696        try: 
    9797            p = history.population_values[0] 
    98             n,p = len(p), numpy.sort(p) 
     98            n,p = len(p), np.sort(p) 
    9999            QI,Qmid, = int(0.2*n),int(0.5*n) 
    100100            self.convergence.append((best, p[0],p[QI],p[Qmid],p[-1-QI],p[-1])) 
     
    193193 
    194194    def numpoints(self): 
    195         return numpy.sum(self.data.idx) # number of fitted points 
     195        return np.sum(self.data.idx) # number of fitted points 
    196196 
    197197    def nllf(self): 
    198         return 0.5*numpy.sum(self.residuals()**2) 
     198        return 0.5*np.sum(self.residuals()**2) 
    199199 
    200200    def theory(self): 
     
    293293            R.success = result['success'] 
    294294            if R.success: 
    295                 R.stderr = numpy.hstack((result['stderr'][fitted_index], 
    296                                          numpy.NaN*numpy.ones(len(fitness.computed_pars)))) 
    297                 R.pvec = numpy.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], 
    298298                                      [p.value for p in fitness.computed_pars])) 
    299                 R.fitness = numpy.sum(R.residuals**2)/(fitness.numpoints() - len(fitted_index)) 
     299                R.fitness = np.sum(R.residuals**2)/(fitness.numpoints() - len(fitted_index)) 
    300300            else: 
    301                 R.stderr = numpy.NaN*numpy.ones(len(param_list)) 
    302                 R.pvec = numpy.asarray( [p.value for p in fitness.fitted_pars+fitness.computed_pars]) 
    303                 R.fitness = numpy.NaN 
     301                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 
    304304            R.convergence = result['convergence'] 
    305305            if result['uncertainty'] is not None: 
     
    331331    max_step = steps + options.get('burn', 0) 
    332332    pars = [p.name for p in problem._parameters] 
    333     #x0 = numpy.asarray([p.value for p in problem._parameters]) 
     333    #x0 = np.asarray([p.value for p in problem._parameters]) 
    334334    options['monitors'] = [ 
    335335        BumpsMonitor(handler, max_step, pars, problem.dof), 
     
    352352 
    353353    convergence_list = options['monitors'][-1].convergence 
    354     convergence = (2*numpy.asarray(convergence_list)/problem.dof 
    355                    if convergence_list else numpy.empty((0,1),'d')) 
     354    convergence = (2*np.asarray(convergence_list)/problem.dof 
     355                   if convergence_list else np.empty((0,1),'d')) 
    356356 
    357357    success = best is not None 
Note: See TracChangeset for help on using the changeset viewer.