id,summary,reporter,owner,description,type,status,priority,milestone,component,resolution,keywords,cc,workpackage 1073,Discrepancy in code for polymer_excl_volume,smk78,,"Reported by pkienzle: Just went through the code for polymer_excl_volume. The result should match older versions of !SasView, but this does not match the documentation, nor does it match Igor. For some reason, when Jae He added the model he scaled the gammainc term by gamma. Maybe Paul or Mat has some memory of why? Here the code that Jae He added: {{{ $ git show -p ec1c5540 2010-10-04 ec1c5540 added polymerexclVolume model and its test Jae Cho diff --git a/sansmodels/src/sans/models/PolymerExclVolume.py b/sansmodels/src/sans/models/PolymerExclVolume.py ... + nu = 1.0 / mm + + Xx = x * x * rg * rg *(2.0 * nu + 1.0) * (2.0 * nu + 2.0) / 6.0 + onu = 1.0 / nu + o2nu = 1.0 /(2.0 * nu) + Ps =(1.0 / (nu * pow(Xx,o2nu))) * (gamma(o2nu)*gammainc(o2nu,Xx) - \ + 1.0 / pow(Xx,o2nu) * gamma(onu)*gammainc(onu,Xx)) + + if x == 0: + Ps = 1.0 + + return (sc * Ps + bg); }}} Here's what is in Igor 7.12, !Analysis/Models/NewModels_2010/PolymerExcludVol_v40.ipf: {{{ nu=1/m Xx=qval^2*Rg^2*(2*nu+1)*(2*nu+2)/6 onu=1.0/(nu) o2nu=1.0/(2*nu) Ps=(1/(nu*Xx^o2nu))*(gammaInc(o2nu,Xx,0)-(1/Xx^o2nu)*gammaInc(onu,Xx,0)) Debye=(2/Xx^2)*(exp(-Xx)-1+Xx) if(qval == 0) Ps = 1 endif inten = I0*Ps + bgd Igor gammaInc(a, x, 0) = gamma(a) - gammaInc(a, x) = int_0^x e^-t t^(a-1) dt = scipy.special.gammainc(a, x). }}} Note: The current version looks different from Jae He's because I updated it during one of my cleanup passes. I'm pretty sure that I didn't change the result, but probably should revert it so that the equations in the code better match the equations in the documentation. ",defect,closed,major,sasmodels 1.0,sasmodels,invalid,,,SasView Bug Fixing