Changeset 1a3c0c6 in sasmodels

Ignore:
Timestamp:
Sep 8, 2018 9:13:29 AM (10 months ago)
Branches:
master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
c11d09f, ca4444f
Parents:
475ff58 (diff), 5601947 (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:
Paul Butler <butlerpd@…> (09/08/18 09:13:29)
git-committer:
Message:

Merge pull request #78 from SasView?/ticket-1160-VR

Ticket 1160 vr

Besides fixing the VR (removing from core_shell models and fixing hollow_cylinder) cleaned up a bunch of model documentation. Also realized that the 3 issues raised in ticket 1030 were mostly addressed so fixed last small docs issue as per Richard Heenan in order to close both tickets at once.

Closes #1160; closes #1030

Location:
sasmodels/models
Files:
9 edited

Unmodified
Removed
• sasmodels/models/core_shell_cylinder.py

 r2d81cfe The output of the 2D scattering intensity function for oriented core-shell cylinders is given by (Kline, 2006 [#kline]_). The form factor is normalized by the particle volume. by the particle volume. Note that in this model the shell envelops the entire core so that besides a "sleeve" around the core, the shell also provides two flat end caps of thickness = shell thickness. In other words the length of the total cyclinder is the length of the core cylinder plus twice the thickness of the shell. If no end caps are desired one should use the :ref:core-shell-bicelle and set the thickness of the end caps (in this case the "thick_face") to zero. .. math:: and $\alpha$ is the angle between the axis of the cylinder and $\vec q$, $V_s$ is the volume of the outer shell (i.e. the total volume, including the shell), $V_c$ is the volume of the core, $L$ is the length of the core, $V_s$ is the total volume (i.e. including both the core and the outer shell), $V_c$ is the volume of the core, $L$ is the length of the core, $R$ is the radius of the core, $T$ is the thickness of the shell, $\rho_c$ is the scattering length density of the core, $\rho_s$ is the scattering return 0.5 * (ddd) ** (1. / 3.) def VR(radius, thickness, length): """ Returns volume ratio """ whole = pi * (radius + thickness) ** 2 * (length + 2 * thickness) core = pi * radius ** 2 * length return whole, whole - core def random(): outer_radius = 10**np.random.uniform(1, 4.7)
• sasmodels/models/core_shell_sphere.py

 rdc76240 return radius + thickness def VR(radius, thickness): """ Volume ratio @param radius: core radius @param thickness: shell thickness """ return (1, 1) whole = 4.0/3.0 * pi * (radius + thickness)**3 core = 4.0/3.0 * pi * radius**3 return whole, whole - core def random(): outer_radius = 10**np.random.uniform(1.3, 4.3) tests = [ [{'radius': 20.0, 'thickness': 10.0}, 'ER', 30.0], # TODO: VR test suppressed until we sort out new product model # and determine what to do with volume ratio. #[{'radius': 20.0, 'thickness': 10.0}, 'VR', 0.703703704], # The SasView test result was 0.00169, with a background of 0.001

• sasmodels/models/hollow_cylinder.py

 r2d81cfe r""" Definition ---------- This model provides the form factor, $P(q)$, for a monodisperse hollow right angle circular cylinder (rigid tube) where the form factor is normalized by the volume of the tube (i.e. not by the external volume). angle circular cylinder (rigid tube) where the The inside and outside of the hollow cylinder are assumed to have the same SLD and the form factor is thus normalized by the volume of the tube (i.e. not by the total cylinder volume). .. math:: P(q) = \text{scale} \left/V_\text{shell} + \text{background} where the averaging $\left<\ldots\right>$ is applied only for the 1D calculation. where the averaging $\left<\ldots\right>$ is applied only for the 1D calculation. If Intensity is given on an absolute scale, the scale factor here is the volume fraction of the shell.  This differs from the :ref:core-shell-cylinder in that, in that case, scale is the volume fraction of the entire cylinder (core+shell). The application might be for a bilayer which wraps into a hollow tube and the volume fraction of material is all in the shell, whereas the :ref:core-shell-cylinder model might be used for a cylindrical micelle where the tails in the core have a different SLD than the headgroups (in the shell) and the volume fraction of material comes fromm the whole cyclinder.  NOTE: the hollow_cylinder represents a tube whereas the core_shell_cylinder includes a shell layer covering the ends (end caps) as well. The inside and outside of the hollow cylinder are assumed have the same SLD. Definition ---------- The 1D scattering intensity is calculated in the following way (Guinier, 1955) ---------- L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and Neutron Scattering*, Plenum Press, New York, (1987) .. [#] L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and Neutron Scattering*, Plenum Press, New York, (1987) Authorship and Verification * **Author:** NIST IGOR/DANSE **Date:** pre 2010 * **Last Modified by:** Richard Heenan **Date:** October 06, 2016 (reparametrised to use thickness, not outer radius) * **Last Reviewed by:** Richard Heenan **Date:** October 06, 2016 * **Last Modified by:** Paul Butler **Date:** September 06, 2018 (corrected VR calculation) * **Last Reviewed by:** Paul Butler **Date:** September 06, 2018 """ vol_total = pi*router*router*length vol_shell = vol_total - vol_core return vol_shell, vol_total return vol_total, vol_shell def random(): tests = [ [{}, 0.00005, 1764.926], [{}, 'VR', 1.8], [{}, 'VR', 0.55555556], [{}, 0.001, 1756.76], [{}, (qx, qy), 2.36885476192],
• sasmodels/models/hollow_rectangular_prism.py

 r0e55afe # Note: model title and parameter table are inserted automatically r""" This model provides the form factor, $P(q)$, for a hollow rectangular parallelepiped with a wall of thickness $\Delta$. Definition ---------- The 1D scattering intensity for this model is calculated by forming the difference of the amplitudes of two massive parallelepipeds differing in their outermost dimensions in each direction by the same length increment $2\Delta$ (Nayuk, 2012). This model provides the form factor, $P(q)$, for a hollow rectangular parallelepiped with a wall of thickness $\Delta$. The 1D scattering intensity for this model is calculated by forming the difference of the amplitudes of two massive parallelepipeds differing in their outermost dimensions in each direction by the same length increment $2\Delta$ (\ [#Nayuk2012]_ Nayuk, 2012). As in the case of the massive parallelepiped model (:ref:rectangular-prism), \rho_\text{solvent})^2 \times P(q) + \text{background} where $\rho_\text{p}$ is the scattering length of the parallelepiped, $\rho_\text{solvent}$ is the scattering length of the solvent, where $\rho_\text{p}$ is the scattering length density of the parallelepiped, $\rho_\text{solvent}$ is the scattering length density of the solvent, and (if the data are in absolute units) *scale* represents the volume fraction (which is unitless). (which is unitless) of the rectangular shell of material (i.e. not including the volume of the solvent filled core). For 2d data the orientation of the particle is required, described using For 2d, constraints must be applied during fitting to ensure that the inequality $A < B < C$ is not violated, and hence the correct definition of angles is preserved. The calculation will not report an error, but the results may be not correct. $A < B < C$ is not violated, and hence the correct definition of angles is preserved. The calculation will not report an error if the inequality is *not* preserved, but the results may be not correct. .. figure:: img/parallelepiped_angle_definition.png ---------- R Nayuk and K Huber, *Z. Phys. Chem.*, 226 (2012) 837-854 .. [#Nayuk2012] R Nayuk and K Huber, *Z. Phys. Chem.*, 226 (2012) 837-854 Authorship and Verification ---------------------------- * **Author:** Miguel Gonzales **Date:** February 26, 2016 * **Last Modified by:** Paul Kienzle **Date:** December 14, 2017 * **Last Reviewed by:** Paul Butler **Date:** September 06, 2018 """
• sasmodels/models/hollow_rectangular_prism_thin_walls.py

 r2d81cfe # Note: model title and parameter table are inserted automatically r""" Definition ---------- This model provides the form factor, $P(q)$, for a hollow rectangular prism with infinitely thin walls. It computes only the 1D scattering, not the 2D. Definition ---------- The 1D scattering intensity for this model is calculated according to the equations given by Nayuk and Huber (Nayuk, 2012). equations given by Nayuk and Huber\ [#Nayuk2012]_. Assuming a hollow parallelepiped with infinitely thin walls, edge lengths I(q) = \text{scale} \times V \times (\rho_\text{p} - \rho_\text{solvent})^2 \times P(q) where $V$ is the volume of the rectangular prism, $\rho_\text{p}$ is the scattering length of the parallelepiped, $\rho_\text{solvent}$ is the scattering length of the solvent, and (if the data are in absolute units) *scale* represents the volume fraction (which is unitless). where $V$ is the surface area of the rectangular prism, $\rho_\text{p}$ is the scattering length density of the parallelepiped, $\rho_\text{solvent}$ is the scattering length density of the solvent, and (if the data are in absolute units) *scale* is related to the total surface area. **The 2D scattering intensity is not computed by this model.** Validation of the code was conducted  by qualitatively comparing the output of the 1D model to the curves shown in (Nayuk, 2012). of the 1D model to the curves shown in (Nayuk, 2012\ [#Nayuk2012]_). ---------- R Nayuk and K Huber, *Z. Phys. Chem.*, 226 (2012) 837-854 .. [#Nayuk2012] R Nayuk and K Huber, *Z. Phys. Chem.*, 226 (2012) 837-854 Authorship and Verification ---------------------------- * **Author:** Miguel Gonzales **Date:** February 26, 2016 * **Last Modified by:** Paul Kienzle **Date:** October 15, 2016 * **Last Reviewed by:** Paul Butler **Date:** September 07, 2018 """
• sasmodels/models/spherical_sld.py

 r2d81cfe r""" Definition ---------- Similarly to the onion, this model provides the form factor, $P(q)$, for a multi-shell sphere, where the interface between the each neighboring interface. The form factor is normalized by the total volume of the sphere. Interface shapes are as follows:: Interface shapes are as follows: 0: erf($\nu z$) 1: Rpow($z^\nu$) 2: Lpow($z^\nu$) 3: Rexp($-\nu z$) 4: Lexp($-\nu z$) Definition ---------- The form factor $P(q)$ in 1D is calculated by: when $P(Q) * S(Q)$ is applied. References ---------- L A Feigin and D I Svergun, Structure Analysis by Small-Angle X-Ray and Neutron Scattering, Plenum Press, New York, (1987) .. [#] L A Feigin and D I Svergun, Structure Analysis by Small-Angle X-Ray and Neutron Scattering, Plenum Press, New York, (1987) Authorship and Verification ---------------------------- * **Author:** Jae-Hie Cho **Date:** Nov 1, 2010 * **Last Modified by:** Paul Kienzle **Date:** Dec 20, 2016 * **Last Reviewed by:** Paul Butler **Date:** September 8, 2018 """
• sasmodels/models/vesicle.py

 ref07e95 ---------- The 1D scattering intensity is calculated in the following way (Guinier, 1955) This model provides the form factor, *P(q)*, for an unilamellar vesicle and is effectively identical to the hollow sphere reparameterized to be more intuitive for a vesicle and normalizing the form factor by the volume of the shell. The 1D scattering intensity is calculated in the following way (Guinier,1955\ [#Guinier1955]_) .. math:: ---------- A Guinier and G. Fournet, *Small-Angle Scattering of X-Rays*, John Wiley and Sons, New York, (1955) .. [#Guinier1955] A Guinier and G. Fournet, *Small-Angle Scattering of X-Rays*, John Wiley and Sons, New York, (1955) Authorship and Verification ---------------------------- * **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:** Paul Butler **Date:** September 7, 2018 """ name = "vesicle" title = "This model provides the form factor, *P(q)*, for an unilamellar \ vesicle. This is model is effectively identical to the hollow sphere \ reparameterized to be more intuitive for a vesicle and normalizing the \ form factor by the volume of the shell." title = "Vesicle model representing a hollow sphere" description = """ Model parameters:
• sasmodels/models/spinodal.py

 ref07e95 ---------- This model calculates the SAS signal of a phase separating solution under spinodal decomposition. The scattering intensity $I(q)$ is calculated as This model calculates the SAS signal of a phase separating system undergoing spinodal decomposition. The scattering intensity $I(q)$ is calculated as .. math:: I(q) = I_{max}\frac{(1+\gamma/2)x^2}{\gamma/2+x^{2+\gamma}}+B where $x=q/q_0$ and $B$ is a flat background. The characteristic structure length scales with the correlation peak at $q_0$. The exponent $\gamma$ is equal to $d+1$ with d the dimensionality of the off-critical concentration mixtures. A transition to $\gamma=2d$ is seen near the percolation threshold into the critical concentration regime. where $x=q/q_0$, $q_0$ is the peak position, $I_{max}$ is the intensity at $q_0$ (parameterised as the $scale$ parameter), and $B$ is a flat background. The spinodal wavelength is given by $2\pi/q_0$. The exponent $\gamma$ is equal to $d+1$ for off-critical concentration mixtures (smooth interfaces) and $2d$ for critical concentration mixtures (entangled interfaces), where $d$ is the dimensionality (ie, 1, 2, 3) of the system. Thus 2 <= $\gamma$ <= 6. A transition from $\gamma=d+1$ to $\gamma=2d$ is expected near the percolation threshold. As this function tends to zero as $q$ tends to zero, in practice it may be necessary to combine it with another function describing the low-angle scattering, or to simply omit the low-angle scattering from the fit. References Physica A 123,497 (1984). Authorship and Verification ---------------------------- Revision History ---------------- * **Author:** Dirk Honecker **Date:** Oct 7, 2016 * **Author:**  Dirk Honecker **Date:** Oct 7, 2016 * **Revised:** Steve King    **Date:** Sep 7, 2018 """ title = "Spinodal decomposition model" description = """\ I(q) = scale ((1+gamma/2)x^2)/(gamma/2+x^(2+gamma))+background I(q) = Imax ((1+gamma/2)x^2)/(gamma/2+x^(2+gamma)) + background List of default parameters: scale = scaling gamma = exponent x = q/q_0 Imax = correlation peak intensity at q_0 background = incoherent background gamma = exponent (see model documentation) q_0 = correlation peak position [1/A] background = Incoherent background""" x = q/q_0""" category = "shape-independent"
Note: See TracChangeset for help on using the changeset viewer.