Changeset 19dcb933 in sasmodels for sasmodels/models/cylinder_clone.py


Ignore:
Timestamp:
Sep 3, 2014 3:16:10 AM (10 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:
1c7ffdc
Parents:
87985ca
Message:

build docs for models

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/cylinder_clone.py

    r5d4777d r19dcb933  
    1 r""" 
    2 CylinderModel 
    3 ============= 
    4  
    5 This model provides the form factor for a right circular cylinder with uniform 
    6 scattering length density. The form factor is normalized by the particle volume. 
    7  
    8 For information about polarised and magnetic scattering, click here_. 
    9  
    10 Definition 
    11 ---------- 
    12  
    13 The output of the 2D scattering intensity function for oriented cylinders is 
    14 given by (Guinier, 1955) 
    15  
    16 .. math:: 
    17  
    18     P(q,\alpha) = \frac{\text{scale}}{V}f^2(q) + \text{bkg} 
    19  
    20 where 
    21  
    22 .. math:: 
    23  
    24     f(q) = 2 (\Delta \rho) V 
    25            \frac{\sin (q L/2 \cos \alpha)}{q L/2 \cos \alpha} 
    26            \frac{J_1 (q r \sin \alpha)}{q r \sin \alpha} 
    27  
    28 and $\alpha$ is the angle between the axis of the cylinder and $\vec q$, $V$ 
    29 is the volume of the cylinder, $L$ is the length of the cylinder, $r$ is the 
    30 radius of the cylinder, and $d\rho$ (contrast) is the scattering length density 
    31 difference between the scatterer and the solvent. $J_1$ is the first order 
    32 Bessel function. 
    33  
    34 To provide easy access to the orientation of the cylinder, we define the 
    35 axis of the cylinder using two angles $\theta$ and $\phi$. Those angles 
    36 are defined in Figure :num:`figure #CylinderModel-orientation`. 
    37  
    38 .. _CylinderModel-orientation: 
    39  
    40 .. figure:: img/image061.JPG 
    41  
    42     Definition of the angles for oriented cylinders. 
    43  
    44 .. figure:: img/image062.JPG 
    45  
    46     Examples of the angles for oriented pp against the detector plane. 
    47  
    48 NB: The 2nd virial coefficient of the cylinder is calculated based on the 
    49 radius and length values, and used as the effective radius for $S(Q)$ 
    50 when $P(Q) \cdot S(Q)$ is applied. 
    51  
    52 The returned value is scaled to units of |cm^-1| and the parameters of 
    53 the CylinderModel are the following: 
    54  
    55 %(parameters)s 
    56  
    57 The output of the 1D scattering intensity function for randomly oriented 
    58 cylinders is then given by 
    59  
    60 .. math:: 
    61  
    62     P(q) = \frac{\text{scale}}{V} 
    63         \int_0^{\pi/2} f^2(q,\alpha) \sin \alpha d\alpha + \text{background} 
    64  
    65 The *theta* and *phi* parameters are not used for the 1D output. Our 
    66 implementation of the scattering kernel and the 1D scattering intensity 
    67 use the c-library from NIST. 
    68  
    69 Validation of the CylinderModel 
    70 ------------------------------- 
    71  
    72 Validation of our code was done by comparing the output of the 1D model 
    73 to the output of the software provided by the NIST (Kline, 2006). 
    74 Figure :num:`figure #CylinderModel-compare` shows a comparison of 
    75 the 1D output of our model and the output of the NIST software. 
    76  
    77 .. _CylinderModel-compare: 
    78  
    79 .. figure:: img/image065.JPG 
    80  
    81     Comparison of the SasView scattering intensity for a cylinder with the 
    82     output of the NIST SANS analysis software. 
    83     The parameters were set to: *Scale* = 1.0, *Radius* = 20 |Ang|, 
    84     *Length* = 400 |Ang|, *Contrast* = 3e-6 |Ang^-2|, and 
    85     *Background* = 0.01 |cm^-1|. 
    86  
    87 In general, averaging over a distribution of orientations is done by 
    88 evaluating the following 
    89  
    90 .. math:: 
    91  
    92     P(q) = \int_0^{\pi/2} d\phi 
    93         \int_0^\pi p(\theta, \phi) P_0(q,\alpha) \sin \theta d\theta 
    94  
    95  
    96 where $p(\theta,\phi)$ is the probability distribution for the orientation 
    97 and $P_0(q,\alpha)$ is the scattering intensity for the fully oriented 
    98 system. Since we have no other software to compare the implementation of 
    99 the intensity for fully oriented cylinders, we can compare the result of 
    100 averaging our 2D output using a uniform distribution $p(\theta, \phi) = 1.0$. 
    101 Figure :num:`figure #CylinderModel-crosscheck` shows the result of 
    102 such a cross-check. 
    103  
    104 .. _CylinderModel-crosscheck: 
    105  
    106 .. figure:: img/image066.JPG 
    107  
    108     Comparison of the intensity for uniformly distributed cylinders 
    109     calculated from our 2D model and the intensity from the NIST SANS 
    110     analysis software. 
    111     The parameters used were: *Scale* = 1.0, *Radius* = 20 |Ang|, 
    112     *Length* = 400 |Ang|, *Contrast* = 3e-6 |Ang^-2|, and 
    113     *Background* = 0.0 |cm^-1|. 
    114 """ 
    1151 
    1162from numpy import pi, inf 
Note: See TracChangeset for help on using the changeset viewer.