Changeset a5d0d00 in sasmodels


Ignore:
Timestamp:
Feb 27, 2015 11:16:23 AM (9 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:
61ba623
Parents:
529b8b4
Message:

doc fixups: add doc category to model def, convert equations to latex for barbell and bcc

Location:
sasmodels
Files:
5 added
3 deleted
22 edited
1 moved

Legend:

Unmodified
Added
Removed
  • sasmodels/generate.py

    r6137124 ra5d0d00  
    210210RST_UNITS = { 
    211211    "Ang": "|Ang|", 
     212    "1/Ang": "|Ang^-1|", 
    212213    "1/Ang^2": "|Ang^-2|", 
    213214    "1e-6/Ang^2": "|1e-6Ang^-2|", 
  • sasmodels/models/barbell.py

    r0706431 ra5d0d00  
    1616The barbell geometry is defined as 
    1717 
    18 .. image:: img/image105.jpg 
     18.. image:: img/barbell_geometry.jpg 
    1919 
    2020where *r* is the radius of the cylinder. All other parameters are as defined in the diagram. 
     
    7171**The requirement that** *R* >= *r* **is not enforced in the model!** It is up to you to restrict this during analysis. 
    7272 
    73 This example dataset is produced by running the Macro PlotBarbell(), using 200 data points, *qmin* = 0.001 |Ang^-1|, 
    74 *qmax* = 0.7 |Ang^-1| and the following default values 
     73This example dataset is produced by running the Macro PlotBarbell(), 
     74using 200 data points, *qmin* = 0.001 |Ang^-1|, *qmax* = 0.7 |Ang^-1|, 
     75*sld* = 4e-6 |Ang^-2| and the default model values. 
    7576 
    76 ==============  ========  ============= 
    77 Parameter name  Units     Default value 
    78 ==============  ========  ============= 
    79 scale           None      1.0 
    80 len_bar         |Ang|     400.0 
    81 rad_bar         |Ang|     20.0 
    82 rad_bell        |Ang|     40.0 
    83 sld_barbell     |Ang^-2|  1.0e-006 
    84 sld_solv        |Ang^-2|  6.3e-006 
    85 background      |cm^-1|   0 
    86 ==============  ========  ============= 
    87  
    88 .. image:: img/image110.jpg 
     77.. image:: img/barbell_1d.jpg 
    8978 
    9079*Figure. 1D plot using the default values (w/256 data point).* 
     
    9382|theta| = 45 deg and |phi| = 0 deg with default values for other parameters 
    9483 
    95 .. image:: img/image111.jpg 
     84.. image:: img/barbell_2d.jpg 
    9685 
    9786*Figure. 2D plot (w/(256X265) data points).* 
     
    10695 
    10796REFERENCE 
     97--------- 
    10898 
    10999H Kaya, *J. Appl. Cryst.*, 37 (2004) 37 223-230 
     
    122112                It must be that rad_bar <(=) rad_bell. 
    123113""" 
     114category = "shape:cylinder" 
    124115 
    125116parameters = [ 
  • sasmodels/models/bcc.py

    re166cb9 ra5d0d00  
    33#note - calculation requires double precision 
    44""" 
    5 Calculates the scattering from a **body-centered cubic lattice** with paracrystalline distortion. Thermal vibrations 
    6 are considered to be negligible, and the size of the paracrystal is infinitely large. Paracrystalline distortion is 
    7 assumed to be isotropic and characterized by a Gaussian distribution. 
     5Calculates the scattering from a **body-centered cubic lattice** with 
     6paracrystalline distortion. Thermal vibrations are considered to be negligible, 
     7and the size of the paracrystal is infinitely large. Paracrystalline distortion 
     8is assumed to be isotropic and characterized by a Gaussian distribution. 
    89 
    910The returned value is scaled to units of |cm^-1|\ |sr^-1|, absolute scale. 
     
    1213---------- 
    1314 
    14 The scattering intensity *I(q)* is calculated as 
     15The scattering intensity $I(q)$ is calculated as 
    1516 
    16 .. image:: img/image167.jpg 
     17.. math: 
    1718 
    18 where *scale* is the volume fraction of spheres, *Vp* is the volume of the primary particle, *V(lattice)* is a volume 
    19 correction for the crystal structure, *P(q)* is the form factor of the sphere (normalized), and *Z(q)* is the 
    20 paracrystalline structure factor for a body-centered cubic structure. 
     19    I(q) = \frac{\text{scale}}{V_P} V_\text{lattice} P(q) Z(q) 
    2120 
    22 Equation (1) of the 1990 reference is used to calculate *Z(q)*, using equations (29)-(31) from the 1987 paper for 
    23 *Z1*\ , *Z2*\ , and *Z3*\ . 
    2421 
    25 The lattice correction (the occupied volume of the lattice) for a body-centered cubic structure of particles of radius 
    26 *R* and nearest neighbor separation *D* is 
     22where *scale* is the volume fraction of spheres, *Vp* is the volume of the 
     23primary particle, *V(lattice)* is a volume correction for the crystal 
     24structure, $P(q)$ is the form factor of the sphere (normalized), and $Z(q)$ 
     25is the paracrystalline structure factor for a body-centered cubic structure. 
    2726 
    28 .. image:: img/image159.jpg 
     27Equation (1) of the 1990 reference is used to calculate $Z(q)$, using 
     28equations (29)-(31) from the 1987 paper for *Z1*\ , *Z2*\ , and *Z3*\ . 
    2929 
    30 The distortion factor (one standard deviation) of the paracrystal is included in the calculation of *Z(q)* 
     30The lattice correction (the occupied volume of the lattice) for a 
     31body-centered cubic structure of particles of radius $R$ and nearest neighbor 
     32separation $D$ is 
    3133 
    32 .. image:: img/image160.jpg 
     34.. math: 
    3335 
    34 where *g* is a fractional distortion based on the nearest neighbor distance. 
     36    V_\text{lattice} = \frac{16\pi}{3} \frac{R^3}{\left(D\sqrt{2}\right)^3} 
     37 
     38 
     39The distortion factor (one standard deviation) of the paracrystal is included 
     40in the calculation of $Z(q)$ 
     41 
     42.. math: 
     43 
     44    \Delta a = g D 
     45 
     46where $g$ is a fractional distortion based on the nearest neighbor distance. 
    3547 
    3648The body-centered cubic lattice is 
    3749 
    38 .. image:: img/image168.jpg 
     50.. image:: img/bcc_lattice.jpg 
    3951 
    4052For a crystal, diffraction peaks appear at reduced q-values given by 
    4153 
    42 .. image:: img/image162.jpg 
     54.. math: 
    4355 
    44 where for a body-centered cubic lattice, only reflections where (\ *h* + *k* + *l*\ ) = even are allowed and 
    45 reflections where (\ *h* + *k* + *l*\ ) = odd are forbidden. Thus the peak positions correspond to (just the first 5) 
     56    \frac{qD}{2\pi} = \sqrt{h^2 + k^2 + l^2} 
    4657 
    47 .. image:: img/image169.jpg 
     58where for a body-centered cubic lattice, only reflections where 
     59$(h + k + l) = \text{even}$ are allowed and reflections where 
     60$(h + k + l) = \text{odd}$ are forbidden. Thus the peak positions 
     61correspond to (just the first 5) 
    4862 
    49 **NB: The calculation of** *Z(q)* **is a double numerical integral that must be carried out with a high density of** 
    50 **points to properly capture the sharp peaks of the paracrystalline scattering.** So be warned that the calculation is 
    51 SLOW. Go get some coffee. Fitting of any experimental data must be resolution smeared for any meaningful fit. This 
    52 makes a triple integral. Very, very slow. Go get lunch! 
     63.. math: 
    5364 
    54 This example dataset is produced using 200 data points, *qmin* = 0.001 |Ang^-1|, *qmax* = 0.1 |Ang^-1| and the above 
    55 default values. 
     65    \begin{eqnarray} 
     66    &q/q_o&&\quad 1&& \ \sqrt{2} && \ \sqrt{3} && \ \sqrt{4} && \ \sqrt{5} \\ 
     67    &\text{Indices}&& (110) && (200) && (211) && (220) && (310) 
     68    \end{eqnarray} 
    5669 
    57 .. image:: img/image170.jpg 
     70**NB: The calculation of $Z(q)$ is a double numerical integral that must 
     71be carried out with a high density of points to properly capture the sharp 
     72peaks of the paracrystalline scattering.** So be warned that the calculation 
     73is SLOW. Go get some coffee. Fitting of any experimental data must be 
     74resolution smeared for any meaningful fit. This makes a triple integral. 
     75Very, very slow. Go get lunch! 
     76 
     77This example dataset is produced using 200 data points, 
     78*qmin* = 0.001 |Ang^-1|, *qmax* = 0.1 |Ang^-1| and the above default values. 
     79 
     80.. image:: img/bcc_1d.jpg 
    5881 
    5982*Figure. 1D plot in the linear scale using the default values (w/200 data point).* 
    6083 
    61 The 2D (Anisotropic model) is based on the reference below where *I(q)* is approximated for 1d scattering. Thus the 
    62 scattering pattern for 2D may not be accurate. Note that we are not responsible for any incorrectness of the 2D model 
    63 computation. 
     84The 2D (Anisotropic model) is based on the reference below where $I(q)$ is 
     85approximated for 1d scattering. Thus the scattering pattern for 2D may not 
     86be accurate. Note that we are not responsible for any incorrectness of the 2D 
     87model computation. 
    6488 
    65 .. image:: img/image165.gif 
     89.. image:: img/bcc_orientation.gif 
    6690 
    67 .. image:: img/image171.jpg 
     91.. image:: img/bcc_2d.jpg 
    6892 
    6993*Figure. 2D plot using the default values (w/200X200 pixels).* 
    7094 
    7195REFERENCE 
     96--------- 
    7297 
    7398Hideki Matsuoka et. al. *Physical Review B*, 36 (1987) 1754-1765 
     
    87112    assumed to be isotropic and characterized by a Gaussian distribution. 
    88113    """ 
     114category="shape:paracrystal" 
    89115 
    90116parameters = [ 
  • sasmodels/models/broad_peak.py

    rf734e7d ra5d0d00  
    3030    q = \sqrt{q_x^2 + q_y^2} 
    3131 
    32 =====================  =========  ============= 
    33 Parameter name          Units     Default value 
    34 =====================  =========  ============= 
    35 lorentz_scale(=C)       None      10 
    36 porod_scale  (=A)       None      1e-05 
    37 lorentz_length (= |xi| )  |Ang|     50 
    38 peak_pos  (=Q0)         |Ang^-1|  0.1 
    39 porod_exp  (=n)         None      2 
    40 lorentz_exp (=m)        None      3 
    41 Background (=B)        |cm^-1|   0.1 
    42 ==================  ========  ============= 
    4332 
    4433.. image:: img/image175.jpg 
     
    4736 
    4837REFERENCE 
     38--------- 
    4939 
    5040None. 
     
    7161      lorentz_exp = Lorentzian exponent 
    7262      background = Incoherent background""" 
     63category="shape-independent" 
    7364 
    7465parameters = [ 
  • sasmodels/models/capped_cylinder.py

    ra503bfd ra5d0d00  
    130130        solvent_sld: SLD of the solvent. 
    131131""" 
     132category = "shape:cylinder" 
    132133 
    133134parameters = [ 
  • sasmodels/models/core_shell_cylinder.py

    ra503bfd ra5d0d00  
    133133        phi: the axis_phi of the cylinder 
    134134""" 
     135category = "shape:cylinder" 
    135136 
    136137parameters = [ 
  • sasmodels/models/cylinder.py

    r43bdddc ra5d0d00  
    128128            f(q,alpha)^(2)*sin(alpha)*dalpha + background 
    129129""" 
     130category = "shape:cylinder" 
    130131 
    131132parameters = [ 
  • sasmodels/models/dab.py

    r80768fc ra5d0d00  
    4444 
    4545""" 
     46category = "shape-independent" 
    4647 
    4748parameters = [ 
  • sasmodels/models/ellipsoid.py

    ra503bfd ra5d0d00  
    136136                Re: equatorial radius of the ellipsoid 
    137137""" 
     138category = "shape:ellipsoid" 
    138139 
    139140parameters = [ 
  • sasmodels/models/fcc.py

    re7b3d7b ra5d0d00  
    8787    assumed to be isotropic and characterized by a Gaussian distribution. 
    8888    """ 
     89category = "shape:paracrystal" 
    8990 
    9091parameters = [ 
  • sasmodels/models/gaussian_peak.py

    r6ea6902 ra5d0d00  
    1616 
    1717REFERENCE 
     18--------- 
    1819 
    1920None. 
     
    2829    Provide F(q) = scale*exp( -1/2 *[(q-q0)/B]^2 )+ background 
    2930""" 
     31category = "shape-independent" 
    3032 
    3133parameters = [ 
    3234#   [ "name", "units", default, [lower, upper], "type", 
    3335#     "description" ], 
    34     [ "q0", "Ang^-1", 0.05, [-inf,inf], "", 
     36    [ "q0", "1/Ang", 0.05, [-inf,inf], "", 
    3537      "Peak position" ], 
    36     [ "sigma", "Ang^-1", 0.005, [-inf,inf], "", 
     38    [ "sigma", "1/Ang", 0.005, [-inf,inf], "", 
    3739      "Peak width (standard deviation)" ], 
    3840    ] 
  • sasmodels/models/hardsphere.py

    r529b8b4 ra5d0d00  
    4646        volfraction is the volume fraction occupied by the spheres. 
    4747""" 
     48category = "structure-factor" 
    4849 
    4950parameters = [ 
  • sasmodels/models/lamellar.py

    ra503bfd ra5d0d00  
    6161                scale = scale factor 
    6262""" 
     63category = "shape:lamellae" 
    6364 
    6465parameters = [ 
  • sasmodels/models/lamellarCaille.py

    rdc02af0 ra5d0d00  
    11# Note: model title and parameter table are inserted automatically 
    22r""" 
    3 This model provides the scattering intensity, *I(q)* = *P(q)* \* *S(q)*, for a lamellar phase where a random 
    4 distribution in solution are assumed. Here a Caille S(Q) is used for the lamellar stacks. 
     3This model provides the scattering intensity, $I(q) = P(q) S(q)$, for a 
     4lamellar phase where a random distribution in solution are assumed. 
     5Here a Caille $S(Q)$ is used for the lamellar stacks. 
    56 
    6 The scattering intensity *I(q)* is 
     7The scattering intensity $I(q)$ is 
    78 
    8 .. image:: img/lamellarCaille_139.PNG 
     9.. math: 
     10 
     11    I(q) = 2\pi \frac{P(q)S(q)}{\delta q^2} 
    912 
    1013The form factor is 
    1114 
    12 .. image:: img/lamellarCaille_134.PNG 
     15.. math: 
     16 
     17    P(q) = \frac{2\Delta\rho^2}{q^2}\left(1-\cos q\delta \right) 
    1318 
    1419and the structure factor is 
    1520 
    16 .. image:: img/lamellarCaille_.PNG 
     21.. math: 
     22 
     23    S(q) = 1 + 2 \sum_1^{N-1}\left(1-\frac{n}{N}\right) 
     24           \cos(qdn)\exp\left(-\frac{2q^2d^2\alpha(n)}{2}\right) 
    1725 
    1826where 
    1927 
    20 .. image:: img/lamellarCaille_.PNG 
     28.. math: 
    2129 
    22 Here *d* = (repeat) spacing, |delta| = bilayer thickness, the contrast |drho| = SLD(headgroup) - SLD(solvent), 
    23 K = smectic bending elasticity, B = compression modulus, and N = number of lamellar plates (*n_plates*). 
     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} 
    2435 
    25 NB: **When the Caille parameter is greater than approximately 0.8 to 1.0, the assumptions of the model are incorrect.** 
    26 And due to a complication of the model function, users are responsible for making sure that all the assumptions are 
    27 handled accurately (see the original reference below for more details). 
     36Here $d$ = (repeat) spacing, $\delta$ = bilayer thickness, 
     37the contrast $\Delta\rho$ = SLD(headgroup) - SLD(solvent), 
     38$K$ = smectic bending elasticity, $B$ = compression modulus, and 
     39$N$ = number of lamellar plates (*n_plates*). 
    2840 
    29 Non-integer numbers of stacks are calculated as a linear combination of results for the next lower and higher values. 
     41NB: **When the Caille parameter is greater than approximately 0.8 to 1.0, the 
     42assumptions of the model are incorrect.** And due to a complication of the 
     43model function, users are responsible for making sure that all the assumptions 
     44are handled accurately (see the original reference below for more details). 
    3045 
    31 The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as 
     46Non-integer numbers of stacks are calculated as a linear combination of 
     47results for the next lower and higher values. 
     48 
     49The 2D scattering intensity is calculated in the same way as 1D, where the 
     50$q$ vector is defined as 
    3251 
    3352.. math:: 
    3453 
    35     Q = \sqrt{Q_x^2 + Q_y^2} 
     54    q = \sqrt{q_x^2 + q_y^2} 
    3655 
    3756The returned value is in units of |cm^-1|, on absolute scale. 
    3857 
    39 ==============  ========  ============= 
    40 Parameter name  Units     Default value 
    41 ==============  ========  ============= 
    42 background      |cm^-1|   0.0 
    43 contrast        |Ang^-2|  5e-06 
    44 scale           None      1 
    45 delta           |Ang|     30 
    46 n_plates        None      20 
    47 spacing         |Ang|     400 
    48 caille          |Ang^-2|  0.1 
    49 ==============  ========  ============= 
    50  
    51 .. image:: img/lamellarPS_142.jpg 
     58.. image:: img/lamellarCaille_1d.jpg 
    5259 
    5360*Figure. 1D plot using the default values (w/6000 data point).* 
    5461 
    55 Our model uses the form factor calculations implemented in a c-library provided by the NIST Center for Neutron Research 
    56 (Kline, 2006). 
     62Our model uses the form factor calculations as implemented in a c library 
     63provided by the NIST Center for Neutron Research (Kline, 2006). 
    5764 
    5865REFERENCE 
     66--------- 
    5967 
    6068F Nallet, R Laversanne, and D Roux, J. Phys. II France, 3, (1993) 487-502 
     
    7583                scale = scale factor 
    7684""" 
     85category = "shape:lamellae" 
    7786 
    7887parameters = [ 
     
    8594    [ "spacing", "Ang", 400., [0.0,inf], "volume", 
    8695      "d-spacing of Caille S(Q)" ], 
    87     [ "Caille_parameter", "Ang^-2", 0.1, [0.0,0.8], "", 
     96    [ "Caille_parameter", "1/Ang^2", 0.1, [0.0,0.8], "", 
    8897      "Caille parameter" ], 
    8998    [ "sld", "1e-6/Ang^2", 6.3, [-inf,inf], "", 
  • sasmodels/models/lamellarCailleHG.py

    rcd55ac3 ra5d0d00  
    8282                scale = scale factor 
    8383""" 
     84category = "shape:lamellae" 
    8485 
    8586parameters = [ 
  • sasmodels/models/lamellarFFHG.py

    rdc02af0 ra5d0d00  
    7171                scale = scale factor 
    7272""" 
     73category = "shape:lamellae" 
    7374 
    7475parameters = [ 
  • sasmodels/models/lamellarPC.py

    rf734e7d ra5d0d00  
    7171                scale = scale factor 
    7272""" 
     73category = "shape:lamellae" 
    7374 
    7475parameters = [ 
  • sasmodels/models/parallelepiped.py

    rc5b7d07 ra5d0d00  
    114114            mu = q*B 
    115115""" 
     116category = "shape:parallelpiped" 
    116117 
    117118parameters = [ 
    118119#   [ "name", "units", default, [lower, upper], "type", 
    119120#     "description" ], 
    120     [ "sld", "6e-6/Ang^2", 4, [-inf,inf], "", 
     121    [ "sld", "1e-6/Ang^2", 4, [-inf,inf], "", 
    121122      "Parallelepiped scattering length density" ], 
    122123    [ "solvent_sld", "1e-6/Ang^2", 1, [-inf,inf], "", 
  • sasmodels/models/sphere.py

    ra503bfd ra5d0d00  
    7070    solvent_sld: the SLD of the solvent 
    7171""" 
     72category = "shape:sphere" 
    7273 
    7374parameters = [ 
  • sasmodels/models/spherepy.py

    ra503bfd ra5d0d00  
    7171    solvent_sld: the SLD of the solvent 
    7272""" 
     73category = "shape:sphere" 
    7374 
    7475parameters = [ 
  • sasmodels/models/stickyhardsphere.py

    r9cb1415 ra5d0d00  
    7070                parameters used in P(Q). 
    7171""" 
     72category = "structure-factor" 
    7273 
    7374parameters = [ 
  • sasmodels/models/triaxial_ellipsoid.py

    ra503bfd ra5d0d00  
    100100        not be correct. 
    101101""" 
     102category = "shape:ellipsoid" 
    102103 
    103104parameters = [ 
Note: See TracChangeset for help on using the changeset viewer.