Changeset ea59943 in sasview for pr_inversion
- Timestamp:
- Nov 23, 2011 10:12:45 AM (13 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.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- c09ace41
- Parents:
- 6232a6f
- Location:
- pr_inversion
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pr_inversion/src/sans/pr/c_extensions/Cinvertor.c
r007f9b3 rea59943 16 16 17 17 /// Error object for raised exceptions 18 static PyObject * CinvertorError = NULL;18 PyObject * CinvertorError; 19 19 20 20 #define INVECTOR(obj,buf,len) \ … … 903 903 for (j=0; j<nfunc; j++) { 904 904 for (i=0; i<self->params.npoints; i++) { 905 if (self->params.err[i]==0.0) { 906 PyErr_SetString(CinvertorError, 907 "Cinvertor.get_matrix: Some I(Q) points have no error."); 908 return NULL; 909 } 905 910 if (accept_q(self, self->params.x[i])){ 906 911 if (self->params.has_bck==1 && j==0) { … … 1126 1131 1127 1132 d = PyModule_GetDict(module); 1128 CinvertorError = PyErr_NewException(" Cinvertor.error", NULL, NULL);1133 CinvertorError = PyErr_NewException("sans.pr.invertor.Cinvertor.InvertorError", PyExc_RuntimeError, NULL); 1129 1134 PyDict_SetItemString(d, "CinvertorError", CinvertorError); 1130 1135 } -
pr_inversion/src/sans/pr/invertor.py
r007f9b3 rea59943 455 455 # Construct the a matrix and b vector that represent the problem 456 456 t_0 = time.time() 457 self._get_matrix(nfunc, nq, a, b) 457 try: 458 self._get_matrix(nfunc, nq, a, b) 459 except: 460 raise RuntimeError, "Invertor: could not invert I(Q)\n %s" % sys.exc_value 458 461 459 462 # Perform the inversion (least square fit) -
pr_inversion/test/utest_invertor.py
r007f9b3 rea59943 481 481 self.invertor.err = err 482 482 # Perform inversion 483 self.assertRaises(numpy.linalg.LinAlgError, self.invertor.invert, 10) 484 483 self.assertRaises(RuntimeError, self.invertor.invert, 10) 485 484 486 485 def test_invalid(self): … … 599 598 600 599 if __name__ == '__main__': 601 unittest.main( )600 unittest.main(testRunner=unittest.TextTestRunner(verbosity=2))
Note: See TracChangeset
for help on using the changeset viewer.