Changeset 007f9b3 in sasview for pr_inversion/src/sans


Ignore:
Timestamp:
Nov 22, 2011 4:18:22 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:
641166b
Parents:
d404f19
Message:

Re #5 Fix p(r) unit tests

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

Legend:

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

    rc04cbd7 r007f9b3  
    700700        if (!PyArg_ParseTuple(args, "OOd", &data_obj, &err_obj, &r)) return NULL; 
    701701        OUTVECTOR(data_obj,pars,npars); 
    702         OUTVECTOR(err_obj,pars_err,npars2); 
    703  
    704         pr_err(pars, pars_err, self->params.d_max, npars, r, &pr_value, &pr_err_value); 
     702 
     703        if (err_obj == Py_None) { 
     704                pr_value = pr(pars, self->params.d_max, npars, r); 
     705                pr_err_value = 0.0; 
     706        } else { 
     707                OUTVECTOR(err_obj,pars_err,npars2); 
     708                pr_err(pars, pars_err, self->params.d_max, npars, r, &pr_value, &pr_err_value); 
     709        } 
    705710        return Py_BuildValue("ff", pr_value, pr_err_value); 
    706711} 
  • pr_inversion/src/sans/pr/invertor.py

    r8c44b2c r007f9b3  
    319319        t_0 = time.time() 
    320320        out, cov_x, _, _, _ = optimize.leastsq(self.residuals, 
    321                                                             p, full_output=1, 
    322                                                              warning=True) 
     321                                                            p, full_output=1) 
    323322         
    324323        # Compute chi^2 
     
    333332        self.elapsed = time.time() - t_0 
    334333         
     334        if cov_x is None: 
     335            cov_x = numpy.ones([nfunc,nfunc]) 
     336            cov_x *= math.fabs(chisqr) 
    335337        return out, cov_x 
    336338     
     
    353355        t_0 = time.time() 
    354356        out, cov_x, info, mesg, success = optimize.leastsq(self.pr_residuals, p, 
    355                                                             full_output=1, 
    356                                                             warning=True) 
     357                                                            full_output=1) 
    357358         
    358359        # Compute chi^2 
Note: See TracChangeset for help on using the changeset viewer.