Changeset e964ab1 in sasmodels for doc/developer
- Timestamp:
- Oct 28, 2017 9:11:13 PM (7 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 3d40839
- Parents:
- 5f8b72b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/developer/overview.rst
reda8b30 re964ab1 171 171 ------------------------------------- 172 172 173 For 2d data from oriented anisotropic particles, the mean particle orientation is defined by angles $\theta$, $\phi$ and $\Psi$, which 174 are not in general the same as similarly named angles in many form factors. The wikipedia page on Euler angles 175 (https://en.wikipedia.org/wiki/Euler_angles) lists the different conventions available. To quote: "Different authors may use different 176 sets of rotation axes to define Euler angles, or different names for the same angles. Therefore, any discussion employing Euler angles 173 For 2d data from oriented anisotropic particles, the mean particle 174 orientation is defined by angles $\theta$, $\phi$ and $\Psi$, which are not 175 in general the same as similarly named angles in many form factors. The 176 wikipedia page on Euler angles (https://en.wikipedia.org/wiki/Euler_angles) 177 lists the different conventions available. To quote: "Different authors may 178 use different sets of rotation axes to define Euler angles, or different 179 names for the same angles. Therefore, any discussion employing Euler angles 177 180 should always be preceded by their definition." 178 181 179 We are using the z-y-z convention with extrinsic rotations $\Psi-\theta-\phi$ for the particle orientation and $x-y-z$ convention with 180 extrinsic rotations $\psi-\theta-\phi$ for jitter, with jitter applied before particle orientation. 181 182 For numerical integration within form factors etc. sasmodels is mostly using Gaussian quadrature with 20, 76 or 150 points depending on 183 the model. It also makes use of symmetries such as calculating only over one quadrant rather than the whole sphere. There is often a 184 U-substitution replacing $\theta$ with $cos(\theta)$ which changes the limits of integration from 0 to $\pi/2$ to 0 to 1 and also conveniently 185 absorbs the $sin(\theta)$ scale factor in the integration. This can cause confusion if checking equations to say include in a paper or thesis! 186 Most models use the same core kernel code expressed in terms of the rotated view (qa, qb, qc) for both the 1D and the 2D models, but there 187 are also historical quirks such as the parallelepiped model, which has a useless transformation representing j0(a qa) as j0(b qa a/b). 182 We are using the z-y-z convention with extrinsic rotations $\Psi-\theta-\phi$ 183 for the particle orientation and $x-y-z$ convention with extrinsic rotations 184 $\psi-\theta-\phi$ for jitter, with jitter applied before particle 185 orientation. 186 187 For numerical integration within form factors etc. sasmodels is mostly using 188 Gaussian quadrature with 20, 76 or 150 points depending on the model. It also 189 makes use of symmetries such as calculating only over one quadrant rather 190 than the whole sphere. There is often a U-substitution replacing $\theta$ 191 with $cos(\theta)$ which changes the limits of integration from 0 to $\pi/2$ 192 to 0 to 1 and also conveniently absorbs the $sin(\theta)$ scale factor in the 193 integration. This can cause confusion if checking equations to say include in 194 a paper or thesis! Most models use the same core kernel code expressed in 195 terms of the rotated view (qa, qb, qc) for both the 1D and the 2D models, but 196 there are also historical quirks such as the parallelepiped model, which has 197 a useless transformation representing j0(a qa) as j0(b qa a/b). 188 198 189 199 Useful testing routines include - 190 200 191 :mod:`asymint` a direct implementation of the surface integral for certain models to get a more trusted value for the 1D integral using a reimplementation of the 2D kernel in python and mpmath 192 (which computes math functions to arbitrary precision). It uses $\theta$ ranging from 0 to $\pi$ and $\phi$ ranging from 0 to $2\pi$. It perhaps would benefit 193 from including the U-substitution for theta. 194 195 :mod:`check1d` uses sasmodels 1D integration and compares that with a rectangle distribution in $\theta$ and $\phi$, with $\theta$ limits set to 196 $\pm90/\sqrt(3)$ and $\phi$ limits set to $\pm180/\sqrt(3)$ 197 [The rectangle weight function uses the fact that the distribution width column is labelled sigma to decide 198 that the 1-sigma width of a rectangular distribution needs to be multiplied by $\sqrt(3)$ to get the corresponding gaussian equivalent, 199 or similar reasoning.] This should rotate the sample through the entire $\theta-\phi$ 200 surface according to the pattern that you see in jitter.py when you modify it to use 'rectangle' rather than 'gaussian' for its distribution 201 without changing the viewing angle. When computing the dispersity integral, weights are scaled by abs(cos(dtheta)) to account for the points in 202 phi getting closer together as dtheta increases. This integrated dispersion is computed at a set of $(qx, qy)$ points $(q cos(\alpha), q sin(\alpha))$ 203 at some angle $\alpha$ (currently angle=0) for each q used in the 1-D integration. The individual q points should be equivalent to asymint rect-n 204 when the viewing angle is set to (theta,phi,psi) = (90, 0, 0). Such tests can help to validate that 2d intensity is consistent with 1d models. 205 206 :mod:`sascomp -sphere=n` uses the identical rectangular distribution to compute the pattern of the qx-qy grid. You can see from triaxial_ellipsoid 207 that there may be something wrong conceptually since the pattern is no longer circular when the view (theta,phi,psi) is not (90, phi, 0). 208 check1d shows that it is different from the sasmodels 1D integral even when at theta=0, psi=0. Cross checking the values with asymint, 209 the sasmodels 1D integral is better at low q, though for very large structures there are not enough points in the integration for sasmodels 1D 210 to compute the high q 1D integral correctly. [Some of that may now be fixed?] 211 212 The :mod:`sascomp` utility can be used for 2d as well as 1d calculations to compare results for two sets of parameters or processor types, for example 201 :mod:`asymint` a direct implementation of the surface integral for certain 202 models to get a more trusted value for the 1D integral using a 203 reimplementation of the 2D kernel in python and mpmath (which computes math 204 functions to arbitrary precision). It uses $\theta$ ranging from 0 to $\pi$ 205 and $\phi$ ranging from 0 to $2\pi$. It perhaps would benefit from including 206 the U-substitution for theta. 207 208 :mod:`check1d` uses sasmodels 1D integration and compares that with a 209 rectangle distribution in $\theta$ and $\phi$, with $\theta$ limits set to 210 $\pm90/\sqrt(3)$ and $\phi$ limits set to $\pm180/\sqrt(3)$ [The rectangle 211 weight function uses the fact that the distribution width column is labelled 212 sigma to decide that the 1-sigma width of a rectangular distribution needs to 213 be multiplied by $\sqrt(3)$ to get the corresponding gaussian equivalent, or 214 similar reasoning.] This should rotate the sample through the entire 215 $\theta-\phi$ surface according to the pattern that you see in jitter.py when 216 you modify it to use 'rectangle' rather than 'gaussian' for its distribution 217 without changing the viewing angle. When computing the dispersity integral, 218 weights are scaled by abs(cos(dtheta)) to account for the points in phi 219 getting closer together as dtheta increases. This integrated dispersion is 220 computed at a set of $(qx, qy)$ points $(q cos(\alpha), q sin(\alpha))$ at 221 some angle $\alpha$ (currently angle=0) for each q used in the 1-D 222 integration. The individual q points should be equivalent to asymint rect-n 223 when the viewing angle is set to (theta,phi,psi) = (90, 0, 0). Such tests can 224 help to validate that 2d intensity is consistent with 1d models. 225 226 :mod:`sascomp -sphere=n` uses the identical rectangular distribution to 227 compute the pattern of the qx-qy grid. You can see from triaxial_ellipsoid 228 that there may be something wrong conceptually since the pattern is no longer 229 circular when the view (theta,phi,psi) is not (90, phi, 0). check1d shows 230 that it is different from the sasmodels 1D integral even when at theta=0, 231 psi=0. Cross checking the values with asymint, the sasmodels 1D integral is 232 better at low q, though for very large structures there are not enough points 233 in the integration for sasmodels 1D to compute the high q 1D integral 234 correctly. [Some of that may now be fixed?] 235 236 The :mod:`sascomp` utility can be used for 2d as well as 1d calculations to 237 compare results for two sets of parameters or processor types, for example 213 238 these two oriented cylinders here should be equivalent. 214 239
Note: See TracChangeset
for help on using the changeset viewer.