Changeset 30b60d2 in sasmodels
- Timestamp:
- Sep 5, 2017 2:39:41 PM (7 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:
- 3a45c2c
- Parents:
- 64eecf7
- Files:
-
- 1 added
- 1 deleted
- 14 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
doc/conf.py
r8ae8532 r30b60d2 211 211 #latex_preamble = '' 212 212 LATEX_PREAMBLE=r""" 213 \newcommand{\lt}{<} 214 \newcommand{\gt}{>} 213 215 \renewcommand{\AA}{\text{\r{A}}} % Allow \AA in math mode 214 216 \usepackage[utf8]{inputenc} % Allow unicode symbols in text -
doc/guide/plugin.rst
r870a2f4 r30b60d2 117 117 Models that do not conform to these requirements will *never* be incorporated 118 118 into the built-in library. 119 120 More complete documentation for the sasmodels package can be found at121 `<http://www.sasview.org/sasmodels>`_. In particular,122 `<http://www.sasview.org/sasmodels/api/generate.html#module-sasmodels.generate>`_123 describes the structure of a model.124 119 125 120 … … 613 608 614 609 sas_gamma(x): 615 Gamma function $\text{sas_gamma}(x) = \Gamma(x)$.610 Gamma function sas_gamma\ $(x) = \Gamma(x)$. 616 611 617 612 The standard math function, tgamma(x) is unstable for $x < 1$ … … 623 618 sas_erf(x), sas_erfc(x): 624 619 Error function 625 $\text{sas_erf}(x) = \frac{2}{\sqrt\pi}\int_0^x e^{-t^2}\,dt$620 sas_erf\ $(x) = \frac{2}{\sqrt\pi}\int_0^x e^{-t^2}\,dt$ 626 621 and complementary error function 627 $\text{sas_erfc}(x) = \frac{2}{\sqrt\pi}\int_x^{\infty} e^{-t^2}\,dt$.622 sas_erfc\ $(x) = \frac{2}{\sqrt\pi}\int_x^{\infty} e^{-t^2}\,dt$. 628 623 629 624 The standard math functions erf(x) and erfc(x) are slower and broken … … 634 629 635 630 sas_J0(x): 636 Bessel function of the first kind $\text{sas_J0}(x)=J_0(x)$ where631 Bessel function of the first kind sas_J0\ $(x)=J_0(x)$ where 637 632 $J_0(x) = \frac{1}{\pi}\int_0^\pi \cos(x\sin(\tau))\,d\tau$. 638 633 … … 643 638 644 639 sas_J1(x): 645 Bessel function of the first kind $\text{sas_J1}(x)=J_1(x)$ where640 Bessel function of the first kind sas_J1\ $(x)=J_1(x)$ where 646 641 $J_1(x) = \frac{1}{\pi}\int_0^\pi \cos(\tau - x\sin(\tau))\,d\tau$. 647 642 … … 652 647 653 648 sas_JN(n, x): 654 Bessel function of the first kind and integer order $n$ :655 $\text{sas_JN}(n, x)=J_n(x)$ where649 Bessel function of the first kind and integer order $n$, 650 sas_JN\ $(n, x) =J_n(x)$ where 656 651 $J_n(x) = \frac{1}{\pi}\int_0^\pi \cos(n\tau - x\sin(\tau))\,d\tau$. 657 If $n$ = 0 or 1, it uses sas_J0( x) or sas_J1(x), respectively.652 If $n$ = 0 or 1, it uses sas_J0($x$) or sas_J1($x$), respectively. 658 653 659 654 The standard math function jn(n, x) is not available on all platforms. … … 663 658 664 659 sas_Si(x): 665 Sine integral $\text{Si}(x) = \int_0^x \tfrac{\sin t}{t}\,dt$.660 Sine integral Si\ $(x) = \int_0^x \tfrac{\sin t}{t}\,dt$. 666 661 667 662 This function uses Taylor series for small and large arguments: … … 688 683 sas_3j1x_x(x): 689 684 Spherical Bessel form 690 $\text{sph_j1c}(x) = 3 j_1(x)/x = 3 (\sin(x) - x \cos(x))/x^3$,685 sph_j1c\ $(x) = 3 j_1(x)/x = 3 (\sin(x) - x \cos(x))/x^3$, 691 686 with a limiting value of 1 at $x=0$, where $j_1(x)$ is the spherical 692 687 Bessel function of the first kind and first order. … … 699 694 700 695 sas_2J1x_x(x): 701 Bessel form $\text{sas_J1c}(x) = 2 J_1(x)/x$, with a limiting value696 Bessel form sas_J1c\ $(x) = 2 J_1(x)/x$, with a limiting value 702 697 of 1 at $x=0$, where $J_1(x)$ is the Bessel function of first kind 703 698 and first order. -
doc/guide/resolution.rst
rf8a2baa r30b60d2 212 212 elliptical Gaussian distribution. The $A$ is a normalization factor. 213 213 214 .. figure:: resolution_2d_rotation. gif214 .. figure:: resolution_2d_rotation.png 215 215 216 216 Coordinate axis rotation for 2D resolution calculation. -
doc/rst_prolog
refb7615 r30b60d2 1 1 .. Set up some substitutions to make life easier... 2 .. Remove |biggamma|, etc. when they are no longer needed.3 4 5 .. |alpha| unicode:: U+03B16 .. |beta| unicode:: U+03B27 .. |gamma| unicode:: U+03B38 .. |delta| unicode:: U+03B49 .. |epsilon| unicode:: U+03B510 .. |zeta| unicode:: U+03B611 .. |eta| unicode:: U+03B712 .. |theta| unicode:: U+03B813 .. |iota| unicode:: U+03B914 .. |kappa| unicode:: U+03BA15 .. |lambda| unicode:: U+03BB16 .. |mu| unicode:: U+03BC17 .. |nu| unicode:: U+03BD18 .. |xi| unicode:: U+03BE19 .. |omicron| unicode:: U+03BF20 .. |pi| unicode:: U+03C021 .. |rho| unicode:: U+03C122 .. |sigma| unicode:: U+03C323 .. |tau| unicode:: U+03C424 .. |upsilon| unicode:: U+03C525 .. |phi| unicode:: U+03C626 .. |chi| unicode:: U+03C727 .. |psi| unicode:: U+03C828 .. |omega| unicode:: U+03C929 30 31 .. |biggamma| unicode:: U+039332 .. |bigdelta| unicode:: U+039433 .. |bigzeta| unicode:: U+039E34 .. |bigpsi| unicode:: U+03A835 .. |bigphi| unicode:: U+03A636 .. |bigsigma| unicode:: U+03A337 .. |Gamma| unicode:: U+039338 .. |Delta| unicode:: U+039439 .. |Zeta| unicode:: U+039E40 .. |Psi| unicode:: U+03A841 42 .. |drho| replace:: |Delta|\ |rho|43 .. |equiv| unicode:: U+226144 .. |noteql| unicode:: U+226045 .. |TM| unicode:: U+212246 .. |P0| replace:: P\ :sub:`0`\47 .. |A2| replace:: A\ :sub:`2`\48 2 49 3 .. |Ang| unicode:: U+212B … … 63 17 .. |sr^-1| replace:: sr\ :sup:`-1` 64 18 65 66 67 19 .. |cdot| unicode:: U+00B7 68 20 .. |deg| unicode:: U+00B0 -
sasmodels/generate.py
r573ffab r30b60d2 210 210 211 211 # Conversion from units defined in the parameter table for each model 212 # to units displayed in the sphinx documentation. 212 # to units displayed in the sphinx documentation. 213 213 # This section associates the unit with the macro to use to produce the LaTex 214 214 # code. The macro itself needs to be defined in sasmodels/doc/rst_prolog. … … 216 216 # NOTE: there is an RST_PROLOG at the end of this file which is NOT 217 217 # used for the bundled documentation. Still as long as we are defining the macros 218 # in two places any new addition should define the macro in both places. 218 # in two places any new addition should define the macro in both places. 219 219 RST_UNITS = { 220 220 "Ang": "|Ang|", … … 898 898 .. |cm^-3| replace:: cm\ :sup:`-3` 899 899 .. |sr^-1| replace:: sr\ :sup:`-1` 900 .. |P0| replace:: P\ :sub:`0`\901 902 .. |equiv| unicode:: U+2261903 .. |noteql| unicode:: U+2260904 .. |TM| unicode:: U+2122905 900 906 901 .. |cdot| unicode:: U+00B7 -
sasmodels/models/binary_hard_sphere.py
r8f04da4 r30b60d2 23 23 :nowrap: 24 24 25 \begin{align }25 \begin{align*} 26 26 x &= \frac{(\phi_2 / \phi)\alpha^3}{(1-(\phi_2/\phi) + (\phi_2/\phi) 27 27 \alpha^3)} \\ 28 28 \phi &= \phi_1 + \phi_2 = \text{total volume fraction} \\ 29 29 \alpha &= R_1/R_2 = \text{size ratio} 30 \end{align }30 \end{align*} 31 31 32 32 The 2D scattering intensity is the same as 1D, regardless of the orientation of -
sasmodels/models/core_shell_bicelle.py
r64eecf7 r30b60d2 25 25 scattering length density variation along the cylinder axis is: 26 26 27 .. 28 29 .. math:: 27 .. math:: 30 28 31 29 \rho(r) = … … 50 48 :nowrap: 51 49 52 \begin{align }50 \begin{align*} 53 51 F(Q,\alpha) = &\bigg[ 54 52 (\rho_c - \rho_f) V_c \frac{2J_1(QRsin \alpha)}{QRsin\alpha}\frac{sin(QLcos\alpha/2)}{Q(L/2)cos\alpha} \\ … … 56 54 &+(\rho_r - \rho_s) V_t \frac{2J_1(Q(R+t_r)sin\alpha)}{Q(R+t_r)sin\alpha}\frac{sin(Q(L/2+t_f)cos\alpha)}{Q(L/2+t_f)cos\alpha} 57 55 \bigg] 58 \end{align }56 \end{align*} 59 57 60 58 where $V_t$ is the total volume of the bicelle, $V_c$ the volume of the core, -
sasmodels/models/core_shell_bicelle_elliptical.py
r64eecf7 r30b60d2 49 49 :nowrap: 50 50 51 \begin{align }51 \begin{align*} 52 52 F(Q,\alpha,\psi) = &\bigg[ 53 53 (\rho_c - \rho_f) V_c \frac{2J_1(QR'sin \alpha)}{QR'sin\alpha}\frac{sin(QLcos\alpha/2)}{Q(L/2)cos\alpha} \\ … … 55 55 &+(\rho_r - \rho_s) V_t \frac{2J_1(Q(R'+t_r)sin\alpha)}{Q(R'+t_r)sin\alpha}\frac{sin(Q(L/2+t_f)cos\alpha)}{Q(L/2+t_f)cos\alpha} 56 56 \bigg] 57 \end{align }57 \end{align*} 58 58 59 59 where -
sasmodels/models/core_shell_ellipsoid.py
r64eecf7 r30b60d2 46 46 :nowrap: 47 47 48 \begin{align }48 \begin{align*} 49 49 F(q,\alpha) = &f(q,radius\_equat\_core,radius\_equat\_core.x\_core,\alpha) \\ 50 50 &+ f(q,radius\_equat\_core + thick\_shell,radius\_equat\_core.x\_core + thick\_shell.x\_polar\_shell,\alpha) 51 \end{align }51 \end{align*} 52 52 53 53 where -
sasmodels/models/hollow_rectangular_prism.py
r8f04da4 r30b60d2 31 31 :nowrap: 32 32 33 \begin{align }33 \begin{align*} 34 34 A_{P\Delta}(q) & = A B C 35 35 \left[\frac{\sin \bigl( q \frac{C}{2} \cos\theta \bigr)} … … 47 47 \left[ \frac{\sin \bigl[ q \bigl(\frac{B}{2}-\Delta\bigr) \sin\theta \cos\phi \bigr]} 48 48 {q \bigl(\frac{B}{2}-\Delta\bigr) \sin\theta \cos\phi} \right] 49 \end{align }49 \end{align*} 50 50 51 51 where $A$, $B$ and $C$ are the external sides of the parallelepiped fulfilling -
sasmodels/models/parallelepiped.py
r8f04da4 r30b60d2 20 20 Parallelepiped with the corresponding definition of sides. 21 21 22 .. note:: 23 24 The three dimensions of the parallelepiped (strictly here a cuboid) may be given in 25 $any$ size order. To avoid multiple fit solutions, especially 26 with Monte-Carlo fit methods, it may be advisable to restrict their ranges. There may 27 be a number of closely similar "best fits", so some trial and error, or fixing of some 28 dimensions at expected values, may help. 22 The three dimensions of the parallelepiped (strictly here a cuboid) may be 23 given in *any* size order. To avoid multiple fit solutions, especially 24 with Monte-Carlo fit methods, it may be advisable to restrict their ranges. 25 There may be a number of closely similar "best fits", so some trial and 26 error, or fixing of some dimensions at expected values, may help. 29 27 30 28 The 1D scattering intensity $I(q)$ is calculated as: -
sasmodels/models/rpa.py
r4f9e288 r30b60d2 30 30 These case numbers are different from those in the NIST SANS package! 31 31 32 The models are based on the papers by Akcasu et al. [#Akcasu]_and by33 Hammouda [#Hammouda]_assuming the polymer follows Gaussian statistics such32 The models are based on the papers by Akcasu *et al.* and by 33 Hammouda assuming the polymer follows Gaussian statistics such 34 34 that $R_g^2 = n b^2/6$ where $b$ is the statistical segment length and $n$ is 35 35 the number of statistical segment lengths. A nice tutorial on how these are 36 36 constructed and implemented can be found in chapters 28 and 39 of Boualem 37 Hammouda's 'SANS Toolbox' [#toolbox]_.37 Hammouda's 'SANS Toolbox'. 38 38 39 39 In brief the macroscopic cross sections are derived from the general forms … … 49 49 are calculated with respect to component D).** So the scattering contrast 50 50 for a C/D blend = [SLD(component C) - SLD(component D)]\ :sup:`2`. 51 * Depending on which case is being used, the number of fitting parameters can 51 * Depending on which case is being used, the number of fitting parameters can 52 52 vary. 53 53 … … 57 57 component are obtained from other methods and held fixed while The *scale* 58 58 parameter should be held equal to unity. 59 * The variables are normally the segment lengths (b\ :sub:`a`, b\ :sub:`b`, 60 etc) and $\chi$ parameters (K\ :sub:`ab`, K\ :sub:`ac`, etc). 61 59 * The variables are normally the segment lengths ($b_a$, $b_b$, 60 etc.) and $\chi$ parameters ($K_{ab}$, $K_{ac}$, etc). 62 61 63 62 References 64 63 ---------- 65 64 66 .. [#Akcasu] A Z Akcasu, R Klein and B Hammouda, *Macromolecules*, 26 (1993) 67 4136. 68 .. [#Hammouda] B. Hammouda, *Advances in Polymer Science* 106 (1993) 87. 69 .. [#toolbox] https://www.ncnr.nist.gov/staff/hammouda/the_sans_toolbox.pdf 65 A Z Akcasu, R Klein and B Hammouda, *Macromolecules*, 26 (1993) 4136. 66 67 B. Hammouda, *Advances in Polymer Science* 106 (1993) 87. 68 69 B. Hammouda, *SANS Toolbox* 70 https://www.ncnr.nist.gov/staff/hammouda/the_sans_toolbox.pdf. 70 71 71 72 Authorship and Verification -
sasmodels/models/star_polymer.py
r142a8e2 r30b60d2 7 7 emanating from a common central (in the case of this model) point. It is 8 8 derived as a special case of on the Benoit model for general branched 9 polymers\ [#CITBenoit]_ as also used by Richter ''et. al.''\ [#CITRichter]_9 polymers\ [#CITBenoit]_ as also used by Richter *et al.*\ [#CITRichter]_ 10 10 11 11 For a star with $f$ arms the scattering intensity $I(q)$ is calculated as -
sasmodels/models/surface_fractal.py
r48462b0 r30b60d2 9 9 10 10 .. math:: 11 :nowrap: 11 12 13 \begin{align*} 12 14 I(q) &= \text{scale} \times P(q)S(q) + \text{background} \\ 13 15 P(q) &= F(qR)^2 \\ … … 15 17 S(q) &= \Gamma(5-D_S)\xi^{\,5-D_S}\left[1+(q\xi)^2 \right]^{-(5-D_S)/2} 16 18 \sin\left[-(5-D_S) \tan^{-1}(q\xi) \right] q^{-1} \\ 17 \text{scale} &= \text{scale _factor}\, N V^2(\rho_\text{particle} - \rho_\text{solvent})^2 \\19 \text{scale} &= \text{scale factor}\, N V^1(\rho_\text{particle} - \rho_\text{solvent})^2 \\ 18 20 V &= \frac{4}{3}\pi R^3 21 \end{align*} 19 22 20 23 where $R$ is the radius of the building block, $D_S$ is the **surface** fractal
Note: See TracChangeset
for help on using the changeset viewer.