Changeset ea59943 in sasview for pr_inversion/src/sans/pr


Ignore:
Timestamp:
Nov 23, 2011 12:12:45 PM (13 years ago)
Author:
Mathieu Doucet <doucetm@…>
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
Message:

Re #5 improving tests

Location:
pr_inversion/src/sans/pr
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pr_inversion/src/sans/pr/c_extensions/Cinvertor.c

    r007f9b3 rea59943  
    1616 
    1717/// Error object for raised exceptions 
    18 static PyObject * CinvertorError = NULL; 
     18PyObject * CinvertorError; 
    1919 
    2020#define INVECTOR(obj,buf,len)                                                                           \ 
     
    903903    for (j=0; j<nfunc; j++) { 
    904904        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            } 
    905910            if (accept_q(self, self->params.x[i])){ 
    906911                if (self->params.has_bck==1 && j==0) { 
     
    11261131 
    11271132    d = PyModule_GetDict(module); 
    1128     CinvertorError = PyErr_NewException("Cinvertor.error", NULL, NULL); 
     1133    CinvertorError = PyErr_NewException("sans.pr.invertor.Cinvertor.InvertorError", PyExc_RuntimeError, NULL); 
    11291134    PyDict_SetItemString(d, "CinvertorError", CinvertorError); 
    11301135} 
  • pr_inversion/src/sans/pr/invertor.py

    r007f9b3 rea59943  
    455455        # Construct the a matrix and b vector that represent the problem 
    456456        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 
    458461              
    459462        # Perform the inversion (least square fit) 
Note: See TracChangeset for help on using the changeset viewer.