Changeset 9c0f3c17 in sasview for src/sas/sascalc/pr/invertor.py
- Timestamp:
- Apr 4, 2017 10:50:04 AM (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:
- f2940c4
- Parents:
- 463e7ffc (diff), 1779e72 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/pr/invertor.py
r463e7ffc r9c0f3c17 7 7 """ 8 8 9 import numpy 9 import numpy as np 10 10 import sys 11 11 import math … … 191 191 #import numpy 192 192 if name == 'x': 193 out = n umpy.ones(self.get_nx())193 out = np.ones(self.get_nx()) 194 194 self.get_x(out) 195 195 return out 196 196 elif name == 'y': 197 out = n umpy.ones(self.get_ny())197 out = np.ones(self.get_ny()) 198 198 self.get_y(out) 199 199 return out 200 200 elif name == 'err': 201 out = n umpy.ones(self.get_nerr())201 out = np.ones(self.get_nerr()) 202 202 self.get_err(out) 203 203 return out … … 327 327 raise RuntimeError, msg 328 328 329 p = n umpy.ones(nfunc)329 p = np.ones(nfunc) 330 330 t_0 = time.time() 331 331 out, cov_x, _, _, _ = optimize.leastsq(self.residuals, p, full_output=1) … … 343 343 344 344 if cov_x is None: 345 cov_x = n umpy.ones([nfunc, nfunc])345 cov_x = np.ones([nfunc, nfunc]) 346 346 cov_x *= math.fabs(chisqr) 347 347 return out, cov_x … … 360 360 raise RuntimeError, msg 361 361 362 p = n umpy.ones(nfunc)362 p = np.ones(nfunc) 363 363 t_0 = time.time() 364 364 out, cov_x, _, _, _ = optimize.leastsq(self.pr_residuals, p, full_output=1) … … 437 437 """ 438 438 # Note: To make sure an array is contiguous: 439 # blah = n umpy.ascontiguousarray(blah_original)439 # blah = np.ascontiguousarray(blah_original) 440 440 # ... before passing it to C 441 441 … … 458 458 nfunc += 1 459 459 460 a = n umpy.zeros([npts + nq, nfunc])461 b = n umpy.zeros(npts + nq)462 err = n umpy.zeros([nfunc, nfunc])460 a = np.zeros([npts + nq, nfunc]) 461 b = np.zeros(npts + nq) 462 err = np.zeros([nfunc, nfunc]) 463 463 464 464 # Construct the a matrix and b vector that represent the problem … … 478 478 self.chi2 = chi2 479 479 480 inv_cov = n umpy.zeros([nfunc, nfunc])480 inv_cov = np.zeros([nfunc, nfunc]) 481 481 # Get the covariance matrix, defined as inv_cov = a_transposed * a 482 482 self._get_invcov_matrix(nfunc, nr, a, inv_cov) … … 492 492 493 493 try: 494 cov = n umpy.linalg.pinv(inv_cov)494 cov = np.linalg.pinv(inv_cov) 495 495 err = math.fabs(chi2 / float(npts - nfunc)) * cov 496 496 except: … … 507 507 self.background = c[0] 508 508 509 err_0 = n umpy.zeros([nfunc, nfunc])510 c_0 = n umpy.zeros(nfunc)509 err_0 = np.zeros([nfunc, nfunc]) 510 c_0 = np.zeros(nfunc) 511 511 512 512 for i in range(nfunc_0): … … 664 664 str(self.cov[i][i]))) 665 665 file.write("<r> <Pr> <dPr>\n") 666 r = n umpy.arange(0.0, self.d_max, self.d_max / npts)666 r = np.arange(0.0, self.d_max, self.d_max / npts) 667 667 668 668 for r_i in r: … … 696 696 toks = line.split('=') 697 697 self.nfunc = int(toks[1]) 698 self.out = n umpy.zeros(self.nfunc)699 self.cov = n umpy.zeros([self.nfunc, self.nfunc])698 self.out = np.zeros(self.nfunc) 699 self.cov = np.zeros([self.nfunc, self.nfunc]) 700 700 elif line.startswith('#alpha='): 701 701 toks = line.split('=')
Note: See TracChangeset
for help on using the changeset viewer.