Changeset 0d5dc05 in sasmodels for sasmodels/models/sphere.py
- Timestamp:
- Mar 31, 2019 9:33:49 AM (5 years ago)
- 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)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/sphere.py
r934a001 rd57b06c 36 36 References 37 37 ---------- 38 38 39 39 .. [#] A Guinier and G. Fournet, *Small-Angle Scattering of X-Rays*, 40 40 John Wiley and Sons, New York, (1955) 41 42 Source43 ------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>`_48 41 49 42 Authorship and Verification … … 53 46 * **Last Modified by:** 54 47 * **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, 201956 48 """ 57 49 … … 93 85 #2345678901234567890123456789012345678901234567890123456789012345678901234567890 94 86 tests = [ 95 [{}, 0.2, 0.726362], # each test starts with default parameter values 87 [{}, 0.2, 0.726362], # each test starts with default parameter values 96 88 # 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 98 90 # errors from the routine, but without any check on the value of the result 99 91 [{"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], 101 93 [1.34836265e+04, 6.20114062e+00, 1.04733914e-01]], 102 94 [{"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 104 96 # (but this gets changed to 120) phi=0,2 105 97 "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]], 107 99 # a list of Q values and list of expected results is also possible 108 100 [{"scale": 1., "background": 0., "sld": 6., "sld_solvent": 1., 109 101 "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 112 104 [{"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], 114 106 [{"radius": 120., "radius_pd": 0.2, "radius_pd_n":45}, 115 107 0.2, 1.23330406, 1850806.1197361, 120.0, 8087664.122641933, 1.0], 116 108 # 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 118 110 # 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 120 112 # F = integral rho(r) exp(i q . r) dr. 121 113 # 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 123 115 # 3 j1(qr)/(qr) or whatever depending on the shape. 124 116 # @S RESULTS using F1 and F2 from the longer test strng above: … … 128 120 # with by default scale=1.0, background=0.001 129 121 # 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, 131 123 # 1 = beta(Q) approx 132 # radius_effective_mode 0 is for free choice, 124 # radius_effective_mode 0 is for free choice, 133 125 # 1 is use radius from F2(Q) 134 126 # (sphere only has two choices, other models may have more) … … 136 128 "radius": 120., "radius_pd": 0.2, "radius_pd_n":45,"volfraction":0.2, 137 129 #"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, 139 131 # 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 141 133 }, [0.01,0.1,0.2], [1.32473756e+03, 7.36633631e-01, 4.67686201e-02] ], 142 134 [{"@S": "hardsphere", … … 145 137 "radius_effective":45.0, # explicit Reff over rides either 50 or 120 146 138 "structure_factor_mode": 1, # beta approx 147 "radius_effective_mode": 0 # 139 "radius_effective_mode": 0 # 148 140 }, 0.01, 1316.2990966463444 ], 149 141 [{"@S": "hardsphere", … … 152 144 "radius_effective":120.0, # over ride Reff 153 145 "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) 155 147 }, [0.01,0.1,0.2], [1.57928589e+03, 7.37067923e-01, 4.67686197e-02 ]], 156 148 [{"@S": "hardsphere",
Note: See TracChangeset
for help on using the changeset viewer.