Changes in / [475ff58:1a3c0c6] in sasmodels


Ignore:
Location:
sasmodels/models
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/core_shell_cylinder.py

    r2d81cfe re31b19a  
    55The output of the 2D scattering intensity function for oriented core-shell 
    66cylinders is given by (Kline, 2006 [#kline]_). The form factor is normalized 
    7 by the particle volume. 
     7by the particle volume. Note that in this model the shell envelops the entire 
     8core so that besides a "sleeve" around the core, the shell also provides two 
     9flat end caps of thickness = shell thickness. In other words the length of the 
     10total cyclinder is the length of the core cylinder plus twice the thickness of 
     11the shell. If no end caps are desired one should use the 
     12:ref:`core-shell-bicelle` and set the thickness of the end caps (in this case 
     13the "thick_face") to zero. 
    814 
    915.. math:: 
     
    3339 
    3440and $\alpha$ is the angle between the axis of the cylinder and $\vec q$, 
    35 $V_s$ is the volume of the outer shell (i.e. the total volume, including 
    36 the shell), $V_c$ is the volume of the core, $L$ is the length of the core, 
     41$V_s$ is the total volume (i.e. including both the core and the outer shell), 
     42$V_c$ is the volume of the core, $L$ is the length of the core, 
    3743$R$ is the radius of the core, $T$ is the thickness of the shell, $\rho_c$ 
    3844is the scattering length density of the core, $\rho_s$ is the scattering 
     
    135141    return 0.5 * (ddd) ** (1. / 3.) 
    136142 
    137 def VR(radius, thickness, length): 
    138     """ 
    139     Returns volume ratio 
    140     """ 
    141     whole = pi * (radius + thickness) ** 2 * (length + 2 * thickness) 
    142     core = pi * radius ** 2 * length 
    143     return whole, whole - core 
    144  
    145143def random(): 
    146144    outer_radius = 10**np.random.uniform(1, 4.7) 
  • sasmodels/models/core_shell_sphere.py

    rdc76240 rda1c8d1  
    8989    return radius + thickness 
    9090 
    91 def VR(radius, thickness): 
    92     """ 
    93         Volume ratio 
    94         @param radius: core radius 
    95         @param thickness: shell thickness 
    96     """ 
    97     return (1, 1) 
    98     whole = 4.0/3.0 * pi * (radius + thickness)**3 
    99     core = 4.0/3.0 * pi * radius**3 
    100     return whole, whole - core 
    101  
    10291def random(): 
    10392    outer_radius = 10**np.random.uniform(1.3, 4.3) 
     
    114103tests = [ 
    115104    [{'radius': 20.0, 'thickness': 10.0}, 'ER', 30.0], 
    116     # TODO: VR test suppressed until we sort out new product model 
    117     # and determine what to do with volume ratio. 
    118     #[{'radius': 20.0, 'thickness': 10.0}, 'VR', 0.703703704], 
    119105 
    120106    # The SasView test result was 0.00169, with a background of 0.001 
  • sasmodels/models/fractal_core_shell.py

    ref07e95 reb3eb38  
    8888    ["sld_shell",   "1e-6/Ang^2", 2.0,  [-inf, inf], "sld",    "Sphere shell scattering length density"], 
    8989    ["sld_solvent", "1e-6/Ang^2", 3.0,  [-inf, inf], "sld",    "Solvent scattering length density"], 
    90     ["volfraction", "",           1.0,  [0.0, inf],  "",       "Volume fraction of building block spheres"], 
     90    ["volfraction", "",           0.05,  [0.0, inf],  "",       "Volume fraction of building block spheres"], 
    9191    ["fractal_dim",    "",        2.0,  [0.0, 6.0],  "",       "Fractal dimension"], 
    9292    ["cor_length",  "Ang",      100.0,  [0.0, inf],  "",       "Correlation length of fractal-like aggregates"], 
     
    134134    return radius + thickness 
    135135 
    136 def VR(radius, thickness): 
    137     """ 
    138         Volume ratio 
    139         @param radius: core radius 
    140         @param thickness: shell thickness 
    141     """ 
    142     whole = 4.0/3.0 * pi * (radius + thickness)**3 
    143     core = 4.0/3.0 * pi * radius**3 
    144     return whole, whole-core 
     136tests = [[{'radius': 20.0, 'thickness': 10.0}, 'ER', 30.0], 
    145137 
    146 tests = [[{'radius': 20.0, 'thickness': 10.0}, 'ER', 30.0], 
    147          [{'radius': 20.0, 'thickness': 10.0}, 'VR', 0.703703704]] 
    148  
    149 #         # The SasView test result was 0.00169, with a background of 0.001 
    150 #         # They are however wrong as we now know.  IGOR might be a more 
    151 #         # appropriate source. Otherwise will just have to assume this is now 
    152 #         # correct and self generate a correct answer for the future. Until we 
    153 #         # figure it out leave the tests commented out 
    154 #         [{'radius': 60.0, 
    155 #           'thickness': 10.0, 
    156 #           'sld_core': 1.0, 
    157 #           'sld_shell': 2.0, 
    158 #           'sld_solvent': 3.0, 
    159 #           'background': 0.0 
    160 #          }, 0.015211, 692.84]] 
     138#         # At some point the SasView 3.x test result was deemed incorrect. The 
     139          #following tests were verified against NIST IGOR macros ver 7.850. 
     140          #NOTE: NIST macros do only provide for a polydispers core (no option 
     141          #for a poly shell or for a monodisperse core.  The results seemed 
     142          #extremely sensitive to the core PD, varying non monotonically all 
     143          #the way to a PD of 1e-6. From 1e-6 to 1e-9 no changes in the 
     144          #results were observed and the values below were taken using PD=1e-9. 
     145          #Non-monotonically = I(0.001)=188 to 140 to 177 back to 160 etc. 
     146         [{'radius': 20.0, 
     147           'thickness': 5.0, 
     148           'sld_core': 3.5, 
     149           'sld_shell': 1.0, 
     150           'sld_solvent': 6.35, 
     151           'volfraction': 0.05, 
     152           'background': 0.0}, 
     153           [0.001,0.00291,0.0107944,0.029923,0.100726,0.476304], 
     154           [177.146,165.151,84.1596,20.1466,1.40906,0.00622666]]] 
  • sasmodels/models/hollow_cylinder.py

    r2d81cfe r455aaa1  
    11r""" 
     2Definition 
     3---------- 
     4 
    25This model provides the form factor, $P(q)$, for a monodisperse hollow right 
    3 angle circular cylinder (rigid tube) where the form factor is normalized by the 
    4 volume of the tube (i.e. not by the external volume). 
     6angle circular cylinder (rigid tube) where the The inside and outside of the 
     7hollow cylinder are assumed to have the same SLD and the form factor is thus 
     8normalized by the volume of the tube (i.e. not by the total cylinder volume). 
    59 
    610.. math:: 
     
    812    P(q) = \text{scale} \left<F^2\right>/V_\text{shell} + \text{background} 
    913 
    10 where the averaging $\left<\ldots\right>$ is applied only for the 1D calculation. 
     14where the averaging $\left<\ldots\right>$ is applied only for the 1D 
     15calculation. If Intensity is given on an absolute scale, the scale factor here 
     16is the volume fraction of the shell.  This differs from 
     17the :ref:`core-shell-cylinder` in that, in that case, scale is the volume 
     18fraction of the entire cylinder (core+shell). The application might be for a 
     19bilayer which wraps into a hollow tube and the volume fraction of material is 
     20all in the shell, whereas the :ref:`core-shell-cylinder` model might be used for 
     21a cylindrical micelle where the tails in the core have a different SLD than the 
     22headgroups (in the shell) and the volume fraction of material comes fromm the 
     23whole cyclinder.  NOTE: the hollow_cylinder represents a tube whereas the 
     24core_shell_cylinder includes a shell layer covering the ends (end caps) as well. 
    1125 
    12 The inside and outside of the hollow cylinder are assumed have the same SLD. 
    13  
    14 Definition 
    15 ---------- 
    1626 
    1727The 1D scattering intensity is calculated in the following way (Guinier, 1955) 
     
    4858---------- 
    4959 
    50 L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and 
    51 Neutron Scattering*, Plenum Press, New York, (1987) 
     60.. [#] L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and 
     61   Neutron Scattering*, Plenum Press, New York, (1987) 
    5262 
    5363Authorship and Verification 
     
    5565 
    5666* **Author:** NIST IGOR/DANSE **Date:** pre 2010 
    57 * **Last Modified by:** Richard Heenan **Date:** October 06, 2016 
    58    (reparametrised to use thickness, not outer radius) 
    59 * **Last Reviewed by:** Richard Heenan **Date:** October 06, 2016 
     67* **Last Modified by:** Paul Butler **Date:** September 06, 2018 
     68   (corrected VR calculation) 
     69* **Last Reviewed by:** Paul Butler **Date:** September 06, 2018 
    6070""" 
    6171 
     
    120130    vol_total = pi*router*router*length 
    121131    vol_shell = vol_total - vol_core 
    122     return vol_shell, vol_total 
     132    return vol_total, vol_shell 
    123133 
    124134def random(): 
     
    151161tests = [ 
    152162    [{}, 0.00005, 1764.926], 
    153     [{}, 'VR', 1.8], 
     163    [{}, 'VR', 0.55555556], 
    154164    [{}, 0.001, 1756.76], 
    155165    [{}, (qx, qy), 2.36885476192], 
  • sasmodels/models/hollow_rectangular_prism.py

    r2d81cfe r455aaa1  
    22# Note: model title and parameter table are inserted automatically 
    33r""" 
    4  
    5 This model provides the form factor, $P(q)$, for a hollow rectangular 
    6 parallelepiped with a wall of thickness $\Delta$. 
    7  
    8  
    94Definition 
    105---------- 
    116 
    12 The 1D scattering intensity for this model is calculated by forming 
    13 the difference of the amplitudes of two massive parallelepipeds 
    14 differing in their outermost dimensions in each direction by the 
    15 same length increment $2\Delta$ (Nayuk, 2012). 
     7This model provides the form factor, $P(q)$, for a hollow rectangular 
     8parallelepiped with a wall of thickness $\Delta$. The 1D scattering intensity 
     9for this model is calculated by forming the difference of the amplitudes of two 
     10massive parallelepipeds differing in their outermost dimensions in each 
     11direction by the same length increment $2\Delta$ (\ [#Nayuk2012]_ Nayuk, 2012). 
    1612 
    1713As in the case of the massive parallelepiped model (:ref:`rectangular-prism`), 
     
    6157  \rho_\text{solvent})^2 \times P(q) + \text{background} 
    6258 
    63 where $\rho_\text{p}$ is the scattering length of the parallelepiped, 
    64 $\rho_\text{solvent}$ is the scattering length of the solvent, 
     59where $\rho_\text{p}$ is the scattering length density of the parallelepiped, 
     60$\rho_\text{solvent}$ is the scattering length density of the solvent, 
    6561and (if the data are in absolute units) *scale* represents the volume fraction 
    66 (which is unitless). 
     62(which is unitless) of the rectangular shell of material (i.e. not including 
     63the volume of the solvent filled core). 
    6764 
    6865For 2d data the orientation of the particle is required, described using 
     
    7370 
    7471For 2d, constraints must be applied during fitting to ensure that the inequality 
    75 $A < B < C$ is not violated, and hence the correct definition of angles is preserved. The calculation will not report an error, 
    76 but the results may be not correct. 
     72$A < B < C$ is not violated, and hence the correct definition of angles is 
     73preserved. The calculation will not report an error if the inequality is *not* 
     74preserved, but the results may be not correct. 
    7775 
    7876.. figure:: img/parallelepiped_angle_definition.png 
     
    9997---------- 
    10098 
    101 R Nayuk and K Huber, *Z. Phys. Chem.*, 226 (2012) 837-854 
     99.. [#Nayuk2012] R Nayuk and K Huber, *Z. Phys. Chem.*, 226 (2012) 837-854 
     100 
     101 
     102Authorship and Verification 
     103---------------------------- 
     104 
     105* **Author:** Miguel Gonzales **Date:** February 26, 2016 
     106* **Last Modified by:** Paul Kienzle **Date:** December 14, 2017 
     107* **Last Reviewed by:** Paul Butler **Date:** September 06, 2018 
    102108""" 
    103109 
  • sasmodels/models/hollow_rectangular_prism_thin_walls.py

    r2d81cfe r6e7d7b6  
    22# Note: model title and parameter table are inserted automatically 
    33r""" 
     4Definition 
     5---------- 
     6 
    47 
    58This model provides the form factor, $P(q)$, for a hollow rectangular 
    69prism with infinitely thin walls. It computes only the 1D scattering, not the 2D. 
    7  
    8  
    9 Definition 
    10 ---------- 
    11  
    1210The 1D scattering intensity for this model is calculated according to the 
    13 equations given by Nayuk and Huber (Nayuk, 2012). 
     11equations given by Nayuk and Huber\ [#Nayuk2012]_. 
    1412 
    1513Assuming a hollow parallelepiped with infinitely thin walls, edge lengths 
     
    5553  I(q) = \text{scale} \times V \times (\rho_\text{p} - \rho_\text{solvent})^2 \times P(q) 
    5654 
    57 where $V$ is the volume of the rectangular prism, $\rho_\text{p}$ 
    58 is the scattering length of the parallelepiped, $\rho_\text{solvent}$ 
    59 is the scattering length of the solvent, and (if the data are in absolute 
    60 units) *scale* represents the volume fraction (which is unitless). 
     55where $V$ is the surface area of the rectangular prism, $\rho_\text{p}$ 
     56is the scattering length density of the parallelepiped, $\rho_\text{solvent}$ 
     57is the scattering length density of the solvent, and (if the data are in 
     58absolute units) *scale* is related to the total surface area. 
    6159 
    6260**The 2D scattering intensity is not computed by this model.** 
     
    6765 
    6866Validation of the code was conducted  by qualitatively comparing the output 
    69 of the 1D model to the curves shown in (Nayuk, 2012). 
     67of the 1D model to the curves shown in (Nayuk, 2012\ [#Nayuk2012]_). 
    7068 
    7169 
     
    7371---------- 
    7472 
    75 R Nayuk and K Huber, *Z. Phys. Chem.*, 226 (2012) 837-854 
     73.. [#Nayuk2012] R Nayuk and K Huber, *Z. Phys. Chem.*, 226 (2012) 837-854 
     74 
     75 
     76Authorship and Verification 
     77---------------------------- 
     78 
     79* **Author:** Miguel Gonzales **Date:** February 26, 2016 
     80* **Last Modified by:** Paul Kienzle **Date:** October 15, 2016 
     81* **Last Reviewed by:** Paul Butler **Date:** September 07, 2018 
    7682""" 
    7783 
  • sasmodels/models/spherical_sld.py

    r2d81cfe r5601947  
    11r""" 
     2Definition 
     3---------- 
     4 
    25Similarly to the onion, this model provides the form factor, $P(q)$, for 
    36a multi-shell sphere, where the interface between the each neighboring 
     
    1619interface. The form factor is normalized by the total volume of the sphere. 
    1720 
    18 Interface shapes are as follows:: 
     21Interface shapes are as follows: 
    1922 
    2023    0: erf($\nu z$) 
     24     
    2125    1: Rpow($z^\nu$) 
     26     
    2227    2: Lpow($z^\nu$) 
     28     
    2329    3: Rexp($-\nu z$) 
     30     
    2431    4: Lexp($-\nu z$) 
    25  
    26 Definition 
    27 ---------- 
    2832 
    2933The form factor $P(q)$ in 1D is calculated by: 
     
    174178    when $P(Q) * S(Q)$ is applied. 
    175179 
     180 
    176181References 
    177182---------- 
    178 L A Feigin and D I Svergun, Structure Analysis by Small-Angle X-Ray 
    179 and Neutron Scattering, Plenum Press, New York, (1987) 
     183 
     184.. [#] L A Feigin and D I Svergun, Structure Analysis by Small-Angle X-Ray 
     185   and Neutron Scattering, Plenum Press, New York, (1987) 
     186 
     187 
     188Authorship and Verification 
     189---------------------------- 
     190 
     191* **Author:** Jae-Hie Cho **Date:** Nov 1, 2010 
     192* **Last Modified by:** Paul Kienzle **Date:** Dec 20, 2016 
     193* **Last Reviewed by:** Paul Butler **Date:** September 8, 2018 
    180194""" 
    181195 
  • sasmodels/models/vesicle.py

    ref07e95 rb477605  
    33---------- 
    44 
    5 The 1D scattering intensity is calculated in the following way (Guinier, 1955) 
     5This model provides the form factor, *P(q)*, for an unilamellar vesicle and is 
     6effectively identical to the hollow sphere reparameterized to be 
     7more intuitive for a vesicle and normalizing the form factor by the volume of 
     8the shell. The 1D scattering intensity is calculated in the following way 
     9(Guinier,1955\ [#Guinier1955]_) 
    610 
    711.. math:: 
     
    5357---------- 
    5458 
    55 A Guinier and G. Fournet, *Small-Angle Scattering of X-Rays*, John Wiley and 
    56 Sons, New York, (1955) 
     59.. [#Guinier1955] A Guinier and G. Fournet, *Small-Angle Scattering of X-Rays*, John Wiley and 
     60   Sons, New York, (1955) 
     61 
     62 
     63Authorship and Verification 
     64---------------------------- 
    5765 
    5866* **Author:** NIST IGOR/DANSE **Date:** pre 2010 
    5967* **Last Modified by:** Paul Butler **Date:** March 20, 2016 
    60 * **Last Reviewed by:** Paul Butler **Date:** March 20, 2016 
     68* **Last Reviewed by:** Paul Butler **Date:** September 7, 2018 
    6169""" 
    6270 
     
    6573 
    6674name = "vesicle" 
    67 title = "This model provides the form factor, *P(q)*, for an unilamellar \ 
    68     vesicle. This is model is effectively identical to the hollow sphere \ 
    69     reparameterized to be more intuitive for a vesicle and normalizing the \ 
    70     form factor by the volume of the shell." 
     75title = "Vesicle model representing a hollow sphere" 
    7176description = """ 
    7277    Model parameters: 
Note: See TracChangeset for help on using the changeset viewer.