Changeset 40a87fa in sasmodels for sasmodels/models/parallelepiped.py


Ignore:
Timestamp:
Aug 8, 2016 9:24:11 AM (8 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:
2472141
Parents:
2d65d51
Message:

lint and latex cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/parallelepiped.py

    r42356c8 r40a87fa  
    77---------- 
    88 
    9 | This model calculates the scattering from a rectangular parallelepiped (:numref:`parallelepiped-image`). 
     9| This model calculates the scattering from a rectangular parallelepiped 
     10| (:numref:`parallelepiped-image`). 
    1011| If you need to apply polydispersity, see also :ref:`rectangular-prism`. 
    1112 
     
    3435.. math:: 
    3536 
    36     I(q) = \frac{\text{scale}}{V} (\Delta\rho \cdot V)^2 \left< P(q, \alpha) \right> 
    37     + \text{background} 
     37    I(q) = \frac{\text{scale}}{V} (\Delta\rho \cdot V)^2 
     38           \left< P(q, \alpha) \right> + \text{background} 
    3839 
    3940where the volume $V = A B C$, the contrast is defined as 
    40 :math:`\Delta\rho = \rho_{\textstyle p} - \rho_{\textstyle solvent}`, 
     41$\Delta\rho = \rho_\text{p} - \rho_\text{solvent}$, 
    4142$P(q, \alpha)$ is the form factor corresponding to a parallelepiped oriented 
    42 at an angle $\alpha$ (angle between the long axis C and :math:`\vec q`), 
     43at an angle $\alpha$ (angle between the long axis C and $\vec q$), 
    4344and the averaging $\left<\ldots\right>$ is applied over all orientations. 
    4445 
     
    5556.. math:: 
    5657 
    57     \phi_Q(\mu,a) = \int_0^1 
     58    \phi_Q(\mu,a) &= \int_0^1 
    5859        \left\{S\left[\frac{\mu}{2}\cos\left(\frac{\pi}{2}u\right)\right] 
    5960               S\left[\frac{\mu a}{2}\sin\left(\frac{\pi}{2}u\right)\right] 
    6061               \right\}^2 du 
    6162 
    62     S(x) = \frac{\sin x}{x} 
    63  
    64     \mu = qB 
     63    S(x) &= \frac{\sin x}{x} 
     64 
     65    \mu &= qB 
    6566 
    6667 
     
    105106.. figure:: img/parallelepiped_angle_projection.jpg 
    106107 
    107     Examples of the angles for oriented parallelepipeds against the detector plane. 
    108  
    109 For a given orientation of the parallelepiped, the 2D form factor is calculated as 
    110  
    111 .. math:: 
    112  
    113     P(q_x, q_y) = \left[\frac{sin(qA\cos\alpha/2)}{(qA\cos\alpha/2)}\right]^2 
    114                   \left[\frac{sin(qB\cos\beta/2)}{(qB\cos\beta/2)}\right]^2 
    115                   \left[\frac{sin(qC\cos\gamma/2)}{(qC\cos\gamma/2)}\right]^2 
     108    Examples of the angles for oriented parallelepipeds against the 
     109    detector plane. 
     110 
     111For a given orientation of the parallelepiped, the 2D form factor is 
     112calculated as 
     113 
     114.. math:: 
     115 
     116    P(q_x, q_y) = \left[\frac{\sin(qA\cos\alpha/2)}{(qA\cos\alpha/2)}\right]^2 
     117                  \left[\frac{\sin(qB\cos\beta/2)}{(qB\cos\beta/2)}\right]^2 
     118                  \left[\frac{\sin(qC\cos\gamma/2)}{(qC\cos\gamma/2)}\right]^2 
    116119 
    117120with 
     
    119122.. math:: 
    120123 
    121     \cos\alpha = \hat A \cdot \hat q, \; 
    122     \cos\beta  = \hat B \cdot \hat q, \; 
    123     \cos\gamma = \hat C \cdot \hat q 
     124    \cos\alpha &= \hat A \cdot \hat q, 
     125 
     126    \cos\beta  &= \hat B \cdot \hat q, 
     127 
     128    \cos\gamma &= \hat C \cdot \hat q 
    124129 
    125130and the scattering intensity as: 
     
    127132.. math:: 
    128133 
    129     I(q_x, q_y) = \frac{\text{scale}}{V} V^2 \Delta\rho^2 P(q_x, q_y) + \text{background} 
     134    I(q_x, q_y) = \frac{\text{scale}}{V} V^2 \Delta\rho^2 P(q_x, q_y) 
     135            + \text{background} 
    130136 
    131137.. Comment by Miguel Gonzalez: 
    132138   This reflects the logic of the code, as in parallelepiped.c the call 
    133    to _pkernel returns P(q_x, q_y) and then this is multiplied by V^2 * (delta rho)^2. 
    134    And finally outside parallelepiped.c it will be multiplied by scale, normalized by 
    135    V and the background added. But mathematically it makes more sense to write 
    136    I(q_x, q_y) = \text{scale} V \Delta\rho^2 P(q_x, q_y) + \text{background}, 
     139   to _pkernel returns $P(q_x, q_y)$ and then this is multiplied by 
     140   $V^2 * (\Delta \rho)^2$. And finally outside parallelepiped.c it will be 
     141   multiplied by scale, normalized by $V$ and the background added. But 
     142   mathematically it makes more sense to write 
     143   $I(q_x, q_y) = \text{scale} V \Delta\rho^2 P(q_x, q_y) + \text{background}$, 
    137144   with scale being the volume fraction. 
    138145 
     
    143150Validation of the code was done by comparing the output of the 1D calculation 
    144151to the angular average of the output of a 2D calculation over all possible 
    145 angles.  
     152angles. 
    146153 
    147154This model is based on form factor calculations implemented in a c-library 
Note: See TracChangeset for help on using the changeset viewer.