Changeset 0d5dc05 in sasmodels for sasmodels/models/sphere.py


Ignore:
Timestamp:
Mar 31, 2019 9:33:49 AM (5 years ago)
Author:
GitHub <noreply@…>
Branches:
master
Children:
f8060c5
Parents:
be0942c (diff), 7050455 (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.
git-author:
Steve K <smk78@…> (03/31/19 09:33:49)
git-committer:
GitHub <noreply@…> (03/31/19 09:33:49)
Message:

Merge branch 'master' into ticket-1263-source-link

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/sphere.py

    r934a001 rd57b06c  
    3636References 
    3737---------- 
    38   
     38 
    3939.. [#] A Guinier and G. Fournet, *Small-Angle Scattering of X-Rays*, 
    4040   John Wiley and Sons, New York, (1955) 
    41  
    42 Source 
    43 ------ 
    44  
    45 `sphere.py <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/sphere.py>`_ 
    46  
    47 `sphere.c <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/sphere.c>`_ 
    4841 
    4942Authorship and Verification 
     
    5346* **Last Modified by:** 
    5447* **Last Reviewed by:** S King and P Parker **Date:** 2013/09/09 and 2014/01/06 
    55 * **Source added by :** Steve King **Date:** March 25, 2019 
    5648""" 
    5749 
     
    9385#2345678901234567890123456789012345678901234567890123456789012345678901234567890 
    9486tests = [ 
    95      [{}, 0.2, 0.726362], # each test starts with default parameter values  
     87     [{}, 0.2, 0.726362], # each test starts with default parameter values 
    9688     #            inside { }, unless modified. Then Q and expected value of I(Q) 
    97      # putting None for an expected result will pass the test if there are no  
     89     # putting None for an expected result will pass the test if there are no 
    9890     # errors from the routine, but without any check on the value of the result 
    9991    [{"scale": 1., "background": 0., "sld": 6., "sld_solvent": 1., 
    100        "radius": 120.}, [0.01,0.1,0.2],  
     92       "radius": 120.}, [0.01,0.1,0.2], 
    10193     [1.34836265e+04, 6.20114062e+00, 1.04733914e-01]], 
    10294     [{"scale": 1., "background": 0., "sld": 6., "sld_solvent": 1., 
    103      #  careful tests here R=120 Pd=.2, then with S(Q) at default Reff=50  
     95     #  careful tests here R=120 Pd=.2, then with S(Q) at default Reff=50 
    10496     #  (but this gets changed to 120) phi=0,2 
    10597       "radius": 120., "radius_pd": 0.2, "radius_pd_n":45}, 
    106       [0.01,0.1,0.2], [1.74395295e+04, 3.68016987e+00, 2.28843099e-01]],   
     98      [0.01,0.1,0.2], [1.74395295e+04, 3.68016987e+00, 2.28843099e-01]], 
    10799     # a list of Q values and list of expected results is also possible 
    108100    [{"scale": 1., "background": 0., "sld": 6., "sld_solvent": 1., 
    109101     "radius": 120., "radius_pd": 0.2, "radius_pd_n":45}, 
    110       0.01, 335839.88055473, 1.41045057e+11, 120.0, 8087664.122641933, 1.0],  
    111      # the longer list here checks  F1, F2, R_eff, volume, volume_ratio  
     102      0.01, 335839.88055473, 1.41045057e+11, 120.0, 8087664.122641933, 1.0], 
     103     # the longer list here checks  F1, F2, R_eff, volume, volume_ratio 
    112104    [{"radius": 120., "radius_pd": 0.2, "radius_pd_n":45}, 
    113       0.1, 482.93824329, 29763977.79867414, 120.0, 8087664.122641933, 1.0],  
     105      0.1, 482.93824329, 29763977.79867414, 120.0, 8087664.122641933, 1.0], 
    114106    [{"radius": 120., "radius_pd": 0.2, "radius_pd_n":45}, 
    115107      0.2, 1.23330406, 1850806.1197361, 120.0, 8087664.122641933, 1.0], 
    116108   #  But note P(Q) = F2/volume 
    117    #  F and F^2 are "unscaled", with for  n <F F*>S(q) or for beta approx  
     109   #  F and F^2 are "unscaled", with for  n <F F*>S(q) or for beta approx 
    118110   #          I(q) = n [<F F*> + <F><F*> (S(q) - 1)] 
    119    #  for n the number density and <.> the orientation average, and  
     111   #  for n the number density and <.> the orientation average, and 
    120112   #  F = integral rho(r) exp(i q . r) dr. 
    121113   #  The number density is volume fraction divided by particle volume. 
    122    #  Effectively, this leaves F = V drho form, where form is the usual  
     114   #  Effectively, this leaves F = V drho form, where form is the usual 
    123115   #  3 j1(qr)/(qr) or whatever depending on the shape. 
    124116   # @S RESULTS using F1 and F2 from the longer test strng above: 
     
    128120   # with by default scale=1.0, background=0.001 
    129121   # NOTE currently S(Q) volfraction is also included in scaling 
    130    #  structure_factor_mode 0 = normal decoupling approx,  
     122   #  structure_factor_mode 0 = normal decoupling approx, 
    131123   #                        1 = beta(Q) approx 
    132    # radius_effective_mode  0 is for free choice,  
     124   # radius_effective_mode  0 is for free choice, 
    133125   #                        1 is use radius from F2(Q) 
    134126   #    (sphere only has two choices, other models may have more) 
     
    136128     "radius": 120., "radius_pd": 0.2, "radius_pd_n":45,"volfraction":0.2, 
    137129     #"radius_effective":50.0,    # hard sphere structure factor 
    138      "structure_factor_mode": 1,  # mode 0 = normal decoupling approx,  
     130     "structure_factor_mode": 1,  # mode 0 = normal decoupling approx, 
    139131     #                                   1 = beta(Q) approx 
    140      "radius_effective_mode": 0   # this used default hardsphere Reff=50     
     132     "radius_effective_mode": 0   # this used default hardsphere Reff=50 
    141133     }, [0.01,0.1,0.2], [1.32473756e+03, 7.36633631e-01, 4.67686201e-02]  ], 
    142134    [{"@S": "hardsphere", 
     
    145137     "radius_effective":45.0,     # explicit Reff over rides either 50 or 120 
    146138     "structure_factor_mode": 1,  # beta approx 
    147      "radius_effective_mode": 0   #  
     139     "radius_effective_mode": 0   # 
    148140     }, 0.01, 1316.2990966463444 ], 
    149141    [{"@S": "hardsphere", 
     
    152144     "radius_effective":120.0,    # over ride Reff 
    153145     "structure_factor_mode": 1,  # beta approx 
    154      "radius_effective_mode": 0   # (mode=1 here also uses 120)  
     146     "radius_effective_mode": 0   # (mode=1 here also uses 120) 
    155147     }, [0.01,0.1,0.2], [1.57928589e+03, 7.37067923e-01, 4.67686197e-02  ]], 
    156148    [{"@S": "hardsphere", 
Note: See TracChangeset for help on using the changeset viewer.