Changes in src/sas/sascalc/pr/invertor.py [463e7ffc:9a5097c] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/pr/invertor.py
r463e7ffc r9a5097c 7 7 """ 8 8 9 import numpy 9 import numpy as np 10 10 import sys 11 11 import math … … 18 18 from scipy import optimize 19 19 from sas.sascalc.pr.core.pr_inversion import Cinvertor 20 21 logger = logging.getLogger(__name__)22 20 23 21 def help(): … … 191 189 #import numpy 192 190 if name == 'x': 193 out = n umpy.ones(self.get_nx())191 out = np.ones(self.get_nx()) 194 192 self.get_x(out) 195 193 return out 196 194 elif name == 'y': 197 out = n umpy.ones(self.get_ny())195 out = np.ones(self.get_ny()) 198 196 self.get_y(out) 199 197 return out 200 198 elif name == 'err': 201 out = n umpy.ones(self.get_nerr())199 out = np.ones(self.get_nerr()) 202 200 self.get_err(out) 203 201 return out … … 327 325 raise RuntimeError, msg 328 326 329 p = n umpy.ones(nfunc)327 p = np.ones(nfunc) 330 328 t_0 = time.time() 331 329 out, cov_x, _, _, _ = optimize.leastsq(self.residuals, p, full_output=1) … … 343 341 344 342 if cov_x is None: 345 cov_x = n umpy.ones([nfunc, nfunc])343 cov_x = np.ones([nfunc, nfunc]) 346 344 cov_x *= math.fabs(chisqr) 347 345 return out, cov_x … … 360 358 raise RuntimeError, msg 361 359 362 p = n umpy.ones(nfunc)360 p = np.ones(nfunc) 363 361 t_0 = time.time() 364 362 out, cov_x, _, _, _ = optimize.leastsq(self.pr_residuals, p, full_output=1) … … 437 435 """ 438 436 # Note: To make sure an array is contiguous: 439 # blah = n umpy.ascontiguousarray(blah_original)437 # blah = np.ascontiguousarray(blah_original) 440 438 # ... before passing it to C 441 439 … … 458 456 nfunc += 1 459 457 460 a = n umpy.zeros([npts + nq, nfunc])461 b = n umpy.zeros(npts + nq)462 err = n umpy.zeros([nfunc, nfunc])458 a = np.zeros([npts + nq, nfunc]) 459 b = np.zeros(npts + nq) 460 err = np.zeros([nfunc, nfunc]) 463 461 464 462 # Construct the a matrix and b vector that represent the problem … … 478 476 self.chi2 = chi2 479 477 480 inv_cov = n umpy.zeros([nfunc, nfunc])478 inv_cov = np.zeros([nfunc, nfunc]) 481 479 # Get the covariance matrix, defined as inv_cov = a_transposed * a 482 480 self._get_invcov_matrix(nfunc, nr, a, inv_cov) … … 492 490 493 491 try: 494 cov = n umpy.linalg.pinv(inv_cov)492 cov = np.linalg.pinv(inv_cov) 495 493 err = math.fabs(chi2 / float(npts - nfunc)) * cov 496 494 except: 497 495 # We were not able to estimate the errors 498 496 # Return an empty error matrix 499 logg er.error(sys.exc_value)497 logging.error(sys.exc_value) 500 498 501 499 # Keep a copy of the last output … … 507 505 self.background = c[0] 508 506 509 err_0 = n umpy.zeros([nfunc, nfunc])510 c_0 = n umpy.zeros(nfunc)507 err_0 = np.zeros([nfunc, nfunc]) 508 c_0 = np.zeros(nfunc) 511 509 512 510 for i in range(nfunc_0): … … 543 541 # number of terms 544 542 best_alpha, _, _ = self.estimate_alpha(self.nfunc) 545 logg er.warning("Invertor.estimate_numterms: %s" % sys.exc_value)543 logging.warning("Invertor.estimate_numterms: %s" % sys.exc_value) 546 544 return self.nfunc, best_alpha, "Could not estimate number of terms" 547 545 … … 664 662 str(self.cov[i][i]))) 665 663 file.write("<r> <Pr> <dPr>\n") 666 r = n umpy.arange(0.0, self.d_max, self.d_max / npts)664 r = np.arange(0.0, self.d_max, self.d_max / npts) 667 665 668 666 for r_i in r: … … 696 694 toks = line.split('=') 697 695 self.nfunc = int(toks[1]) 698 self.out = n umpy.zeros(self.nfunc)699 self.cov = n umpy.zeros([self.nfunc, self.nfunc])696 self.out = np.zeros(self.nfunc) 697 self.cov = np.zeros([self.nfunc, self.nfunc]) 700 698 elif line.startswith('#alpha='): 701 699 toks = line.split('=')
Note: See TracChangeset
for help on using the changeset viewer.