Changes in / [16a8c63:43ff77c] in sasmodels
- Location:
- sasmodels/models
- Files:
-
- 5 added
- 6 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/core_shell_bicelle_elliptical.py
r15a90c1 r0b56f38 80 80 81 81 82 .. figure:: img/elliptical_cylinder_angle_definition. png82 .. figure:: img/elliptical_cylinder_angle_definition.jpg 83 83 84 Definition of the angles for the oriented core_shell_bicelle_elliptical particles.85 84 Definition of the angles for the oriented core_shell_bicelle_elliptical model. 85 Note that *theta* and *phi* are currently defined differently to those for the core_shell_bicelle model. 86 86 87 87 -
sasmodels/models/core_shell_parallelepiped.py
r1916c52 rcb0dc22 10 10 11 11 .. note:: 12 This model was originally ported from NIST IGOR macros. However, it is not13 yet fully understood by the SasView developers and is currently underreview.12 This model was originally ported from NIST IGOR macros. However,t is not 13 yet fully understood by the SasView developers and is currently review. 14 14 15 15 The form factor is normalized by the particle volume $V$ such that … … 51 51 52 52 F_{a}(Q,\alpha,\beta)= 53 \left[\frac{\sin( \tfrac{1}{2}Q(L_A+2t_A)\sin\alpha \sin\beta)}{\tfrac{1}{2}Q(L_A+2t_A)\sin\alpha\sin\beta}54 - \frac{\sin( \tfrac{1}{2}QL_A\sin\alpha \sin\beta)}{\tfrac{1}{2}QL_A\sin\alpha \sin\beta} \right]55 \left[\frac{\sin( \tfrac{1}{2}QL_B\sin\alpha \sin\beta)}{\tfrac{1}{2}QL_B\sin\alpha \sin\beta} \right]56 \left[\frac{\sin( \tfrac{1}{2}QL_C\sin\alpha \sin\beta)}{\tfrac{1}{2}QL_C\sin\alpha \sin\beta} \right]53 \left[\frac{\sin(Q(L_A+2t_A)/2\sin\alpha \sin\beta)}{Q(L_A+2t_A)/2\sin\alpha\sin\beta} 54 - \frac{\sin(QL_A/2\sin\alpha \sin\beta)}{QL_A/2\sin\alpha \sin\beta} \right] 55 \left[\frac{\sin(QL_B/2\sin\alpha \sin\beta)}{QL_B/2\sin\alpha \sin\beta} \right] 56 \left[\frac{\sin(QL_C/2\sin\alpha \sin\beta)}{QL_C/2\sin\alpha \sin\beta} \right] 57 57 58 58 .. note:: 59 59 60 Why does t_B not appear in the above equation?61 60 For the calculation of the form factor to be valid, the sides of the solid 62 MUST (perhaps not any more?)be chosen such that** $A < B < C$.61 MUST be chosen such that** $A < B < C$. 63 62 If this inequality is not satisfied, the model will not report an error, 64 63 but the calculation will not be correct and thus the result wrong. … … 81 80 NB: The 2nd virial coefficient of the core_shell_parallelepiped is calculated 82 81 based on the the averaged effective radius $(=\sqrt{(A+2t_A)(B+2t_B)/\pi})$ 83 and length $(C+2t_C)$ values, after appropriately 84 sorting the three dimensions to give an oblate or prolate particle, to give an 85 effective radius, for $S(Q)$ when $P(Q) * S(Q)$ is applied. 82 and length $(C+2t_C)$ values, and used as the effective radius 83 for $S(Q)$ when $P(Q) * S(Q)$ is applied. 86 84 87 85 To provide easy access to the orientation of the parallelepiped, we define the … … 92 90 *x*-axis of the detector. 93 91 94 .. figure:: img/parallelepiped_angle_definition. png92 .. figure:: img/parallelepiped_angle_definition.jpg 95 93 96 94 Definition of the angles for oriented core-shell parallelepipeds. 97 95 98 .. figure:: img/parallelepiped_angle_projection. png96 .. figure:: img/parallelepiped_angle_projection.jpg 99 97 100 98 Examples of the angles for oriented core-shell parallelepipeds against the … … 121 119 122 120 import numpy as np 123 from numpy import pi, inf, sqrt , cos, sin121 from numpy import pi, inf, sqrt 124 122 125 123 name = "core_shell_parallelepiped" … … 195 193 psi_pd=10, psi_pd_n=1) 196 194 197 # rkh 7/4/17 add random unit test for 2d, note make all params different, 2d values not tested against other codes or models 198 qx, qy = 0.2 * cos(pi/6.), 0.2 * sin(pi/6.) 195 qx, qy = 0.2 * np.cos(2.5), 0.2 * np.sin(2.5) 199 196 tests = [[{}, 0.2, 0.533149288477], 200 197 [{}, [0.2], [0.533149288477]], 201 [{'theta':10.0, 'phi': 20.0}, (qx, qy), 0.0853299803222],202 [{'theta':10.0, 'phi': 20.0}, [(qx, qy)], [0.0853299803222]],198 [{'theta':10.0, 'phi':10.0}, (qx, qy), 0.032102135569], 199 [{'theta':10.0, 'phi':10.0}, [(qx, qy)], [0.032102135569]], 203 200 ] 204 201 del qx, qy # not necessary to delete, but cleaner -
sasmodels/models/cylinder.py
r15a90c1 rb7e8b94 64 64 65 65 Definition of the angles for oriented cylinders. 66 67 .. figure:: img/cylinder_angle_projection.png68 69 Examples for oriented cylinders.70 66 71 67 The $\theta$ and $\phi$ parameters only appear in the model when fitting 2d data. -
sasmodels/models/elliptical_cylinder.py
r15a90c1 r0b56f38 64 64 oriented system. 65 65 66 .. figure:: img/elliptical_cylinder_angle_definition. png66 .. figure:: img/elliptical_cylinder_angle_definition.jpg 67 67 68 Definition of angles for oriented elliptical cylinder, where axis_ratio >1, 69 and angle $\Psi$ is a rotation around the axis of the cylinder. 68 Definition of angles for 2D 70 69 71 .. figure:: img/ elliptical_cylinder_angle_projection.png70 .. figure:: img/cylinder_angle_projection.jpg 72 71 73 72 Examples of the angles for oriented elliptical cylinders against the 74 detector plane , with $\Psi$ = 0.73 detector plane. 75 74 76 75 NB: The 2nd virial coefficient of the cylinder is calculated based on the -
sasmodels/models/parallelepiped.py
r1916c52 r8e68ea0 15 15 .. _parallelepiped-image: 16 16 17 18 17 .. figure:: img/parallelepiped_geometry.jpg 19 18 … … 22 21 .. note:: 23 22 24 The edge of the solid used to have tosatisfy the condition that $A < B < C$.25 After some improvements to the effective radius calculation, used with an S(Q),26 it is beleived that this is no longer the case.23 The edge of the solid must satisfy the condition that $A < B < C$. 24 This requirement is not enforced in the model, so it is up to the 25 user to check this during the analysis. 27 26 28 27 The 1D scattering intensity $I(q)$ is calculated as: … … 72 71 73 72 NB: The 2nd virial coefficient of the parallelepiped is calculated based on 74 the averaged effective radius, after appropriately 75 sorting the three dimensions, to give an oblate or prolate particle, $(=\sqrt{A B / \pi})$ and 73 the averaged effective radius $(=\sqrt{A B / \pi})$ and 76 74 length $(= C)$ values, and used as the effective radius for 77 75 $S(q)$ when $P(q) \cdot S(q)$ is applied. … … 104 102 .. _parallelepiped-orientation: 105 103 106 .. figure:: img/parallelepiped_angle_definition. png107 108 Definition of the angles for oriented parallelepiped , shown with $A < B < C$.109 110 .. figure:: img/parallelepiped_angle_projection. png111 112 Examples of the angles for an oriented parallelepipedagainst the104 .. figure:: img/parallelepiped_angle_definition.jpg 105 106 Definition of the angles for oriented parallelepipeds. 107 108 .. figure:: img/parallelepiped_angle_projection.jpg 109 110 Examples of the angles for oriented parallelepipeds against the 113 111 detector plane. 114 112 … … 118 116 .. math:: 119 117 120 P(q_x, q_y) = \left[\frac{\sin( \tfrac{1}{2}qA\cos\alpha)}{(\tfrac{1}{2}qA\cos\alpha)}\right]^2121 \left[\frac{\sin( \tfrac{1}{2}qB\cos\beta)}{(\tfrac{1}{2}qB\cos\beta)}\right]^2122 \left[\frac{\sin( \tfrac{1}{2}qC\cos\gamma)}{(\tfrac{1}{2}qC\cos\gamma)}\right]^2118 P(q_x, q_y) = \left[\frac{\sin(qA\cos\alpha/2)}{(qA\cos\alpha/2)}\right]^2 119 \left[\frac{\sin(qB\cos\beta/2)}{(qB\cos\beta/2)}\right]^2 120 \left[\frac{\sin(qC\cos\gamma/2)}{(qC\cos\gamma/2)}\right]^2 123 121 124 122 with … … 156 154 angles. 157 155 156 This model is based on form factor calculations implemented in a c-library 157 provided by the NIST Center for Neutron Research (Kline, 2006). 158 158 159 159 References … … 163 163 164 164 R Nayuk and K Huber, *Z. Phys. Chem.*, 226 (2012) 837-854 165 166 Authorship and Verification167 ----------------------------168 169 * **Author:** This model is based on form factor calculations implemented in a c-library170 provided by the NIST Center for Neutron Research (Kline, 2006).171 * **Last Modified by:** Paul Kienzle **Date:** April 05, 2017172 * **Last Reviewed by:** Richard Heenan **Date:** April 06, 2017173 174 165 """ 175 166 176 167 import numpy as np 177 from numpy import pi, inf, sqrt , sin, cos168 from numpy import pi, inf, sqrt 178 169 179 170 name = "parallelepiped" … … 217 208 def ER(length_a, length_b, length_c): 218 209 """ 219 Return effective radius (ER) for P(q)*S(q)210 Return effective radius (ER) for P(q)*S(q) 220 211 """ 221 # now that axes can be in any size order, need to sort a,b,c where a~b and c is either much smaller 222 # or much larger 223 abc = np.vstack((length_a, length_b, length_c)) 224 abc = np.sort(abc, axis=0) 225 selector = (abc[1] - abc[0]) > (abc[2] - abc[1]) 226 length = np.where(selector, abc[0], abc[2]) 212 227 213 # surface average radius (rough approximation) 228 radius = np.sqrt(np.where(~selector, abc[0]*abc[1], abc[1]*abc[2])/ pi)229 230 ddd = 0.75 * radius * (2*radius*length + (length + radius)*(length + pi*radius))214 surf_rad = sqrt(length_a * length_b / pi) 215 216 ddd = 0.75 * surf_rad * (2 * surf_rad * length_c + (length_c + surf_rad) * (length_c + pi * surf_rad)) 231 217 return 0.5 * (ddd) ** (1. / 3.) 232 218 … … 244 230 phi_pd=10, phi_pd_n=1, 245 231 psi_pd=10, psi_pd_n=10) 246 # rkh 7/4/17 add random unit test for 2d, note make all params different, 2d values not tested against other codes or models 247 qx, qy = 0.2 * cos(pi/6.), 0.2 * sin(pi/6.)232 233 qx, qy = 0.2 * np.cos(2.5), 0.2 * np.sin(2.5) 248 234 tests = [[{}, 0.2, 0.17758004974], 249 235 [{}, [0.2], [0.17758004974]], 250 [{'theta':10.0, 'phi': 20.0}, (qx, qy), 0.0089517140475],251 [{'theta':10.0, 'phi': 20.0}, [(qx, qy)], [0.0089517140475]],236 [{'theta':10.0, 'phi':10.0}, (qx, qy), 0.00560296014], 237 [{'theta':10.0, 'phi':10.0}, [(qx, qy)], [0.00560296014]], 252 238 ] 253 239 del qx, qy # not necessary to delete, but cleaner -
sasmodels/models/triaxial_ellipsoid.py
r15a90c1 r0b56f38 65 65 To provide easy access to the orientation of the triaxial ellipsoid, 66 66 we define the axis of the cylinder using the angles $\theta$, $\phi$ 67 and $\psi$. These angles are defined analogously to the elliptical_cylinder below 68 69 .. figure:: img/elliptical_cylinder_angle_definition.png 70 71 Definition of angles for oriented triaxial ellipsoid, where radii shown here are $a < b << c$ 72 and angle $\Psi$ is a rotation around the axis of the particle. 73 67 and $\psi$. These angles are defined on 68 :numref:`triaxial-ellipsoid-angles` . 74 69 The angle $\psi$ is the rotational angle around its own $c$ axis 75 70 against the $q$ plane. For example, $\psi = 0$ when the … … 78 73 .. _triaxial-ellipsoid-angles: 79 74 80 .. figure:: img/triaxial_ellipsoid_angle_projection. png75 .. figure:: img/triaxial_ellipsoid_angle_projection.jpg 81 76 82 Some example angles for oriented ellipsoid.77 The angles for oriented ellipsoid. 83 78 84 79 The radius-of-gyration for this system is $R_g^2 = (R_a R_b R_c)^2/5$. … … 152 147 def ER(radius_equat_minor, radius_equat_major, radius_polar): 153 148 """ 154 Returns the effective radius used in the S*P calculation149 Returns the effective radius used in the S*P calculation 155 150 """ 156 151 import numpy as np 157 152 from .ellipsoid import ER as ellipsoid_ER 158 159 # now that radii can be in any size order, radii need sorting a,b,c where a~b and c is either much smaller 160 # or much larger 161 radii = np.vstack((radius_equat_major, radius_equat_minor, radius_polar)) 162 radii = np.sort(radii, axis=0) 163 selector = (radii[1] - radii[0]) > (radii[2] - radii[1]) 164 polar = np.where(selector, radii[0], radii[2]) 165 equatorial = np.sqrt(np.where(~selector, radii[0]*radii[1], radii[1]*radii[2])) 166 return ellipsoid_ER(polar, equatorial) 153 # now that radii can be in any size order, radii need sorting a,b,c where a~b and c is either much smaller or much larger 154 # also need some unit tests! 155 156 return ellipsoid_ER(radius_polar, np.sqrt(radius_equat_minor * radius_equat_major)) 167 157 168 158 demo = dict(scale=1, background=0, … … 176 166 phi_pd=15, phi_pd_n=1, 177 167 psi_pd=15, psi_pd_n=1) 178 179 168 q = 0.1 180 169 # april 6 2017, rkh add unit tests, NOT compared with any other calc method, assume correct!
Note: See TracChangeset
for help on using the changeset viewer.