# Changeset fcb33e4 in sasmodels

Ignore:
Timestamp:
Jan 4, 2017 8:09:53 AM (6 years ago)
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
473a9f1, b7e8b94
Parents:
Message:

new model core_shell_bicelle_elliptical, not tested for 2d, docu changes for other cylinder models

Location:
sasmodels/models
Files:
7 edited

Unmodified
Removed
• ## sasmodels/models/barbell.py

 r0d6e865 .. math:: I(q) = \frac{\Delta \rho^2}{V} \left I(q) = \frac{\Delta \rho^2}{V} \left where the amplitude $A(q)$ is given as where the amplitude $A(q,\alpha)$ with the rod axis at angle $\alpha$ to $q$ is given as .. math:: A(q) =&\ \pi r^2L \frac{\sin\left(\tfrac12 qL\cos\theta\right)} {\tfrac12 qL\cos\theta} \frac{2 J_1(qr\sin\theta)}{qr\sin\theta} \\ \frac{\sin\left(\tfrac12 qL\cos\alpha\right)} {\tfrac12 qL\cos\alpha} \frac{2 J_1(qr\sin\alpha)}{qr\sin\alpha} \\ &\ + 4 \pi R^3 \int_{-h/R}^1 dt \cos\left[ q\cos\theta \cos\left[ q\cos\alpha \left(Rt + h + {\tfrac12} L\right)\right] \times (1-t^2) \frac{J_1\left[qR\sin\theta \left(1-t^2\right)^{1/2}\right]} {qR\sin\theta \left(1-t^2\right)^{1/2}} \frac{J_1\left[qR\sin\alpha \left(1-t^2\right)^{1/2}\right]} {qR\sin\alpha \left(1-t^2\right)^{1/2}} The $\left<\ldots\right>$ brackets denote an average of the structure over all orientations. $\left$ is then the form factor, $P(q)$. all orientations. $\left$ is then the form factor, $P(q)$. The scale factor is equivalent to the volume fraction of cylinders, each of volume, $V$. Contrast $\Delta\rho$ is the difference of scattering length * **Author:** NIST IGOR/DANSE **Date:** pre 2010 * **Last Modified by:** Paul Butler **Date:** March 20, 2016 * **Last Reviewed by:** Paul Butler **Date:** March 20, 2016 * **Last Reviewed by:** Richard Heenan **Date:** January 4, 2017 """ from numpy import inf
• ## sasmodels/models/capped_cylinder.py

 r0d6e865 .. math:: I(q) = \frac{\Delta \rho^2}{V} \left I(q) = \frac{\Delta \rho^2}{V} \left where the amplitude $A(q)$ is given as where the amplitude $A(q,\alpha)$ with the rod axis at angle $\alpha$ to $q$ is given as .. math:: A(q) =&\ \pi r^2L \frac{\sin\left(\tfrac12 qL\cos\theta\right)} {\tfrac12 qL\cos\theta} \frac{2 J_1(qr\sin\theta)}{qr\sin\theta} \\ \frac{\sin\left(\tfrac12 qL\cos\alpha\right)} {\tfrac12 qL\cos\alpha} \frac{2 J_1(qr\sin\alpha)}{qr\sin\alpha} \\ &\ + 4 \pi R^3 \int_{-h/R}^1 dt \cos\left[ q\cos\theta \cos\left[ q\cos\alpha \left(Rt + h + {\tfrac12} L\right)\right] \times (1-t^2) \frac{J_1\left[qR\sin\theta \left(1-t^2\right)^{1/2}\right]} {qR\sin\theta \left(1-t^2\right)^{1/2}} \frac{J_1\left[qR\sin\alpha \left(1-t^2\right)^{1/2}\right]} {qR\sin\alpha \left(1-t^2\right)^{1/2}} The $\left<\ldots\right>$ brackets denote an average of the structure over * **Author:** NIST IGOR/DANSE **Date:** pre 2010 * **Last Modified by:** Paul Butler **Date:** September 30, 2016 * **Last Reviewed by:** Richard Heenan **Date:** March 19, 2016 * **Last Reviewed by:** Richard Heenan **Date:** January 4, 2017 """ from numpy import inf
• ## sasmodels/models/core_shell_bicelle.py

 ra23639a I(Q,\alpha) = \frac{\text{scale}}{V_t} \cdot F(Q,\alpha)^2 + \text{background} F(Q,\alpha)^2.sin(\alpha) + \text{background} where * **Author:** NIST IGOR/DANSE **Date:** pre 2010 * **Last Modified by:** Paul Butler **Date:** September 30, 2016 * **Last Reviewed by:** Richard Heenan **Date:** October 5, 2016 * **Last Reviewed by:** Richard Heenan **Date:** January 4, 2017 """
• ## sasmodels/models/core_shell_cylinder.py

 r755ecc2 .. math:: I(q,\alpha) = \frac{\text{scale}}{V_s} F^2(q) + \text{background} I(q,\alpha) = \frac{\text{scale}}{V_s} F^2(q,\alpha).sin(\alpha) + \text{background} where .. math:: F(q) = &\ (\rho_c - \rho_s) V_c F(q,\alpha) = &\ (\rho_c - \rho_s) V_c \frac{\sin \left( q \tfrac12 L\cos\alpha \right)} {q \tfrac12 L\cos\alpha}
• ## sasmodels/models/core_shell_ellipsoid.py

 r73e08ae qy = q*sin(phi) # After redefinition of angles find new reasonable values for unit test #tests = [ #    # Accuracy tests based on content in test/utest_coreshellellipsoidXTmodel.py #    [{'radius_equat_core': 200.0, #      'x_core': 0.1, #      'thick_shell': 50.0, #      'x_polar_shell': 0.2, #      'sld_core': 2.0, #      'sld_shell': 1.0, #      'sld_solvent': 6.3, #      'background': 0.001, #      'scale': 1.0, #     }, 1.0, 0.00189402], tests = [ # Accuracy tests based on content in test/utest_coreshellellipsoidXTmodel.py [{'radius_equat_core': 200.0, 'x_core': 0.1, 'thick_shell': 50.0, 'x_polar_shell': 0.2, 'sld_core': 2.0, 'sld_shell': 1.0, 'sld_solvent': 6.3, 'background': 0.001, 'scale': 1.0, }, 1.0, 0.00189402], # Additional tests with larger range of parameters #    [{'background': 0.01}, 0.1, 11.6915], #    [{'radius_equat_core': 20.0, #      'x_core': 200.0, #      'thick_shell': 54.0, #      'x_polar_shell': 3.0, #      'sld_core': 20.0, #      'sld_shell': 10.0, #      'sld_solvent': 6.0, #      'background': 0.0, #      'scale': 1.0, #     }, 0.01, 8688.53], #   [{'background': 0.001}, (0.4, 0.5), 0.00690673], #   [{'radius_equat_core': 20.0, #      'x_core': 200.0, #      'thick_shell': 54.0, #      'x_polar_shell': 3.0, #      'sld_core': 20.0, #      'sld_shell': 10.0, #      'sld_solvent': 6.0, #      'background': 0.01, #      'scale': 0.01, #     }, (qx, qy), 0.0100002], #    ] [{'background': 0.01}, 0.1, 11.6915], [{'radius_equat_core': 20.0, 'x_core': 200.0, 'thick_shell': 54.0, 'x_polar_shell': 3.0, 'sld_core': 20.0, 'sld_shell': 10.0, 'sld_solvent': 6.0, 'background': 0.0, 'scale': 1.0, }, 0.01, 8688.53], [{'background': 0.001}, (0.4, 0.5), 0.00690673], [{'radius_equat_core': 20.0, 'x_core': 200.0, 'thick_shell': 54.0, 'x_polar_shell': 3.0, 'sld_core': 20.0, 'sld_shell': 10.0, 'sld_solvent': 6.0, 'background': 0.01, 'scale': 0.01, # assuming theta and phi zero here? }, (qx, qy), 0.01000025], ]
• ## sasmodels/models/cylinder.py

 r4cdd0cc # Note: model title and parameter table are inserted automatically r""" The form factor is normalized by the particle volume V = \piR^2L. For information about polarised and magnetic scattering, see the :ref:magnetism documentation. .. math:: P(q,\alpha) = \frac{\text{scale}}{V} F^2(q,\alpha) + \text{background} P(q,\alpha) = \frac{\text{scale}}{V} F^2(q,\alpha).sin(\alpha) + \text{background} where \frac{J_1 \left(q R \sin \alpha\right)}{q R \sin \alpha} and $\alpha$ is the angle between the axis of the cylinder and $\vec q$, $V$ and $\alpha$ is the angle between the axis of the cylinder and $\vec q$, $V =\pi R^2L$ is the volume of the cylinder, $L$ is the length of the cylinder, $R$ is the radius of the cylinder, and $\Delta\rho$ (contrast) is the scattering length .. math:: F^2(q)=\int_{0}^{\pi/2}{F^2(q,\theta)\sin(\theta)d\theta} F^2(q)=\int_{0}^{\pi/2}{F^2(q,\alpha)\sin(\alpha)d\alpha}=\int_{0}^{1}{F^2(q,u)du} To provide easy access to the orientation of the cylinder, we define the axis of the cylinder using two angles $\theta$ and $\phi$. Those angles Numerical integration is simplified by a change of variable to $u = cos(\alpha)$ with $sin(\alpha)=\sqrt{1-u^2}$. The output of the 1D scattering intensity function for randomly oriented cylinders is thus given by .. math:: P(q) = \frac{\text{scale}}{V} \int_0^{\pi/2} F^2(q,\alpha) \sin \alpha\ d\alpha + \text{background} NB: The 2nd virial coefficient of the cylinder is calculated based on the radius and length values, and used as the effective radius for $S(q)$ when $P(q) \cdot S(q)$ is applied. For oriented cylinders, we define the direction of the axis of the cylinder using two angles $\theta$ (note this is not the same as the scattering angle used in q) and $\phi$. Those angles are defined in :numref:cylinder-angle-definition . Definition of the angles for oriented cylinders. NB: The 2nd virial coefficient of the cylinder is calculated based on the radius and length values, and used as the effective radius for $S(q)$ when $P(q) \cdot S(q)$ is applied. The output of the 1D scattering intensity function for randomly oriented cylinders is then given by .. math:: P(q) = \frac{\text{scale}}{V} \int_0^{\pi/2} F^2(q,\alpha) \sin \alpha\ d\alpha + \text{background} The $\theta$ and $\phi$ parameters are not used for the 1D output. The $\theta$ and $\phi$ parameters only appear in the model when fitting 2d data. Validation P(q) = \int_0^{\pi/2} d\phi \int_0^\pi p(\alpha) P_0(q,\alpha) \sin \alpha\ d\alpha \int_0^\pi p(\theta) P_0(q,\theta) \sin \theta\ d\theta where $p(\theta,\phi) = 1$ is the probability distribution for the orientation and $P_0(q,\alpha)$ is the scattering intensity for the fully oriented and $P_0(q,\theta)$ is the scattering intensity for the fully oriented system, and then comparing to the 1D result. qx, qy = 0.2 * np.cos(2.5), 0.2 * np.sin(2.5) # After redefinition of angles, find new tests values #tests = [[{}, 0.2, 0.042761386790780453], #         [{}, [0.2], [0.042761386790780453]], #         [{'theta':10.0, 'phi':10.0}, (qx, qy), 0.03514647218513852], #         [{'theta':10.0, 'phi':10.0}, [(qx, qy)], [0.03514647218513852]], #        ] # After redefinition of angles, find new tests values.  Was 10 10 in old coords tests = [[{}, 0.2, 0.042761386790780453], [{}, [0.2], [0.042761386790780453]], #  expect new      [{'theta':80.1534480601659, 'phi':10.1510817110481}, (qx, qy), 0.03514647218513852], #         [{'theta':80.1534480601659, 'phi':10.1510817110481}, [(qx, qy)], [0.03514647218513852]], # old, but calcs .0344268         [{'theta':10.0, 'phi':10.0}, (qx, qy), 0.03514647218513852], #                       [{'theta':10.0, 'phi':10.0}, [(qx, qy)], [0.03514647218513852]], ] del qx, qy  # not necessary to delete, but cleaner # ADDED by:  RKH  ON: 18Mar2016 renamed sld's etc
• ## sasmodels/models/elliptical_cylinder.py

 ra807206 I(\vec q)=\frac{1}{V_\text{cyl}}\int{d\psi}\int{d\phi}\int{ p(\theta,\phi,\psi)F^2(\vec q,\alpha,\psi)\sin(\theta)d\theta} p(\theta,\phi,\psi)F^2(\vec q,\alpha,\psi)\sin(\alpha)d\alpha} with the functions .. math:: F(\vec q,\alpha,\psi) = 2\frac{J_1(a)\sin(b)}{ab} F(q,\alpha,\psi) = 2\frac{J_1(a)\sin(b)}{ab} where .. math:: a &= \vec q\sin(\alpha)\left[ r^2_\text{major}\sin^2(\psi)+r^2_\text{minor}\cos(\psi) \right]^{1/2} a = qr'\sin(\alpha) b = q\frac{L}{2}\cos(\alpha) r'=\frac{r_{minor}}{\sqrt{2}}\sqrt{(1+\nu^{2}) + (1-\nu^{2})cos(\psi)} b &= \vec q\frac{L}{2}\cos(\alpha) and the angle $\Psi$ is defined as the orientation of the major axis of the and the angle $\psi$ is defined as the orientation of the major axis of the ellipse with respect to the vector $\vec q$. The angle $\alpha$ is the angle between the axis of the cylinder and $\vec q$. L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and Neutron Scattering*, Plenum, New York, (1987) Neutron Scattering*, Plenum, New York, (1987) [see table 3.4] Authorship and Verification ---------------------------- * **Author:** * **Last Modified by:** * **Last Reviewed by:**  Richard Heenan - corrected equation in docs **Date:** December 21, 2016 """
Note: See TracChangeset for help on using the changeset viewer.