Changeset eb69cce in sasmodels


Ignore:
Timestamp:
Nov 30, 2015 9:18:41 PM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
d18f8a8
Parents:
d138d43
Message:

make model docs more consistent; build pdf docs

Location:
sasmodels
Files:
2 added
4 deleted
28 edited
1 moved

Legend:

Unmodified
Added
Removed
  • sasmodels/generate.py

    rd138d43 reb69cce  
    258258%(parameters)s 
    259259 
    260 The returned value is scaled to units of |cm^-1|. 
     260%(returns)s 
    261261 
    262262%(docs)s 
     
    609609    Return the documentation for the model. 
    610610    """ 
     611    Iq_units = "The returned value is scaled to units of |cm^-1| |sr^-1|, absolute scale." 
     612    Sq_units = "The returned value is a dimensionless structure factor, $S(q)$." 
    611613    info = make_info(kernel_module) 
     614    is_Sq = ("structure-factor" in info['category']) 
    612615    subst = dict(id=info['id'].replace('_', '-'), 
    613616                 name=info['name'], 
    614617                 title=info['title'], 
    615618                 parameters=make_partable(info['parameters']), 
     619                 returns=Sq_units if is_Sq else Iq_units, 
    616620                 docs=kernel_module.__doc__) 
    617621    return DOC_HEADER % subst 
  • sasmodels/models/HayterMSAsq.py

    rcd3dba0 reb69cce  
    11# Note: model title and parameter table are inserted automatically 
    22r""" 
    3 This calculates the structure factor (the Fourier transform of the pair correlation function *g(r)*) for a system of 
    4 charged, spheroidal objects in a dielectric medium. When combined with an appropriate form factor (such as sphere, 
    5 core+shell, ellipsoid, etc), this allows for inclusion of the interparticle interference effects due to screened coulomb 
    6 repulsion between charged particles. 
     3This calculates the structure factor (the Fourier transform of the pair 
     4correlation function $g(r)$) for a system of charged, spheroidal objects 
     5in a dielectric medium. When combined with an appropriate form factor 
     6(such as sphere, core+shell, ellipsoid, etc), this allows for inclusion 
     7of the interparticle interference effects due to screened coulomb repulsion 
     8between charged particles. 
    79 
    8 **This routine only works for charged particles**. If the charge is set to zero the routine will self-destruct! 
    9 For non-charged particles use a hard sphere potential. 
     10**This routine only works for charged particles**. If the charge is set to 
     11zero the routine will self-destruct! For non-charged particles use a hard 
     12sphere potential. 
    1013 
    11 The salt concentration is used to compute the ionic strength of the solution which in turn is used to compute the Debye 
    12 screening length. At present there is no provision for entering the ionic strength directly nor for use of any 
    13 multivalent salts. The counterions are also assumed to be monovalent. 
     14The salt concentration is used to compute the ionic strength of the solution 
     15which in turn is used to compute the Debye screening length. At present 
     16there is no provision for entering the ionic strength directly nor for use 
     17of any multivalent salts. The counterions are also assumed to be monovalent. 
    1418 
    15 For 2D data: The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as 
     19For 2D data, the scattering intensity is calculated in the same way as 1D, 
     20where the $q$ vector is defined as 
    1621 
    1722.. math:: 
    1823 
    19     Q = \sqrt{Q_x^2 + Q_y^2} 
     24    q = \sqrt{q_x^2 + q_y^2} 
    2025 
    21 ==============  ========  ============= 
    22 Parameter name  Units     Default value 
    23 ==============  ========  ============= 
    24 effect_radius   |Ang|     20.8 
    25 charge          *e*       19 
    26 volfraction     None      0.2 
    27 temperature     K         318 
    28 salt conc       M         0 
    29 dielectconst    None      71.1 
    30 ==============  ========  ============= 
     26.. figure:: img/HayterMSAsq_227.jpg 
    3127 
    32 .. image:: img/HayterMSAsq_227.jpg 
     28    1D plot using the default values (in linear scale). 
    3329 
    34 *Figure. 1D plot using the default values (in linear scale).* 
    35  
    36 REFERENCE 
     30References 
     31---------- 
    3732 
    3833J B Hayter and J Penfold, *Molecular Physics*, 42 (1981) 109-118 
  • sasmodels/models/barbell.py

    r5ef0633 reb69cce  
    11#barbell model 
    2 # cylinder model 
    32# Note: model title and parameter table are inserted automatically 
    43r""" 
    5  
    6 Calculates the scattering from a barbell-shaped cylinder (This model simply 
    7 becomes the DumBellModel when the length of the cylinder, *L*, is set to zero). 
    8 That is, a sphereocylinder with spherical end caps that have a radius larger 
    9 than that of the cylinder and the center of the end cap radius lies outside 
    10 of the cylinder. All dimensions of the BarBell are considered to be 
    11 monodisperse. See the diagram for the details of the geometry and restrictions 
    12 on parameter values. 
     4Calculates the scattering from a barbell-shaped cylinder.  Like 
     5:ref:`capped-cylinder`, this is a sphereocylinder with spherical end 
     6caps that have a radius larger than that of the cylinder, but with the center 
     7of the end cap radius lying outside of the cylinder. See the diagram for 
     8the details of the geometry and restrictions on parameter values. 
    139 
    1410Definition 
    1511---------- 
    1612 
    17 The returned value is scaled to units of |cm^-1|\ |sr^-1|, absolute scale. 
     13.. figure:: img/barbell_geometry.jpg 
    1814 
    19 The barbell geometry is defined as 
     15    Barbell geometry, where $r$ is *radius*, $R$ is *bell_radius* and 
     16    $L$ is *length*. Since the end cap radius $R \geq r$ and by definition 
     17    for this geometry $h < 0$, $h$ is then defined by $r$ and $R$ as 
     18    $h = - \sqrt{R^2 - r^2}$ 
    2019 
    21 .. image:: img/barbell_geometry.jpg 
    22  
    23 where *r* is the radius of the cylinder. All other parameters are as defined 
    24 in the diagram. 
    25  
    26 Since the end cap radius 
    27 *R* >= *r* and by definition for this geometry *h* < 0, *h* is then 
    28 defined by *r* and *R* as 
    29  
    30 *h* = -1 \* sqrt(*R*\ :sup:`2` - *r*\ :sup:`2`) 
    31  
    32 The scattered intensity *I(q)* is calculated as 
     20The scattered intensity $I(q)$ is calculated as 
    3321 
    3422.. math:: 
    3523 
    36     I(Q) = \frac{(\Delta \rho)^2}{V} \left< A^2(Q)\right> 
     24    I(q) = \frac{\Delta \rho^2}{V} \left<A^2(q)\right> 
    3725 
    38 where the amplitude *A(q)* is given as 
     26where the amplitude $A(q)$ is given as 
    3927 
    4028.. math:: 
    4129 
    42     A(Q) =&\ \pi r^2L 
    43         {\sin\left(\tfrac12 QL\cos\theta\right) 
    44             \over \tfrac12 QL\cos\theta} 
    45         {2 J_1(Qr\sin\theta) \over Qr\sin\theta} \\ 
     30    A(q) =&\ \pi r^2L 
     31        \frac{\sin\left(\tfrac12 qL\cos\theta\right)} 
     32             {\tfrac12 qL\cos\theta} 
     33        \frac{2 J_1(qr\sin\theta)}{qr\sin\theta} \\ 
    4634        &\ + 4 \pi R^3 \int_{-h/R}^1 dt 
    47         \cos\left[ Q\cos\theta 
     35        \cos\left[ q\cos\theta 
    4836            \left(Rt + h + {\tfrac12} L\right)\right] 
    4937        \times (1-t^2) 
    50         {J_1\left[QR\sin\theta \left(1-t^2\right)^{1/2}\right] 
    51              \over QR\sin\theta \left(1-t^2\right)^{1/2}} 
     38        \frac{J_1\left[qR\sin\theta \left(1-t^2\right)^{1/2}\right]} 
     39             {qR\sin\theta \left(1-t^2\right)^{1/2}} 
    5240 
    53 The < > brackets denote an average of the structure over all orientations. 
    54 <*A* :sup:`2`\ *(q)*> is then the form factor, *P(q)*. The scale factor is 
    55 equivalent to the volume fraction of cylinders, each of volume, *V*. Contrast 
    56 is the difference of scattering length densities of the cylinder and the 
    57 surrounding solvent. 
     41The $\left<\ldots\right>$ brackets denote an average of the structure over 
     42all orientations. $\left<A^2(q)\right>$ is then the form factor, $P(q)$. 
     43The scale factor is equivalent to the volume fraction of cylinders, each of 
     44volume, $V$. Contrast $\Delta\rho$ is the difference of scattering length 
     45densities of the cylinder and the surrounding solvent. 
    5846 
    5947The volume of the barbell is 
     
    6452 
    6553 
    66 and its radius-of-gyration is 
     54and its radius of gyration is 
    6755 
    6856.. math:: 
     
    7664        \left( 4R^3 6R^2h - 2h^3 + 3r^2L \right)^{-1} 
    7765 
    78 **The requirement that** *R* >= *r* **is not enforced in the model!** It is 
    79 up to you to restrict this during analysis. 
     66.. note:: 
     67    The requirement that $R \geq r$ is not enforced in the model! It is 
     68    up to you to restrict this during analysis. 
    8069 
    81 This example dataset is produced by running the Macro PlotBarbell(), 
    82 using 200 data points, *qmin* = 0.001 |Ang^-1|, *qmax* = 0.7 |Ang^-1|, 
    83 *sld* = 4e-6 |Ang^-2| and the default model values. 
     70.. figure:: img/barbell_1d.jpg 
    8471 
    85 .. image:: img/barbell_1d.jpg 
     72    1D plot using the default values (w/256 data point). 
    8673 
    87 *Figure. 1D plot using the default values (w/256 data point).* 
     74For 2D data, the scattering intensity is calculated similar to the 2D 
     75cylinder model. 
    8876 
    89 For 2D data: The 2D scattering intensity is calculated similar to the 2D 
    90 cylinder model. For example, for |theta| = 45 deg and |phi| = 0 deg with 
    91 default values for other parameters 
     77.. figure:: img/barbell_2d.jpg 
    9278 
    93 .. image:: img/barbell_2d.jpg 
     79    2D plot (w/(256X265) data points) for $\theta = 45^\circ$ and 
     80    $\phi = 0^\circ$ with default values for the remaining parameters. 
    9481 
    95 *Figure. 2D plot (w/(256X265) data points).* 
     82.. figure:: img/orientation.jpg 
    9683 
    97 .. image:: img/orientation.jpg 
     84    Definition of the angles for oriented 2D barbells. 
    9885 
    99 Figure. Definition of the angles for oriented 2D barbells. 
     86.. figure:: img/orientation2.jpg 
    10087 
    101 .. image:: img/orientation2.jpg 
     88    Examples of the angles for oriented pp against the detector plane. 
    10289 
    103 *Figure. Examples of the angles for oriented pp against the detector plane.* 
    104  
    105 REFERENCE 
    106 --------- 
     90References 
     91---------- 
    10792 
    10893H Kaya, *J. Appl. Cryst.*, 37 (2004) 37 223-230 
    10994 
    11095H Kaya and N R deSouza, *J. Appl. Cryst.*, 37 (2004) 508-509 (addenda and errata) 
    111  
    11296""" 
    11397from numpy import inf 
     
    124108 
    125109#             ["name", "units", default, [lower, upper], "type","description"], 
    126 parameters = [["sld", "1e-6/Ang^2", 4, [-inf, inf], "", "Barbell scattering length density"], 
     110parameters = [["sld", "4e-6/Ang^2", 4, [-inf, inf], "", "Barbell scattering length density"], 
    127111              ["solvent_sld", "1e-6/Ang^2", 1, [-inf, inf], "", "Solvent scattering length density"], 
    128112              ["bell_radius", "Ang", 40, [0, inf], "volume", "Spherical bell radius"], 
  • sasmodels/models/bcc.py

    rd138d43 reb69cce  
    1313The scattering intensity $I(q)$ is calculated as 
    1414 
    15 .. math: 
     15.. math:: 
    1616 
    17     I(q) = \frac{\text{scale}}{V_P} V_\text{lattice} P(q) Z(q) 
     17    I(q) = \frac{\text{scale}}{V_p} V_\text{lattice} P(q) Z(q) 
    1818 
    1919 
    20 where *scale* is the volume fraction of spheres, *Vp* is the volume of the 
    21 primary particle, *V(lattice)* is a volume correction for the crystal 
     20where *scale* is the volume fraction of spheres, $V_p$ is the volume of the 
     21primary particle, $V_\text{lattice}$ is a volume correction for the crystal 
    2222structure, $P(q)$ is the form factor of the sphere (normalized), and $Z(q)$ 
    2323is the paracrystalline structure factor for a body-centered cubic structure. 
    2424 
    2525Equation (1) of the 1990 reference is used to calculate $Z(q)$, using 
    26 equations (29)-(31) from the 1987 paper for *Z1*\ , *Z2*\ , and *Z3*\ . 
     26equations (29)-(31) from the 1987 paper for $Z1$, $Z2$, and $Z3$. 
    2727 
    2828The lattice correction (the occupied volume of the lattice) for a 
     
    3030separation $D$ is 
    3131 
    32 .. math: 
     32.. math:: 
    3333 
    3434    V_\text{lattice} = \frac{16\pi}{3} \frac{R^3}{\left(D\sqrt{2}\right)^3} 
     
    3838in the calculation of $Z(q)$ 
    3939 
    40 .. math: 
     40.. math:: 
    4141 
    4242    \Delta a = g D 
     
    5151For a crystal, diffraction peaks appear at reduced q-values given by 
    5252 
    53 .. math: 
     53.. math:: 
    5454 
    5555    \frac{qD}{2\pi} = \sqrt{h^2 + k^2 + l^2} 
     
    6060correspond to (just the first 5) 
    6161 
    62 .. math: 
     62.. math:: 
    6363 
    64     \begin{eqnarray} 
    65     &q/q_o&&\quad 1&& \ \sqrt{2} && \ \sqrt{3} && \ \sqrt{4} && \ \sqrt{5} \\ 
    66     &\text{Indices}&& (110) && (200) && (211) && (220) && (310) 
    67     \end{eqnarray} 
     64    \begin{array}{lccccc} 
     65    q/q_o          &   1   & \sqrt{2} & \sqrt{3} & \sqrt{4} & \sqrt{5} \\ 
     66    \text{Indices} & (110) &    (200) & (211)    & (220)    & (310)    \\ 
     67    \end{array} 
    6868 
    6969**NB**: The calculation of $Z(q)$ is a double numerical integral that must 
     
    8686model computation. 
    8787 
    88 .. figure:: img/crystal_orientation.gif 
     88.. figure:: img/crystal_orientation.png 
    8989 
    9090    Orientation of the crystal with respect to the scattering plane. 
     
    9494    2D plot using the default values (w/200X200 pixels).* 
    9595 
    96 Reference 
    97 --------- 
     96References 
     97---------- 
    9898 
    9999Hideki Matsuoka et. al. *Physical Review B*, 36 (1987) 1754-1765 
  • sasmodels/models/broad_peak.py

    rd138d43 reb69cce  
    1010spherical morphologies, or for bicontinuous structures). 
    1111 
    12 The returned value is scaled to units of |cm^-1|, absolute scale. 
    13  
    1412Definition 
    1513---------- 
    1614 
    17 The scattering intensity *I(q)* is calculated as 
     15The scattering intensity $I(q)$ is calculated as 
    1816 
    19 .. math: 
     17.. math:: 
    2018 
    21     I(q) = \frac{A}{Q^n} + \frac{C}{1 + (Q\xi}^m} + B 
     19    I(q) = \frac{A}{q^n} + \frac{C}{1 + (q\xi)^m} + B 
    2220 
    23 Here the peak position is related to the d-spacing as *Q0* = 2|pi| / *d0*. 
     21Here the peak position is related to the d-spacing as $q_o = 2\pi / d_o$. 
    2422 
    25 For 2D data: The 2D scattering intensity is calculated in the same way as 1D, 
    26 where the *q* vector is defined as 
     23For 2D data the scattering intensity is calculated in the same way as 1D, 
     24where the $q$ vector is defined as 
    2725 
    28 .. math: 
     26.. math:: 
    2927 
    3028    q = \sqrt{q_x^2 + q_y^2} 
     
    3533    1D plot using the default values (w/200 data point). 
    3634 
    37 REFERENCE 
    38 --------- 
     35References 
     36---------- 
    3937 
    4038None. 
     
    7573             / (1.0 + (abs(q - peak_pos) * lorentz_length) ** lorentz_exp)) 
    7674    return inten 
    77 Iq.vectorized = True  # Iq accepts an array of Q values 
     75Iq.vectorized = True  # Iq accepts an array of q values 
    7876 
    7977def Iqxy(qx, qy, *args): 
    8078    return Iq(sqrt(qx ** 2 + qy ** 2), *args) 
    81 Iqxy.vectorized = True # Iqxy accepts an array of Qx, Qy values 
     79Iqxy.vectorized = True # Iqxy accepts an array of qx, qy values 
    8280 
    8381 
  • sasmodels/models/capped_cylinder.py

    r485aee2 reb69cce  
    11r""" 
    22Calculates the scattering from a cylinder with spherical section end-caps. 
    3 This model simply becomes the a convex lens when the length of the cylinder 
    4 $L=0$, that is, a sphereocylinder with end caps that have a radius larger 
    5 than that of the cylinder and the center of the end cap radius lies within 
    6 the cylinder. See the diagram for the details of the geometry and 
    7 restrictions on parameter values. 
     3Like :ref:`barbell`, this is a sphereocylinder with end caps that have a 
     4radius larger than that of the cylinder, but with the center of the end cap 
     5radius lying within the cylinder. This model simply becomes the a convex 
     6lens when the length of the cylinder $L=0$. See the diagram for the details 
     7of the geometry and restrictions on parameter values. 
    88 
    99Definitions 
    1010----------- 
    1111 
    12 The returned value is scaled to units of |cm^-1|\ |sr^-1|, absolute scale. 
     12.. figure:: img/capped_cylinder_geometry.jpg 
    1313 
    14 The capped cylinder geometry is defined as 
     14    Capped cylinder geometry, where $r$ is *radius*, $R$ is *bell_radius* and 
     15    $L$ is *length*. Since the end cap radius $R \geq r$ and by definition 
     16    for this geometry $h < 0$, $h$ is then defined by $r$ and $R$ as 
     17    $h = - \sqrt{R^2 - r^2}$ 
    1518 
    16 .. image:: img/capped_cylinder_geometry.jpg 
    17  
    18 where $r$ is the radius of the cylinder. All other parameters are as defined 
    19 in the diagram. Since the end cap radius $R \ge r$ and by definition for this 
    20 geometry $h < 0$, $h$ is then defined by $r$ and $R$ as 
     19The scattered intensity $I(q)$ is calculated as 
    2120 
    2221.. math:: 
    2322 
    24     h = - \sqrt{R^2 - r^2} 
     23    I(q) = \frac{\Delta \rho^2}{V} \left<A^2(q)\right> 
    2524 
    26 The scattered intensity $I(Q)$ is calculated as 
     25where the amplitude $A(q)$ is given as 
    2726 
    2827.. math:: 
    2928 
    30     I(Q) = \frac{(\Delta \rho)^2}{V} \left< A^2(Q)\right> 
    31  
    32 where the amplitude $A(Q)$ is given as 
    33  
    34 .. math:: 
    35  
    36     A(Q) =&\ \pi r^2L 
    37         {\sin\left(\tfrac12 QL\cos\theta\right) 
    38             \over \tfrac12 QL\cos\theta} 
    39         {2 J_1(Qr\sin\theta) \over Qr\sin\theta} \\ 
     29    A(q) =&\ \pi r^2L 
     30        \frac{\sin\left(\tfrac12 qL\cos\theta\right)} 
     31            {\tfrac12 qL\cos\theta} 
     32        \frac{2 J_1(qr\sin\theta)}{qr\sin\theta} \\ 
    4033        &\ + 4 \pi R^3 \int_{-h/R}^1 dt 
    41         \cos\left[ Q\cos\theta 
     34        \cos\left[ q\cos\theta 
    4235            \left(Rt + h + {\tfrac12} L\right)\right] 
    4336        \times (1-t^2) 
    44         {J_1\left[QR\sin\theta \left(1-t^2\right)^{1/2}\right] 
    45              \over QR\sin\theta \left(1-t^2\right)^{1/2}} 
     37        \frac{J_1\left[qR\sin\theta \left(1-t^2\right)^{1/2}\right]} 
     38             {qR\sin\theta \left(1-t^2\right)^{1/2}} 
    4639 
    47 The $\left< \ldots \right>$ brackets denote an average of the structure over 
    48 all orientations. $\left< A^2(Q)\right>$ is then the form factor, $P(Q)$. 
     40The $\left<\ldots\right>$ brackets denote an average of the structure over 
     41all orientations. $\left< A^2(q)\right>$ is then the form factor, $P(q)$. 
    4942The scale factor is equivalent to the volume fraction of cylinders, each of 
    50 volume, $V$. Contrast is the difference of scattering length densities of 
    51 the cylinder and the surrounding solvent. 
     43volume, $V$. Contrast $\Delta\rho$ is the difference of scattering length 
     44densities of the cylinder and the surrounding solvent. 
    5245 
    5346The volume of the capped cylinder is (with $h$ as a positive value here) 
     
    5851 
    5952 
    60 and its radius-of-gyration is 
     53and its radius of gyration is 
    6154 
    6255.. math:: 
     
    7366.. note:: 
    7467 
    75     The requirement that $R \ge r$ is not enforced in the model! 
     68    The requirement that $R \geq r$ is not enforced in the model! 
    7669    It is up to you to restrict this during analysis. 
    7770 
     
    10497    Examples of the angles for oriented pp against the detector plane. 
    10598 
    106 REFERENCE 
     99References 
     100---------- 
    107101 
    108102H Kaya, *J. Appl. Cryst.*, 37 (2004) 223-230 
  • sasmodels/models/core_shell_cylinder.py

    r485aee2 reb69cce  
    1212.. math:: 
    1313 
    14     P(Q,\alpha) = {\text{scale} \over V_s} F^2(Q) + \text{background} 
     14    P(q,\alpha) = \frac{\text{scale}}{V_s} F^2(q) + \text{background} 
    1515 
    1616where 
     
    1818.. math:: 
    1919 
    20     F(Q) = &\ (\rho_c - \rho_s) V_c 
    21            {\sin \left( Q \tfrac12 L\cos\alpha \right) 
    22                \over Q \tfrac12 L\cos\alpha } 
    23            {2 J_1 \left( QR\sin\alpha \right) 
    24                \over QR\sin\alpha } \\ 
     20    F(q) = &\ (\rho_c - \rho_s) V_c 
     21           \frac{\sin \left( q \tfrac12 L\cos\alpha \right)} 
     22                {q \tfrac12 L\cos\alpha} 
     23           \frac{2 J_1 \left( qR\sin\alpha \right)} 
     24                {qR\sin\alpha} \\ 
    2525         &\ + (\rho_s - \rho_\text{solv}) V_s 
    26            {\sin \left( Q \left(\tfrac12 L+T\right) \cos\alpha \right) 
    27                \over Q \left(\tfrac12 L +T \right) \cos\alpha } 
    28            { 2 J_1 \left( Q(R+T)\sin\alpha \right) 
    29                \over Q(R+T)\sin\alpha } 
     26           \frac{\sin \left( q \left(\tfrac12 L+T\right) \cos\alpha \right)} 
     27                {q \left(\tfrac12 L +T \right) \cos\alpha} 
     28           \frac{ 2 J_1 \left( q(R+T)\sin\alpha \right)} 
     29                {q(R+T)\sin\alpha} 
    3030 
    3131and 
     
    5858NB: The 2nd virial coefficient of the cylinder is calculated based on 
    5959the radius and 2 length values, and used as the effective radius for 
    60 $S(Q)$ when $P(Q) \cdot S(Q)$ is applied. 
     60$S(q)$ when $P(q) \cdot S(q)$ is applied. 
    6161 
    62 The $\theta$ and $\phi$ parameters are not used for the 1D output. Our 
    63 implementation of the scattering kernel and the 1D scattering intensity 
    64 use the c-library from NIST. 
     62The $\theta$ and $\phi$ parameters are not used for the 1D output. 
    6563 
    6664Validation 
  • sasmodels/models/cylinder.py

    rd138d43 reb69cce  
    1212.. math:: 
    1313 
    14     P(Q,\alpha) = {\text{scale} \over V} F^2(Q) + \text{background} 
     14    P(q,\alpha) = \frac{\text{scale}}{V} F^2(q) + \text{background} 
    1515 
    1616where 
     
    1818.. math:: 
    1919 
    20     F(Q) = 2 (\Delta \rho) V 
    21            {\sin \left(Q\tfrac12 L\cos\alpha \right) 
    22                \over Q\tfrac12 L \cos \alpha} 
    23            {J_1 \left(Q R \sin \alpha\right) \over Q R \sin \alpha} 
     20    F(q) = 2 (\Delta \rho) V 
     21           \frac{\sin \left(q\tfrac12 L\cos\alpha \right)} 
     22                {q\tfrac12 L \cos \alpha} 
     23           \frac{J_1 \left(q R \sin \alpha\right)}{q R \sin \alpha} 
    2424 
    2525and $\alpha$ is the angle between the axis of the cylinder and $\vec q$, $V$ 
     
    4444 
    4545NB: The 2nd virial coefficient of the cylinder is calculated based on the 
    46 radius and length values, and used as the effective radius for $S(Q)$ 
    47 when $P(Q) \cdot S(Q)$ is applied. 
     46radius and length values, and used as the effective radius for $S(q)$ 
     47when $P(q) \cdot S(q)$ is applied. 
    4848 
    4949The output of the 1D scattering intensity function for randomly oriented 
     
    5252.. math:: 
    5353 
    54     P(Q) = {\text{scale} \over V} 
    55         \int_0^{\pi/2} F^2(Q,\alpha) \sin \alpha\ d\alpha + \text{background} 
     54    P(q) = \frac{\text{scale}}{V} 
     55        \int_0^{\pi/2} F^2(q,\alpha) \sin \alpha\ d\alpha + \text{background} 
    5656 
    57 The *theta* and *phi* parameters are not used for the 1D output. Our 
    58 implementation of the scattering kernel and the 1D scattering intensity 
    59 use the c-library from NIST. 
     57The $\theta$ and $\phi$ parameters are not used for the 1D output. 
    6058 
    6159Validation 
     
    8280.. math:: 
    8381 
    84     P(Q) = \int_0^{\pi/2} d\phi 
    85         \int_0^\pi p(\theta, \phi) P_0(Q,\alpha) \sin \theta\ d\theta 
     82    P(q) = \int_0^{\pi/2} d\phi 
     83        \int_0^\pi p(\theta, \phi) P_0(q,\alpha) \sin \theta\ d\theta 
    8684 
    8785 
    8886where $p(\theta,\phi)$ is the probability distribution for the orientation 
    89 and $P_0(Q,\alpha)$ is the scattering intensity for the fully oriented 
     87and $P_0(q,\alpha)$ is the scattering intensity for the fully oriented 
    9088system. Since we have no other software to compare the implementation of 
    9189the intensity for fully oriented cylinders, we can compare the result of 
     
    129127 
    130128#             [ "name", "units", default, [lower, upper], "type", "description"], 
    131 parameters = [["sld", "1e-6/Ang^2", 4, [-inf, inf], "", 
     129parameters = [["sld", "4e-6/Ang^2", 4, [-inf, inf], "", 
    132130               "Cylinder scattering length density"], 
    133131              ["solvent_sld", "1e-6/Ang^2", 1, [-inf, inf], "", 
  • sasmodels/models/dab.py

    rf224873 reb69cce  
    11r""" 
    2  
    3 Scattering model class for the DAB (Debye Anderson Brumberger) Model 
    4  
    5 Definition 
    6 ---------- 
    72 
    83Calculates the scattering from a randomly distributed, two-phase system based on 
     
    116measure of the average spacing between regions of phase 1 and phase 2. **The 
    127model also assumes smooth interfaces between the phases** and hence exhibits 
    13 Porod behavior (I ~ *q*\ :sup:`-4`) at large *q* (*QL* >> 1). 
     8Porod behavior $(I \sim q^{-4})$ at large $q$, $(qL \gg 1)$. 
    149 
    1510The DAB model is ostensibly a development of the earlier Debye-Bueche model. 
    1611 
    17 *Definition* 
     12Definition 
     13---------- 
    1814 
    19 .. math:: I(q) = \text{scale}\cdot\frac{L^3}{(1 + (q \cdot L)^2)^2} + \text{background} 
     15.. math:: 
     16 
     17    I(q) = \text{scale}\cdot\frac{L^3}{(1 + (q\cdot L)^2)^2} + \text{background} 
    2018 
    2119where scale is 
    2220 
    23 .. math:: \text{scale} = 8 \pi \phi (1-\phi)(\Delta \rho)^2 
     21.. math:: \text{scale} = 8 \pi \phi (1-\phi) \Delta\rho^2 
    2422 
    25 and the parameter *L* is the correlation length. 
     23and the parameter $L$ is the correlation length. 
    2624 
    27 For 2D data: The 2D scattering intensity is calculated in the same way as 1D, 
    28 where the *q* vector is defined as 
     25For 2D data the scattering intensity is calculated in the same way as 1D, 
     26where the $q$ vector is defined as 
    2927 
    3028.. math:: q = \sqrt{q_x^2 + q_y^2} 
    31  
    32 ==============  ========  ============= 
    33 Parameter name  Units     Default value 
    34 ==============  ========  ============= 
    35 scale           None      1.0 
    36 corr length L   |Ang|     50.0 
    37 background      |cm^-1|   0.0 
    38 ==============  ========  ============= 
    39  
    4029 
    4130.. figure:: img/dab_1d.jpg 
     
    4433 
    4534 
    46 Reference 
    47 --------- 
     35References 
     36---------- 
    4837 
    4938P Debye, H R Anderson, H Brumberger, *Scattering by an Inhomogeneous Solid. II. 
  • sasmodels/models/ellipsoid.py

    r3e428ec reb69cce  
    1212.. math:: 
    1313 
    14     P(Q,\alpha) = {\text{scale} \over V} F^2(Q) + \text{background} 
     14    P(q,\alpha) = \frac{\text{scale}}{V} F^2(q) + \text{background} 
    1515 
    1616where 
     
    1818.. math:: 
    1919 
    20     F(Q) = {3 (\Delta rho)) V (\sin[Qr(R_p,R_e,\alpha)] 
    21                 - \cos[Qr(R_p,R_e,\alpha)]) 
    22             \over [Qr(R_p,R_e,\alpha)]^3 } 
     20    F(q) = \frac{3 \Delta \rho V (\sin[qr(R_p,R_e,\alpha)] 
     21                - \cos[qr(R_p,R_e,\alpha)])} 
     22                {[qr(R_p,R_e,\alpha)]^3} 
    2323 
    2424and 
     
    4545NB: The 2nd virial coefficient of the solid ellipsoid is calculated based 
    4646on the $R_p$ and $R_e$ values, and used as the effective radius for 
    47 $S(Q)$ when $P(Q) \cdot S(Q)$ is applied. 
     47$S(q)$ when $P(q) \cdot S(q)$ is applied. 
    4848 
    4949.. _ellipsoid-1d: 
    5050 
    51 .. figure:: img/ellipsoid_1d.JPG 
     51.. figure:: img/ellipsoid_1d.jpg 
    5252 
    5353    The output of the 1D scattering intensity function for randomly oriented 
     
    5555 
    5656 
    57 The $\theta$ and $\phi$ parameters are not used for the 1D output. Our 
    58 implementation of the scattering kernel and the 1D scattering intensity 
    59 use the c-library from NIST. 
     57The $\theta$ and $\phi$ parameters are not used for the 1D output. 
    6058 
    6159.. _ellipsoid-geometry: 
    6260 
    63 .. figure:: img/ellipsoid_geometry.JPG 
     61.. figure:: img/ellipsoid_geometry.jpg 
    6462 
    6563    The angles for oriented ellipsoid. 
     
    10098    *contrast* = 3e-6 |Ang^-2|, and *background* = 0.0 |cm^-1|. 
    10199 
    102 The discrepancy above *q* = 0.3 |cm^-1| is due to the way the form factors 
     100The discrepancy above $q$ = 0.3 |cm^-1| is due to the way the form factors 
    103101are calculated in the c-library provided by NIST. A numerical integration 
    104 has to be performed to obtain $P(Q)$ for randomly oriented particles. 
     102has to be performed to obtain $P(q)$ for randomly oriented particles. 
    105103The NIST software performs that integration with a 76-point Gaussian 
    106 quadrature rule, which will become imprecise at high $Q$ where the amplitude 
    107 varies quickly as a function of $Q$. The SasView result shown has been 
     104quadrature rule, which will become imprecise at high $q$ where the amplitude 
     105varies quickly as a function of $q$. The SasView result shown has been 
    108106obtained by summing over 501 equidistant points. Our result was found 
    109 to be stable over the range of $Q$ shown for a number of points higher 
     107to be stable over the range of $q$ shown for a number of points higher 
    110108than 500. 
    111109 
    112 REFERENCE 
     110References 
     111---------- 
    113112 
    114113L A Feigin and D I Svergun. *Structure Analysis by Small-Angle X-Ray and Neutron Scattering*, Plenum, 
  • sasmodels/models/fcc.py

    rd138d43 reb69cce  
    1616.. math:: 
    1717 
    18     I(q) = \frac{\text{scale}}{V_p} P(q) Z(q) 
     18    I(q) = \frac{\text{scale}}{V_p} V_\text{lattice} P(q) Z(q) 
    1919 
    2020where *scale* is the volume fraction of spheres, $V_p$ is the volume of 
    21 the primary particle, *V(lattice)* is a volume correction for the crystal 
     21the primary particle, $V_\text{lattice}$ is a volume correction for the crystal 
    2222structure, $P(q)$ is the form factor of the sphere (normalized), and $Z(q)$ 
    2323is the paracrystalline structure factor for a face-centered cubic structure. 
     
    2727 
    2828The lattice correction (the occupied volume of the lattice) for a 
    29 face-centered cubic structure of particles of radius *R* and nearest 
     29face-centered cubic structure of particles of radius $R$ and nearest 
    3030neighbor separation $D$ is 
    3131 
     
    7878    1D plot in the linear scale using the default values (w/200 data point). 
    7979 
    80 The 2D (Anisotropic model) is based on the reference below where *I(q)* is 
     80The 2D (Anisotropic model) is based on the reference below where $I(q)$ is 
    8181approximated for 1d scattering. Thus the scattering pattern for 2D may not 
    8282be accurate. Note that we are not responsible for any incorrectness of the 
    83832D model computation. 
    8484 
    85 .. figure:: img/crystal_orientation.gif 
     85.. figure:: img/crystal_orientation.png 
    8686 
    8787    Orientation of the crystal with respect to the scattering plane. 
     
    9191    2D plot using the default values (w/200X200 pixels). 
    9292 
    93 Reference 
    94 --------- 
     93References 
     94---------- 
    9595 
    9696Hideki Matsuoka et. al. *Physical Review B*, 36 (1987) 1754-1765 
  • sasmodels/models/gaussian_peak.py

    r0e9048f reb69cce  
    2626    1D plot using the default values (w/500 data points). 
    2727 
    28 Reference 
    29 --------- 
     28References 
     29---------- 
    3030 
    3131None. 
  • sasmodels/models/guinier.py

    r66ebdd6 reb69cce  
    11r""" 
    2 Guinier (Model) 
    3  
    42Definition 
    53---------- 
     
    75This model fits the Guinier function 
    86 
    9 .. math:: Q_1=\frac{1}{R_g}\sqrt{\frac{(m-s)(3-s)}{2}} 
     7.. math:: q_1=\frac{1}{R_g}\sqrt{\frac{(m-s)(3-s)}{2}} 
    108 
    11 to the data directly without any need for linearisation (*cf*. Ln *I(q)* vs *q*\ :sup:`2`). 
     9to the data directly without any need for linearisation 
     10(*cf*. $\ln I(q)$ vs $q^2$\ ). 
    1211 
    13 For 2D data: The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as 
     12For 2D data the scattering intensity is calculated in the same way as 1D, 
     13where the $q$ vector is defined as 
    1414 
    1515.. math:: q=\sqrt{q_x^2 + q_y^2} 
    1616 
    17 REFERENCE 
     17References 
     18---------- 
    1819 
    19 A Guinier and G Fournet, *Small-Angle Scattering of X-Rays*, John Wiley & Sons, New York (1955) 
     20A Guinier and G Fournet, *Small-Angle Scattering of X-Rays*, 
     21John Wiley & Sons, New York (1955) 
    2022""" 
    2123 
  • sasmodels/models/hardsphere.py

    r3e428ec reb69cce  
    77potential is 
    88 
    9 .. math: 
     9.. math:: 
    1010 
    1111    U(r) = \begin{cases} 
     
    1414    \end{cases} 
    1515 
    16 where *r* is the distance from the center of the sphere of a radius *R*. 
     16where $r$ is the distance from the center of the sphere of a radius $R$. 
    1717 
    1818For a 2D plot, the wave transfer is defined as 
     
    2323 
    2424 
    25 .. image:: img/HardSphere_1d.jpg 
     25.. figure:: img/HardSphere_1d.jpg 
    2626 
    27 *Figure. 1D plot using the default values (in linear scale).* 
     27    1D plot using the default values (in linear scale). 
    2828 
    29 REFERENCE 
     29References 
     30---------- 
    3031 
    3132J K Percus, J Yevick, *J. Phys. Rev.*, 110, (1958) 1 
  • sasmodels/models/hollow_cylinder.py

    rd138d43 reb69cce  
    66.. math:: 
    77 
    8     P(q) = \text{scale} \langle F^2 \rangle/V_\text{shell} + \text{background} 
     8    P(q) = \text{scale} \left<F^2\right>/V_\text{shell} + \text{background} 
    99 
    10 where the averaging $\langle \rangle$ is applied only for the 1D calculation. 
     10where the averaging $\left<\ldots\right>$ is applied only for the 1D calculation. 
    1111 
    1212The inside and outside of the hollow cylinder are assumed have the same SLD. 
     
    1919.. math:: 
    2020 
    21     \begin{eqnarray} 
    22     P(q)           &=& (\text{scale})V_\text{shell}\Delta\rho^2 
     21    %\begin{align*} % isn't working with pdflatex 
     22    \begin{array}{rl} 
     23    P(q)           &= (\text{scale})V_\text{shell}\Delta\rho^2 
    2324            \int_0^{1}\Psi^2 
    2425            \left[q_z, R_\text{shell}(1-x^2)^{1/2}, 
    2526                       R_\text{core}(1-x^2)^{1/2}\right] 
    2627            \left[\frac{\sin(qHx)}{qHx}\right]^2 dx \\ 
    27     \Psi[q,y,z]    &=& \frac{1}{1-\gamma^2} 
     28    \Psi[q,y,z]    &= \frac{1}{1-\gamma^2} 
    2829            \left[ \Lambda(qy) - \gamma^2\Lambda(qz) \right] \\ 
    29     \Lambda(a)     &=& 2 J_1(a) / a \\ 
    30     \gamma         &=& R_\text{core} / R_\text{shell} \\ 
    31     V_\text{shell} &=& \pi \left(R_\text{shell}^2 - R_\text{core}^2 \right)L \\ 
    32     J_1(x)         &=& \frac{(\sin(x)-x\cdot \cos(x))}{x^2} \\ 
    33     \end{eqnarray} 
     30    \Lambda(a)     &= 2 J_1(a) / a \\ 
     31    \gamma         &= R_\text{core} / R_\text{shell} \\ 
     32    V_\text{shell} &= \pi \left(R_\text{shell}^2 - R_\text{core}^2 \right)L \\ 
     33    J_1(x)         &= (\sin(x)-x\cdot \cos(x)) / x^2 \\ 
     34    \end{array} 
    3435 
    3536where *scale* is a scale factor and $J_1$ is the 1st order 
     
    4243**NB**: The 2nd virial coefficient of the cylinder is calculated 
    4344based on the radius and 2 length values, and used as the effective radius 
    44 for $S(Q)$ when $P(Q) * S(Q)$ is applied. 
     45for $S(q)$ when $P(q) \cdot S(q)$ is applied. 
    4546 
    4647In the parameters, the contrast represents SLD :sub:`shell` - SLD :sub:`solvent` 
     
    5960    Examples of the angles for oriented pp against the detector plane. 
    6061 
    61 Reference 
    62 --------- 
     62References 
     63---------- 
    6364 
    6465L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and 
     
    8889              ["sld", "1/Ang^2", 6.3, [-inf, inf], "", "Cylinder sld"], 
    8990              ["solvent_sld", "1/Ang^2", 1, [-inf, inf], "", "Solvent sld"], 
    90               ["theta", "[deg]", 90, [-360, 360], "orientation", "Theta angle"], 
    91               ["phi", "[deg]", 0, [-360, 360], "orientation", "Phi angle"], 
     91              ["theta", "degrees", 90, [-360, 360], "orientation", "Theta angle"], 
     92              ["phi", "degrees", 0, [-360, 360], "orientation", "Phi angle"], 
    9293              ] 
    9394 
  • sasmodels/models/lamellar.py

    r38d8774 reb69cce  
    55---------- 
    66 
    7 The scattering intensity *I(Q)* is 
     7The scattering intensity $I(q)$ is 
    88 
    99.. math:: 
    1010 
    11     I(Q) = 2\pi{P(Q) \over \delta Q^2} 
     11    I(q) = \frac{2\pi P(q)}{\delta q^2} 
    1212 
    1313 
     
    1616.. math:: 
    1717 
    18     P(Q) = {2\Delta\rho^2 \over Q^2}(1-cos(Q\delta)) 
     18    P(q) = \frac{2\Delta\rho^2}{q^2}(1-cos(q\delta)) 
    1919 
    2020 
    21 where |delta| = bilayer thickness. 
     21where $\delta$ is the bilayer thickness. 
    2222 
    23 The 2D scattering intensity is calculated in the same way as 1D, where the $Q$ vector is defined as 
     23The 2D scattering intensity is calculated in the same way as 1D, where 
     24the $q$ vector is defined as 
    2425 
    2526.. math:: 
    2627 
    27     Q = \sqrt{Q_x^2 + Q_y^2} 
     28    q = \sqrt{q_x^2 + q_y^2} 
    2829 
    29  
    30  
    31 Our model uses the form factor calculations implemented in a c-library provided by the NIST Center for Neutron Research 
    32 (Kline, 2006). 
    3330 
    3431.. figure:: img/lamellar_1d.jpg 
     
    3734 
    3835 
    39 Reference 
    40 --------- 
     36References 
     37---------- 
    4138 
    4239F Nallet, R Laversanne, and D Roux, J. Phys. II France, 3, (1993) 487-502 
  • sasmodels/models/lamellarCaille.py

    r3e428ec reb69cce  
    33This model provides the scattering intensity, $I(q) = P(q) S(q)$, for a 
    44lamellar phase where a random distribution in solution are assumed. 
    5 Here a Caille $S(Q)$ is used for the lamellar stacks. 
     5Here a Caille $S(q)$ is used for the lamellar stacks. 
     6 
     7Definition 
     8---------- 
    69 
    710The scattering intensity $I(q)$ is 
    811 
    9 .. math: 
     12.. math:: 
    1013 
    1114    I(q) = 2\pi \frac{P(q)S(q)}{\delta q^2} 
     
    1316The form factor is 
    1417 
    15 .. math: 
     18.. math:: 
    1619 
    1720    P(q) = \frac{2\Delta\rho^2}{q^2}\left(1-\cos q\delta \right) 
     
    1922and the structure factor is 
    2023 
    21 .. math: 
     24.. math:: 
    2225 
    2326    S(q) = 1 + 2 \sum_1^{N-1}\left(1-\frac{n}{N}\right) 
     
    2629where 
    2730 
    28 .. math: 
     31.. math:: 
    2932 
    30     \begin{eqnarray} 
    31     \alpha(n) &=& \frac{\eta_{cp}}{4\pi^2} \left(\ln(\pi n)+\gamma_E\right)  \\ 
    32     \gamma_E &=& 0.5772156649 && \text{Euler's constant} \\ 
    33     \eta_{cp} &=& \frac{q_o^2k_B T}{8\pi\sqrt{K\overline{B}}} && \text{Caille constant} 
    34     \end{eqnarray} 
     33    %\begin{align*} % isn't working with pdflatex 
     34    \begin{array}{rll} 
     35    \alpha(n) &= \frac{\eta_{cp}}{4\pi^2} \left(\ln(\pi n)+\gamma_E\right) 
     36              & \\ 
     37    \gamma_E  &= 0.5772156649 
     38              & \text{Euler's constant} \\ 
     39    \eta_{cp} &= \frac{q_o^2k_B T}{8\pi\sqrt{K\overline{B}}} 
     40              & \text{Caille constant} \\ 
     41              & 
     42    \end{array} 
    3543 
    3644Here $d$ = (repeat) spacing, $\delta$ = bilayer thickness, 
     
    5462    q = \sqrt{q_x^2 + q_y^2} 
    5563 
    56 The returned value is in units of |cm^-1|, on absolute scale. 
     64.. figure:: img/lamellarCaille_1d.jpg 
    5765 
    58 .. image:: img/lamellarCaille_1d.jpg 
     66    1D plot using the default values (w/6000 data point). 
    5967 
    60 *Figure. 1D plot using the default values (w/6000 data point).* 
    61  
    62 Our model uses the form factor calculations as implemented in a c library 
    63 provided by the NIST Center for Neutron Research (Kline, 2006). 
    64  
    65 REFERENCE 
    66 --------- 
     68References 
     69---------- 
    6770 
    6871F Nallet, R Laversanne, and D Roux, J. Phys. II France, 3, (1993) 487-502 
  • sasmodels/models/lamellarCailleHG.py

    r3e428ec reb69cce  
    22r""" 
    33This model provides the scattering intensity, $I(q) = P(q)S(q)$, for a lamellar 
    4 phase where a random distribution in solution are assumed. Here a Caille $S(Q)$ 
     4phase where a random distribution in solution are assumed. Here a Caille $S(q)$ 
    55is used for the lamellar stacks. 
    66 
     
    3131.. math:: 
    3232 
    33     \begin{eqnarray} 
    34     \alpha(n) &=& \frac{\eta_{cp}}{4\pi^2} \left(\ln(\pi n)+\gamma_E\right)  \\ 
    35     \gamma_E &=& 0.5772156649&&\text{Euler's constant} \\ 
    36     \eta_{cp} &=& \frac{q_o^2k_B T}{8\pi\sqrt{K\overline{B}}} && \text{Caille constant} 
    37     \end{eqnarray} 
     33    %\begin{align*} % isn't working with pdflatex 
     34    \begin{array}{rll} 
     35    \alpha(n) &= \frac{\eta_{cp}}{4\pi^2} \left(\ln(\pi n)+\gamma_E\right) 
     36              &  \\ 
     37    \gamma_E  &= 0.5772156649 
     38              & \text{Euler's constant} \\ 
     39    \eta_{cp} &= \frac{q_o^2k_B T}{8\pi\sqrt{K\overline{B}}} 
     40              & \text{Caille constant} \\ 
     41              & 
     42    \end{array} 
    3843 
    3944 
     
    5964    q = \sqrt{q_x^2 + q_y^2} 
    6065 
    61 The returned value is in units of |cm^-1|, on absolute scale. 
     66.. figure:: img/lamellarCailleHG_1d.jpg 
    6267 
    63 .. image:: img/lamellarCailleHG_1d.jpg 
     68    1D plot using the default values (w/6000 data point). 
    6469 
    65 *Figure. 1D plot using the default values (w/6000 data point).* 
    66  
    67 Our model uses the form factor calculations implemented in a C library provided 
    68 by the NIST Center for Neutron Research (Kline, 2006). 
    69  
    70 REFERENCE 
     70References 
     71---------- 
    7172 
    7273F Nallet, R Laversanne, and D Roux, J. Phys. II France, 3, (1993) 487-502 
  • sasmodels/models/lamellarFFHG.py

    rd138d43 reb69cce  
    11# Note: model title and parameter table are inserted automatically 
    22r""" 
    3 This model provides the scattering intensity, *I(q)*, for a lyotropic lamellar 
     3This model provides the scattering intensity, $I(q)$, for a lyotropic lamellar 
    44phase where a random distribution in solution are assumed. The SLD of the head 
    55region is taken to be different from the SLD of the tail region. 
     
    2525        \right\rbrace^2 
    2626 
    27 where $\delta_T$ is *tail_length*, \delta_H is *head_length*, 
     27where $\delta_T$ is *tail_length*, $\delta_H$ is *head_length*, 
    2828$\Delta\rho_H$ is the head contrast (*head_sld* $-$ *solvent_sld*), 
    2929and $\Delta\rho_T$ is tail contrast (*sld* $-$ *solvent_sld*). 
    3030 
    3131The 2D scattering intensity is calculated in the same way as 1D, where 
    32 the *q* vector is defined as 
     32the $q$ vector is defined as 
    3333 
    3434.. math:: 
  • sasmodels/models/lamellarPC.py

    rd138d43 reb69cce  
    2323 
    2424- *spacing* is the average distance between adjacent layers 
    25   $\langle D \rangle$, and 
     25  $\left<D\right>$, and 
    2626 
    2727- *spacing_polydisp* is the relative standard deviation of the Gaussian 
    28   layer distance distribution $\sigma_D / \langle D \rangle$. 
     28  layer distance distribution $\sigma_D / \left<D\right>$. 
    2929 
    3030 
     
    4949 
    5050 
    51     Z_N(q) = \frac{1 - w^2}{1 + w^2 - 2w \cos(q \langle D \rangle)} 
     51    Z_N(q) = \frac{1 - w^2}{1 + w^2 - 2w \cos(q \left<D\right>)} 
    5252        + x_N S_N + (1 - x_N) S_{N+1} 
    5353 
     
    5656.. math:: 
    5757 
    58     S_N(q) = \frac{a_N}{N}[1 + w^2 - 2 w \cos(q \langle D \rangle)]^2 
     58    S_N(q) = \frac{a_N}{N}[1 + w^2 - 2 w \cos(q \left<D\right>)]^2 
    5959 
    6060and 
     
    6262.. math:: 
    6363 
    64     a_N = 4w^2 - 2(w^3 + w) \cos(q \langle D \rangle) 
    65         - 4w^{N+2}\cos(Nq \langle D \rangle) 
    66         + 2 w^{N+3}\cos[(N-1)q \langle D \rangle] 
    67         + 2w^{N+1}\cos[(N+1)q \langle D \rangle] 
     64    \begin{array}{rcl} 
     65    a_N &=& 4w^2 - 2(w^3 + w) \cos(q \left<D\right>) 
     66        - 4w^{N+2}\cos(Nq \left<D\right>) \\ 
     67        &&{} + 2 w^{N+3}\cos[(N-1)q \left<D\right>] 
     68        + 2w^{N+1}\cos[(N+1)q \left<D\right>] 
     69    \end{array} 
    6870 
    6971for the layer spacing distribution $w = \exp(-\sigma_D^2 q^2/2)$. 
  • sasmodels/models/lorentz.py

    rd138d43 reb69cce  
    77The Ornstein-Zernicke model is defined by 
    88 
    9 .. math:: I(q)=\frac{\text{scale}}{1+(qL)^2}+\text{bkg} 
     9.. math:: I(q)=\frac{\text{scale}}{1+(qL)^2}+\text{background} 
    1010 
    11 The parameter *L* is the screening length. 
     11The parameter $L$ is the screening length *cor_length*. 
    1212 
    13 For 2D data: The 2D scattering intensity is calculated in the same way as 1D,  
     13For 2D data the scattering intensity is calculated in the same way as 1D, 
    1414where the $q$ vector is defined as 
    1515 
     
    2020    1D plot using the default values (w/200 data point). 
    2121 
    22 Reference 
    23 --------- 
     22References 
     23---------- 
    2424 
    2525L.S. Qrnstein and F. Zernike, *Proc. Acad. Sci. Amsterdam* 17, 793 (1914), and 
  • sasmodels/models/parallelepiped.py

    rd138d43 reb69cce  
    77---------- 
    88 
    9 This model provides the form factor, *P(q)*, for a rectangular parallelepiped 
     9This model provides the form factor, $P(q)$, for a rectangular parallelepiped 
    1010(below) where the form factor is normalized by the volume of the 
    1111parallelepiped. If you need to apply polydispersity, see also 
     
    1616.. math:: 
    1717 
    18     P(Q) = {\text{scale} \over V} F^2(Q) + \text{background} 
     18    P(q) = \frac{\text{scale}}{V} F^2(q) + \text{background} 
    1919 
    20 where the volume *V* = *A B C* and the averaging < > is applied over all 
    21 orientations for 1D. 
     20where the volume $V = A B C$ and the averaging $\left<\ldots\right>$ is 
     21applied over all orientations for 1D. 
    2222 
    2323.. figure:: img/parallelepiped.jpg 
     
    2525   Parallelepiped with the corresponding definition of sides. 
    2626 
    27 The edge of the solid must satisfy the condition that** *A* < *B* < *C*. 
    28 Then, assuming *a* = *A* / *B* < 1, *b* = *B* / *B* = 1, and 
    29 *c* = *C* / *B* > 1, the form factor is 
     27The edge of the solid must satisfy the condition that $A < B < C$. 
     28Then, assuming $a = A/B < 1$, $b = B /B = 1$, and $c = C/B > 1$, the 
     29form factor is 
    3030 
    3131.. math:: 
    3232 
    33     P(q) = \frac{\textstyle{scale}}{V}\int_0^1 \phi(\mu \sqrt{1-\sigma^2},a) 
    34     [S(\mu c \sigma/2)]^2 d\sigma 
     33    P(q) = \frac{\text{scale}}{V}\int_0^1 
     34        \phi\left(\mu \sqrt{1-\sigma^2},a\right) 
     35        \left[S(\mu c \sigma/2)\right]^2 d\sigma 
    3536 
    3637with 
     
    3839.. math:: 
    3940 
    40     \phi(\mu,a) = \int_0^1 \{S[\frac{\mu}{2}\cos(\frac{\pi}{2}u)] 
    41     S[\frac{\mu a}{2}\sin(\frac{\pi}{2}u)]\}^2 du 
     41    \phi(\mu,a) = \int_0^1 
     42        \left\{S\left[\frac{\mu}{2}\cos(\frac{\pi}{2}u)\right] 
     43               S\left[\frac{\mu a}{2}\sin(\frac{\pi}{2}u)\right] 
     44               \right\}^2 du 
    4245 
    4346    S(x) = \frac{\sin x}{x} 
     
    5255 
    5356The scattering intensity per unit volume is returned in units of |cm^-1|; 
    54 ie, *I(q)* = |phi| *P(q)*\ . 
     57i.e., $I(q) = \phi P(q)$. 
    5558 
    5659NB: The 2nd virial coefficient of the parallelpiped is calculated based on 
    57 the averaged effective radius (= sqrt(*short_a* \* *short_b* / |pi|)) and 
    58 length(= *long_c*) values, and used as the effective radius for 
    59 *S(Q)* when *P(Q)* \* *S(Q)* is applied. 
     60the averaged effective radius $(=\sqrt{A B / \pi})$ and 
     61length $(= C)$ values, and used as the effective radius for 
     62$S(q)$ when $P(q) \cdot S(q)$ is applied. 
    6063 
    6164To provide easy access to the orientation of the parallelepiped, we define 
    62 three angles |theta|, |phi| and |bigpsi|. The definition of |theta| and |phi| 
    63 is the same as for the cylinder model (see also figures below). 
    64 The angle |bigpsi| is the rotational angle around the *long_c* axis against 
    65 the *q* plane. For example, |bigpsi| = 0 when the *short_b* axis is parallel 
    66 to the *x*-axis of the detector. 
     65three angles $\theta$, $\phi$ and $\Psi$. The definition of $\theta$ and 
     66$\phi$ is the same as for the cylinder model (see also figures below). 
     67The angle $\Psi$ is the rotational angle around the $C$ axis against 
     68the $q$ plane. For example, $\Psi = 0$ when the $B$ axis is parallel 
     69to the $x$-axis of the detector. 
    6770 
    6871 
     
    8588angles. The Figure below shows the comparison where the solid dot refers to 
    8689averaged 2D while the line represents the result of the 1D calculation (for 
    87 the averaging, 76, 180, 76 points are taken for the angles of |theta|, |phi|, 
    88 and |psi| respectively). 
     90the averaging, 76, 180, 76 points are taken for the angles of $\theta$, 
     91$\phi$, and $\Psi$ respectively). 
    8992 
    9093.. _parallelepiped-compare: 
    9194 
    92 .. figure:: img/parallelepiped_compare.gif 
     95.. figure:: img/parallelepiped_compare.png 
    9396 
    9497   Comparison between 1D and averaged 2D. 
  • sasmodels/models/power_law.py

    r525f3a9 reb69cce  
    1010.. math:: 
    1111 
    12     I(q) = \text{scale} \cdot q^{-power} + \text{background} 
     12    I(q) = \text{scale} \cdot q^{-\text{power}} + \text{background} 
    1313 
    1414Note the minus sign in front of the exponent. The exponent *power*  
     
    1919combining this model with other models. 
    2020 
    21 .. image:: img/power_law_1d.jpg 
     21.. figure:: img/power_law_1d.jpg 
    2222 
    23 *Figure. 1D plot using the default values (w/200 data point).* 
     23    1D plot using the default values (w/200 data point). 
    2424 
    25 REFERENCE 
     25References 
     26---------- 
    2627 
    2728None. 
     
    4748    inten = (q**-power) 
    4849    return inten 
    49 Iq.vectorized = True  # Iq accepts an array of Q values 
     50Iq.vectorized = True  # Iq accepts an array of q values 
    5051 
    5152def Iqxy(qx, qy, *args): 
    5253    return Iq(sqrt(qx ** 2 + qy ** 2), *args) 
    53 Iqxy.vectorized = True # Iqxy accepts an array of Qx, Qy values 
     54Iqxy.vectorized = True # Iqxy accepts an array of qx, qy values 
    5455 
    5556demo = dict(scale=1.0, 
  • sasmodels/models/sphere.py

    r0fa687d reb69cce  
    1111.. math:: 
    1212 
    13     I(Q) = \frac{\text{scale}}{V} \cdot \left[ \ 
    14         3V(\Delta\rho) \cdot \frac{\sin(QR) - QR\cos(QR))}{(QR)^3} \ 
     13    I(q) = \frac{\text{scale}}{V} \cdot \left[ 
     14        3V(\Delta\rho) \cdot \frac{\sin(qr) - qr\cos(qr))}{(qr)^3} 
    1515        \right]^2 + \text{background} 
    1616 
    1717where *scale* is a volume fraction, $V$ is the volume of the scatterer, 
    18 $R$ is the radius of the sphere, *background* is the background level and 
     18$r$ is the radius of the sphere, *background* is the background level and 
    1919*sld* and *solvent_sld* are the scattering length densities (SLDs) of the 
    2020scatterer and the solvent respectively. 
     
    2727The 2D scattering intensity is the same as above, regardless of the 
    2828orientation of $\vec q$. 
    29  
    30 Our model uses the form factor calculations as defined in the IGOR 
    31 package provided by the NIST Center for Neutron Research (Kline, 2006). 
    3229 
    3330Validation 
     
    4946 
    5047 
    51 Reference 
    52 --------- 
     48References 
     49---------- 
    5350 
    5451A Guinier and G. Fournet, *Small-Angle Scattering of X-Rays*, 
     
    6360title = "Spheres with uniform scattering length density" 
    6461description = """\ 
    65 P(q)=(scale/V)*[3V(sld-solvent_sld)*(sin(qR)-qRcos(qR)) 
    66                 /(qR)^3]^2 + background 
    67     R: radius of sphere 
     62P(q)=(scale/V)*[3V(sld-solvent_sld)*(sin(qr)-qr cos(qr)) 
     63                /(qr)^3]^2 + background 
     64    r: radius of sphere 
    6865    V: The volume of the scatter 
    6966    sld: the SLD of the sphere 
     
    9390    double sn, cn; 
    9491    SINCOS(qr, sn, cn); 
    95     // Use taylor series for low Q to avoid cancellation error.  Tested against 
     92    // Use taylor series for low q to avoid cancellation error.  Tested against 
    9693    // the following expression in quad precision: 
    9794    //     3.0*(sn-qr*cn)/(qr*qr*qr); 
  • sasmodels/models/spherepy.py

    rd138d43 reb69cce  
    1111.. math:: 
    1212 
    13     I(Q) = \frac{\text{scale}}{V} \cdot \left[ \ 
    14         3V(\Delta\rho) \cdot \frac{\sin(QR) - QR\cos(QR))}{(QR)^3} \ 
     13    I(q) = \frac{\text{scale}}{V} \cdot \left[ 
     14        3V(\Delta\rho) \cdot \frac{\sin(qr) - qr\cos(qr))}{(qr)^3} 
    1515        \right]^2 + \text{background} 
    1616 
    1717where *scale* is a volume fraction, $V$ is the volume of the scatterer, 
    18 $R$ is the radius of the sphere, *background* is the background level and 
     18$r$ is the radius of the sphere, *background* is the background level and 
    1919*sld* and *solvent_sld* are the scattering length densities (SLDs) of the 
    2020scatterer and the solvent respectively. 
     
    2727The 2D scattering intensity is the same as above, regardless of the 
    2828orientation of $\vec q$. 
    29  
    30 Our model uses the form factor calculations as defined in the IGOR 
    31 package provided by the NIST Center for Neutron Research (Kline, 2006). 
    3229 
    3330Validation 
     
    4946 
    5047 
    51 Reference 
    52 --------- 
     48References 
     49---------- 
    5350 
    5451A Guinier and G. Fournet, *Small-Angle Scattering of X-Rays*, 
     
    6461title = "Spheres with uniform scattering length density" 
    6562description = """\ 
    66 P(q)=(scale/V)*[3V(sld-solvent_sld)*(sin(qR)-qRcos(qR)) 
    67                 /(qR)^3]^2 + background 
    68     R: radius of sphere 
     63P(q)=(scale/V)*[3V(sld-solvent_sld)*(sin(qr)-qr cos(qr)) 
     64                /(qr)^3]^2 + background 
     65    r: radius of sphere 
    6966    V: The volume of the scatter 
    7067    sld: the SLD of the sphere 
     
    10198    fq = bes * (sld - solvent_sld) * form_volume(radius) 
    10299    return 1.0e-4 * fq ** 2 
    103 Iq.vectorized = True  # Iq accepts an array of Q values 
     100Iq.vectorized = True  # Iq accepts an array of q values 
    104101 
    105102def Iqxy(qx, qy, sld, solvent_sld, radius): 
    106103    return Iq(sqrt(qx ** 2 + qy ** 2), sld, solvent_sld, radius) 
    107 Iqxy.vectorized = True  # Iqxy accepts arrays of Qx, Qy values 
     104Iqxy.vectorized = True  # Iqxy accepts arrays of qx, qy values 
    108105 
    109106def sesans(z, sld, solvent_sld, radius): 
  • sasmodels/models/stickyhardsphere.py

    r3e428ec reb69cce  
    44with a narrow attractive well. A perturbative solution of the Percus-Yevick 
    55closure is used. The strength of the attractive well is described in terms 
    6 of "stickiness" as defined below. The returned value is a dimensionless 
    7 structure factor, *S(q)*. 
     6of "stickiness" as defined below. 
    87 
    9 The perturb (perturbation parameter), |epsilon|, should be held between 0.01 
     8The perturb (perturbation parameter), $\epsilon$, should be held between 0.01 
    109and 0.1. It is best to hold the perturbation parameter fixed and let 
    1110the "stickiness" vary to adjust the interaction strength. The stickiness, 
    12 |tau|, is defined in the equation below and is a function of both the 
    13 perturbation parameter and the interaction strength. |tau| and |epsilon| 
    14 are defined in terms of the hard sphere diameter (|sigma| = 2\*\ *R*\ ), the 
    15 width of the square well, |bigdelta| (same units as *R*), and the depth of 
    16 the well, *Uo*, in units of kT. From the definition, it is clear that 
    17 smaller |tau| means stronger attraction. 
     11$\tau$, is defined in the equation below and is a function of both the 
     12perturbation parameter and the interaction strength. $\tau$ and $\epsilon$ 
     13are defined in terms of the hard sphere diameter $(\sigma = 2 R)$, the 
     14width of the square well, $\Delta$ (same units as $R$\ ), and the depth of 
     15the well, $U_o$, in units of $kT$. From the definition, it is clear that 
     16smaller $\tau$ means stronger attraction. 
    1817 
    19 .. image:: img/stickyhardsphere_228.PNG 
     18.. math:: 
     19 
     20    %\begin{align*} % isn't working with pdflatex 
     21    \begin{array}{rl} 
     22    \tau     &= \frac{1}{12\epsilon} \exp(u_o / kT) \\ 
     23    \epsilon &= \Delta / (\sigma + \Delta) \\ 
     24    \end{array} 
    2025 
    2126where the interaction potential is 
    2227 
    23 .. image:: img/stickyhardsphere_229.PNG 
     28.. math:: 
     29 
     30    U(r) = \begin{cases} 
     31        \infty & r < \sigma \\ 
     32        -U_o   & \sigma \leq r \leq \sigma + \Delta \\ 
     33        0      & r > \sigma + \Delta 
     34        \end{cases} 
    2435 
    2536The Percus-Yevick (PY) closure was used for this calculation, and is an 
     
    2839good agreement. 
    2940 
    30 The true particle volume fraction, |phi|, is not equal to *h*, which appears 
     41The true particle volume fraction, $\phi$, is not equal to $h$, which appears 
    3142in most of the reference. The two are related in equation (24) of the 
    3243reference. The reference also describes the relationship between this 
     
    3445sphere) model by Baxter. 
    3546 
    36 NB: The calculation can go haywire for certain combinations of the input 
     47**NB**: The calculation can go haywire for certain combinations of the input 
    3748parameters, producing unphysical solutions - in this case errors are 
    38 reported to the command window and the *S(q)* is set to -1 (so it will 
     49reported to the command window and the $S(q)$ is set to -1 (so it will 
    3950disappear on a log-log plot). Use tight bounds to keep the parameters to 
    4051values that you know are physical (test them) and keep nudging them until 
     
    4253 
    4354In sasview the effective radius will be calculated from the parameters 
    44 used in the form factor P(Q) that this S(Q) is combined with. 
     55used in the form factor $P(q)$ that this $S(q)$ is combined with. 
    4556 
    46 For 2D data: The 2D scattering intensity is calculated in the same way 
    47 as 1D, where the *q* vector is defined as 
     57For 2D data the scattering intensity is calculated in the same way 
     58as 1D, where the $q$ vector is defined as 
    4859 
    4960.. math:: 
    5061 
    51     Q = \sqrt{Q_x^2 + Q_y^2} 
     62    q = \sqrt{q_x^2 + q_y^2} 
    5263 
    53 ==============  ========  ============= 
    54 Parameter name  Units     Default value 
    55 ==============  ========  ============= 
    56 effect_radius   |Ang|     50 
    57 perturb         None      0.05 
    58 volfraction     None      0.1 
    59 stickiness      K         0.2 
    60 ==============  ========  ============= 
     64.. figure:: img/stickyhardsphere_1d.jpg 
    6165 
    62 .. image:: img/stickyhardsphere_230.jpg 
     66    1D plot using the default values (in linear scale). 
    6367 
    64 *Figure. 1D plot using the default values (in linear scale).* 
    65  
    66 REFERENCE 
     68References 
     69---------- 
    6770 
    6871S V G Menon, C Manohar, and K S Rao, *J. Chem. Phys.*, 95(12) (1991) 9186-9190 
  • sasmodels/models/teubner_strey.py

    r0e9048f reb69cce  
    4040    1D plot using the default values (w/200 data point). 
    4141 
    42 Reference 
    43 --------- 
     42References 
     43---------- 
    4444 
    4545M Teubner, R Strey, *J. Chem. Phys.*, 87 (1987) 3195 
     
    7777def Iq(q, a2, c1, c2): 
    7878    return 1. / np.polyval([c2, c1, a2], q**2) 
    79 Iq.vectorized = True  # Iq accepts an array of Q values 
     79Iq.vectorized = True  # Iq accepts an array of q values 
    8080 
    8181def Iqxy(qx, qy, a2, c1, c2): 
    8282    return Iq(sqrt(qx**2 + qy**2), a2, c1, c2) 
    83 Iqxy.vectorized = True  # Iqxy accepts arrays of Qx, Qy values 
     83Iqxy.vectorized = True  # Iqxy accepts arrays of qx, qy values 
    8484 
    8585# ER defaults to 0.0 
  • sasmodels/models/triaxial_ellipsoid.py

    r3e428ec reb69cce  
    22# Note: model title and parameter table are inserted automatically 
    33r""" 
    4 All three axes are of different lengths with $R_a \le R_b <= R_c$ 
     4All three axes are of different lengths with $R_a \leq R_b \leq R_c$ 
    55**Users should maintain this inequality for all calculations**. 
    66 
    77.. math:: 
    88 
    9     P(Q) = \text{scale} V \left< F^2(Q) \right> + \text{background} 
     9    P(q) = \text{scale} V \left< F^2(q) \right> + \text{background} 
    1010 
    1111where the volume $V = 4/3 \pi R_a R_b R_c$, and the averaging 
    12 $\left< \cdots \right>$ is applied over all orientations for 1D. 
     12$\left<\ldots\right>$ is applied over all orientations for 1D. 
    1313 
    1414.. figure:: img/triaxial_ellipsoid_geometry.jpg 
    1515 
    1616    Ellipsoid schematic. 
    17  
    18 The returned value is in units of |cm^-1|, on absolute scale. 
    1917 
    2018Definition 
     
    2523.. math:: 
    2624 
    27     P(Q) = \frac{\text{scale}}{V}\int_0^1\int_0^1 
    28         \Phi^2(QR_a^2\cos^2( \pi x/2) + QR_b^2\sin^2(\pi y/2)(1-y^2) + c^2y^2) 
     25    P(q) = \frac{\text{scale}}{V}\int_0^1\int_0^1 
     26        \Phi^2(qR_a^2\cos^2( \pi x/2) + qR_b^2\sin^2(\pi y/2)(1-y^2) + R_c^2y^2) 
    2927        dx dy 
    3028 
     
    4038:num:`figure #triaxial-ellipsoid-angles`. 
    4139The angle $\psi$ is the rotational angle around its own $c$ axis 
    42 against the $Q$ plane. For example, $\psi = 0$ when the 
     40against the $q$ plane. For example, $\psi = 0$ when the 
    4341$a$ axis is parallel to the $x$ axis of the detector. 
    4442 
     
    5250 
    5351The contrast is defined as SLD(ellipsoid) - SLD(solvent).  In the 
    54 parameters, *a* is the minor equatorial radius, *b* is the major 
    55 equatorial radius, and c is the polar radius of the ellipsoid. 
     52parameters, $R_a$ is the minor equatorial radius, $R_b$ is the major 
     53equatorial radius, and $R_c$ is the polar radius of the ellipsoid. 
    5654 
    5755NB: The 2nd virial coefficient of the triaxial solid ellipsoid is 
    5856calculated based on the polar radius $R_p = R_c$ and equatorial 
    5957radius $R_e = \sqrt{R_a R_b}$, and used as the effective radius for 
    60 $S(Q)$ when $P(Q) \cdot S(Q)$ is applied. 
     58$S(q)$ when $P(q) \cdot S(q)$ is applied. 
    6159 
    6260.. figure:: img/triaxial_ellipsoid_1d.jpg 
     
    8179    Comparison between 1D and averaged 2D. 
    8280 
    83 Our model uses the form factor calculations implemented in a c-library provided by the NIST Center for Neutron Research 
    84 (Kline, 2006) 
    85  
    86 REFERENCE 
     81References 
     82---------- 
    8783 
    8884L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and Neutron Scattering*, Plenum, 
Note: See TracChangeset for help on using the changeset viewer.