Changes in sasmodels/models/triaxial_ellipsoid.py [0b56f38:15a90c1] in sasmodels
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/triaxial_ellipsoid.py
r0b56f38 r15a90c1 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 on 68 :numref:`triaxial-ellipsoid-angles` . 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 69 74 The angle $\psi$ is the rotational angle around its own $c$ axis 70 75 against the $q$ plane. For example, $\psi = 0$ when the … … 73 78 .. _triaxial-ellipsoid-angles: 74 79 75 .. figure:: img/triaxial_ellipsoid_angle_projection. jpg80 .. figure:: img/triaxial_ellipsoid_angle_projection.png 76 81 77 The angles for oriented ellipsoid.82 Some example angles for oriented ellipsoid. 78 83 79 84 The radius-of-gyration for this system is $R_g^2 = (R_a R_b R_c)^2/5$. … … 81 86 The contrast $\Delta\rho$ is defined as SLD(ellipsoid) - SLD(solvent). In the 82 87 parameters, $R_a$ is the minor equatorial radius, $R_b$ is the major 83 equatorial radius, and $R_c$ is the polar radius of the ellipsoid. 88 equatorial radius, and $R_c$ is the polar radius of the ellipsoid. 84 89 85 90 NB: The 2nd virial coefficient of the triaxial solid ellipsoid is … … 112 117 """ 113 118 114 from numpy import inf , sin, cos, pi119 from numpy import inf 115 120 116 121 name = "triaxial_ellipsoid" … … 147 152 def ER(radius_equat_minor, radius_equat_major, radius_polar): 148 153 """ 149 154 Returns the effective radius used in the S*P calculation 150 155 """ 151 156 import numpy as np 152 157 from .ellipsoid import ER as ellipsoid_ER 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)) 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) 157 167 158 168 demo = dict(scale=1, background=0, … … 166 176 phi_pd=15, phi_pd_n=1, 167 177 psi_pd=15, psi_pd_n=1) 168 q = 0.1 169 # april 6 2017, rkh add unit tests, NOT compared with any other calc method, assume correct! 170 # add 2d test after pull #890 171 qx = q*cos(pi/6.0) 172 qy = q*sin(pi/6.0) 173 tests = [[{}, 0.05, 24.8839548033], 174 # [{'theta':80., 'phi':10.}, (qx, qy), 9999. ], 175 ] 176 del qx, qy # not necessary to delete, but cleaner 178 179 # TODO: need some unit tests!
Note: See TracChangeset
for help on using the changeset viewer.