Changeset 9a5097c in sasview for src/sas/sascalc/pr/invertor.py
- Timestamp:
- Mar 26, 2017 9:33:16 PM (7 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/invertor.py
r2c60f304 r9a5097c 7 7 """ 8 8 9 import numpy 9 import numpy as np 10 10 import sys 11 11 import math … … 189 189 #import numpy 190 190 if name == 'x': 191 out = n umpy.ones(self.get_nx())191 out = np.ones(self.get_nx()) 192 192 self.get_x(out) 193 193 return out 194 194 elif name == 'y': 195 out = n umpy.ones(self.get_ny())195 out = np.ones(self.get_ny()) 196 196 self.get_y(out) 197 197 return out 198 198 elif name == 'err': 199 out = n umpy.ones(self.get_nerr())199 out = np.ones(self.get_nerr()) 200 200 self.get_err(out) 201 201 return out … … 325 325 raise RuntimeError, msg 326 326 327 p = n umpy.ones(nfunc)327 p = np.ones(nfunc) 328 328 t_0 = time.time() 329 329 out, cov_x, _, _, _ = optimize.leastsq(self.residuals, p, full_output=1) … … 341 341 342 342 if cov_x is None: 343 cov_x = n umpy.ones([nfunc, nfunc])343 cov_x = np.ones([nfunc, nfunc]) 344 344 cov_x *= math.fabs(chisqr) 345 345 return out, cov_x … … 358 358 raise RuntimeError, msg 359 359 360 p = n umpy.ones(nfunc)360 p = np.ones(nfunc) 361 361 t_0 = time.time() 362 362 out, cov_x, _, _, _ = optimize.leastsq(self.pr_residuals, p, full_output=1) … … 435 435 """ 436 436 # Note: To make sure an array is contiguous: 437 # blah = n umpy.ascontiguousarray(blah_original)437 # blah = np.ascontiguousarray(blah_original) 438 438 # ... before passing it to C 439 439 … … 456 456 nfunc += 1 457 457 458 a = n umpy.zeros([npts + nq, nfunc])459 b = n umpy.zeros(npts + nq)460 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]) 461 461 462 462 # Construct the a matrix and b vector that represent the problem … … 476 476 self.chi2 = chi2 477 477 478 inv_cov = n umpy.zeros([nfunc, nfunc])478 inv_cov = np.zeros([nfunc, nfunc]) 479 479 # Get the covariance matrix, defined as inv_cov = a_transposed * a 480 480 self._get_invcov_matrix(nfunc, nr, a, inv_cov) … … 490 490 491 491 try: 492 cov = n umpy.linalg.pinv(inv_cov)492 cov = np.linalg.pinv(inv_cov) 493 493 err = math.fabs(chi2 / float(npts - nfunc)) * cov 494 494 except: … … 505 505 self.background = c[0] 506 506 507 err_0 = n umpy.zeros([nfunc, nfunc])508 c_0 = n umpy.zeros(nfunc)507 err_0 = np.zeros([nfunc, nfunc]) 508 c_0 = np.zeros(nfunc) 509 509 510 510 for i in range(nfunc_0): … … 662 662 str(self.cov[i][i]))) 663 663 file.write("<r> <Pr> <dPr>\n") 664 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) 665 665 666 666 for r_i in r: … … 694 694 toks = line.split('=') 695 695 self.nfunc = int(toks[1]) 696 self.out = n umpy.zeros(self.nfunc)697 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]) 698 698 elif line.startswith('#alpha='): 699 699 toks = line.split('=')
Note: See TracChangeset
for help on using the changeset viewer.