Changeset eb69cce in sasmodels for sasmodels/models/barbell.py


Ignore:
Timestamp:
Nov 30, 2015 7:18:41 PM (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:
d18f8a8
Parents:
d138d43
Message:

make model docs more consistent; build pdf docs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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"], 
Note: See TracChangeset for help on using the changeset viewer.