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


Ignore:
Location:
sasmodels/models
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/core_shell_cylinder.py

    re31b19a r2d81cfe  
    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. Note that in this model the shell envelops the entire 
    8 core so that besides a "sleeve" around the core, the shell also provides two 
    9 flat end caps of thickness = shell thickness. In other words the length of the 
    10 total cyclinder is the length of the core cylinder plus twice the thickness of 
    11 the 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 
    13 the "thick_face") to zero. 
     7by the particle volume. 
    148 
    159.. math:: 
     
    3933 
    4034and $\alpha$ is the angle between the axis of the cylinder and $\vec q$, 
    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, 
     35$V_s$ is the volume of the outer shell (i.e. the total volume, including 
     36the shell), $V_c$ is the volume of the core, $L$ is the length of the core, 
    4337$R$ is the radius of the core, $T$ is the thickness of the shell, $\rho_c$ 
    4438is the scattering length density of the core, $\rho_s$ is the scattering 
     
    141135    return 0.5 * (ddd) ** (1. / 3.) 
    142136 
     137def 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 
    143145def random(): 
    144146    outer_radius = 10**np.random.uniform(1, 4.7) 
  • sasmodels/models/core_shell_sphere.py

    rda1c8d1 rdc76240  
    8989    return radius + thickness 
    9090 
     91def 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 
    91102def random(): 
    92103    outer_radius = 10**np.random.uniform(1.3, 4.3) 
     
    103114tests = [ 
    104115    [{'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], 
    105119 
    106120    # The SasView test result was 0.00169, with a background of 0.001 
  • sasmodels/models/fractal_core_shell.py

    reb3eb38 ref07e95  
    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", "",           0.05,  [0.0, inf],  "",       "Volume fraction of building block spheres"], 
     90    ["volfraction", "",           1.0,  [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 
     136def 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 
     145 
    136146tests = [[{'radius': 20.0, 'thickness': 10.0}, 'ER', 30.0], 
     147         [{'radius': 20.0, 'thickness': 10.0}, 'VR', 0.703703704]] 
    137148 
    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]]] 
     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]] 
  • sasmodels/models/hollow_cylinder.py

    r455aaa1 r2d81cfe  
    11r""" 
    2 Definition 
    3 ---------- 
    4  
    52This model provides the form factor, $P(q)$, for a monodisperse hollow right 
    6 angle circular cylinder (rigid tube) where the The inside and outside of the 
    7 hollow cylinder are assumed to have the same SLD and the form factor is thus 
    8 normalized by the volume of the tube (i.e. not by the total cylinder volume). 
     3angle circular cylinder (rigid tube) where the form factor is normalized by the 
     4volume of the tube (i.e. not by the external volume). 
    95 
    106.. math:: 
     
    128    P(q) = \text{scale} \left<F^2\right>/V_\text{shell} + \text{background} 
    139 
    14 where the averaging $\left<\ldots\right>$ is applied only for the 1D 
    15 calculation. If Intensity is given on an absolute scale, the scale factor here 
    16 is the volume fraction of the shell.  This differs from 
    17 the :ref:`core-shell-cylinder` in that, in that case, scale is the volume 
    18 fraction of the entire cylinder (core+shell). The application might be for a 
    19 bilayer which wraps into a hollow tube and the volume fraction of material is 
    20 all in the shell, whereas the :ref:`core-shell-cylinder` model might be used for 
    21 a cylindrical micelle where the tails in the core have a different SLD than the 
    22 headgroups (in the shell) and the volume fraction of material comes fromm the 
    23 whole cyclinder.  NOTE: the hollow_cylinder represents a tube whereas the 
    24 core_shell_cylinder includes a shell layer covering the ends (end caps) as well. 
     10where the averaging $\left<\ldots\right>$ is applied only for the 1D calculation. 
    2511 
     12The inside and outside of the hollow cylinder are assumed have the same SLD. 
     13 
     14Definition 
     15---------- 
    2616 
    2717The 1D scattering intensity is calculated in the following way (Guinier, 1955) 
     
    5848---------- 
    5949 
    60 .. [#] L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and 
    61    Neutron Scattering*, Plenum Press, New York, (1987) 
     50L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and 
     51Neutron Scattering*, Plenum Press, New York, (1987) 
    6252 
    6353Authorship and Verification 
     
    6555 
    6656* **Author:** NIST IGOR/DANSE **Date:** pre 2010 
    67 * **Last Modified by:** Paul Butler **Date:** September 06, 2018 
    68    (corrected VR calculation) 
    69 * **Last Reviewed by:** Paul Butler **Date:** September 06, 2018 
     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 
    7060""" 
    7161 
     
    130120    vol_total = pi*router*router*length 
    131121    vol_shell = vol_total - vol_core 
    132     return vol_total, vol_shell 
     122    return vol_shell, vol_total 
    133123 
    134124def random(): 
     
    161151tests = [ 
    162152    [{}, 0.00005, 1764.926], 
    163     [{}, 'VR', 0.55555556], 
     153    [{}, 'VR', 1.8], 
    164154    [{}, 0.001, 1756.76], 
    165155    [{}, (qx, qy), 2.36885476192], 
  • sasmodels/models/hollow_rectangular_prism.py

    r455aaa1 r2d81cfe  
    22# Note: model title and parameter table are inserted automatically 
    33r""" 
     4 
     5This model provides the form factor, $P(q)$, for a hollow rectangular 
     6parallelepiped with a wall of thickness $\Delta$. 
     7 
     8 
    49Definition 
    510---------- 
    611 
    7 This model provides the form factor, $P(q)$, for a hollow rectangular 
    8 parallelepiped with a wall of thickness $\Delta$. The 1D scattering intensity 
    9 for this model is calculated by forming the difference of the amplitudes of two 
    10 massive parallelepipeds differing in their outermost dimensions in each 
    11 direction by the same length increment $2\Delta$ (\ [#Nayuk2012]_ Nayuk, 2012). 
     12The 1D scattering intensity for this model is calculated by forming 
     13the difference of the amplitudes of two massive parallelepipeds 
     14differing in their outermost dimensions in each direction by the 
     15same length increment $2\Delta$ (Nayuk, 2012). 
    1216 
    1317As in the case of the massive parallelepiped model (:ref:`rectangular-prism`), 
     
    5761  \rho_\text{solvent})^2 \times P(q) + \text{background} 
    5862 
    59 where $\rho_\text{p}$ is the scattering length density of the parallelepiped, 
    60 $\rho_\text{solvent}$ is the scattering length density of the solvent, 
     63where $\rho_\text{p}$ is the scattering length of the parallelepiped, 
     64$\rho_\text{solvent}$ is the scattering length of the solvent, 
    6165and (if the data are in absolute units) *scale* represents the volume fraction 
    62 (which is unitless) of the rectangular shell of material (i.e. not including 
    63 the volume of the solvent filled core). 
     66(which is unitless). 
    6467 
    6568For 2d data the orientation of the particle is required, described using 
     
    7073 
    7174For 2d, constraints must be applied during fitting to ensure that the inequality 
    72 $A < B < C$ is not violated, and hence the correct definition of angles is 
    73 preserved. The calculation will not report an error if the inequality is *not* 
    74 preserved, but the results may be not correct. 
     75$A < B < C$ is not violated, and hence the correct definition of angles is preserved. The calculation will not report an error, 
     76but the results may be not correct. 
    7577 
    7678.. figure:: img/parallelepiped_angle_definition.png 
     
    9799---------- 
    98100 
    99 .. [#Nayuk2012] R Nayuk and K Huber, *Z. Phys. Chem.*, 226 (2012) 837-854 
    100  
    101  
    102 Authorship 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 
     101R Nayuk and K Huber, *Z. Phys. Chem.*, 226 (2012) 837-854 
    108102""" 
    109103 
  • sasmodels/models/hollow_rectangular_prism_thin_walls.py

    r6e7d7b6 r2d81cfe  
    22# Note: model title and parameter table are inserted automatically 
    33r""" 
     4 
     5This model provides the form factor, $P(q)$, for a hollow rectangular 
     6prism with infinitely thin walls. It computes only the 1D scattering, not the 2D. 
     7 
     8 
    49Definition 
    510---------- 
    611 
    7  
    8 This model provides the form factor, $P(q)$, for a hollow rectangular 
    9 prism with infinitely thin walls. It computes only the 1D scattering, not the 2D. 
    1012The 1D scattering intensity for this model is calculated according to the 
    11 equations given by Nayuk and Huber\ [#Nayuk2012]_. 
     13equations given by Nayuk and Huber (Nayuk, 2012). 
    1214 
    1315Assuming a hollow parallelepiped with infinitely thin walls, edge lengths 
     
    5355  I(q) = \text{scale} \times V \times (\rho_\text{p} - \rho_\text{solvent})^2 \times P(q) 
    5456 
    55 where $V$ is the surface area of the rectangular prism, $\rho_\text{p}$ 
    56 is the scattering length density of the parallelepiped, $\rho_\text{solvent}$ 
    57 is the scattering length density of the solvent, and (if the data are in 
    58 absolute units) *scale* is related to the total surface area. 
     57where $V$ is the volume of the rectangular prism, $\rho_\text{p}$ 
     58is the scattering length of the parallelepiped, $\rho_\text{solvent}$ 
     59is the scattering length of the solvent, and (if the data are in absolute 
     60units) *scale* represents the volume fraction (which is unitless). 
    5961 
    6062**The 2D scattering intensity is not computed by this model.** 
     
    6567 
    6668Validation of the code was conducted  by qualitatively comparing the output 
    67 of the 1D model to the curves shown in (Nayuk, 2012\ [#Nayuk2012]_). 
     69of the 1D model to the curves shown in (Nayuk, 2012). 
    6870 
    6971 
     
    7173---------- 
    7274 
    73 .. [#Nayuk2012] R Nayuk and K Huber, *Z. Phys. Chem.*, 226 (2012) 837-854 
    74  
    75  
    76 Authorship 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 
     75R Nayuk and K Huber, *Z. Phys. Chem.*, 226 (2012) 837-854 
    8276""" 
    8377 
  • sasmodels/models/spherical_sld.py

    r5601947 r2d81cfe  
    11r""" 
    2 Definition 
    3 ---------- 
    4  
    52Similarly to the onion, this model provides the form factor, $P(q)$, for 
    63a multi-shell sphere, where the interface between the each neighboring 
     
    1916interface. The form factor is normalized by the total volume of the sphere. 
    2017 
    21 Interface shapes are as follows: 
     18Interface shapes are as follows:: 
    2219 
    2320    0: erf($\nu z$) 
    24      
    2521    1: Rpow($z^\nu$) 
    26      
    2722    2: Lpow($z^\nu$) 
    28      
    2923    3: Rexp($-\nu z$) 
    30      
    3124    4: Lexp($-\nu z$) 
     25 
     26Definition 
     27---------- 
    3228 
    3329The form factor $P(q)$ in 1D is calculated by: 
     
    178174    when $P(Q) * S(Q)$ is applied. 
    179175 
    180  
    181176References 
    182177---------- 
    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  
    188 Authorship 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 
     178L A Feigin and D I Svergun, Structure Analysis by Small-Angle X-Ray 
     179and Neutron Scattering, Plenum Press, New York, (1987) 
    194180""" 
    195181 
  • sasmodels/models/vesicle.py

    rb477605 ref07e95  
    33---------- 
    44 
    5 This model provides the form factor, *P(q)*, for an unilamellar vesicle and is 
    6 effectively identical to the hollow sphere reparameterized to be 
    7 more intuitive for a vesicle and normalizing the form factor by the volume of 
    8 the shell. The 1D scattering intensity is calculated in the following way 
    9 (Guinier,1955\ [#Guinier1955]_) 
     5The 1D scattering intensity is calculated in the following way (Guinier, 1955) 
    106 
    117.. math:: 
     
    5753---------- 
    5854 
    59 .. [#Guinier1955] A Guinier and G. Fournet, *Small-Angle Scattering of X-Rays*, John Wiley and 
    60    Sons, New York, (1955) 
    61  
    62  
    63 Authorship and Verification 
    64 ---------------------------- 
     55A Guinier and G. Fournet, *Small-Angle Scattering of X-Rays*, John Wiley and 
     56Sons, New York, (1955) 
    6557 
    6658* **Author:** NIST IGOR/DANSE **Date:** pre 2010 
    6759* **Last Modified by:** Paul Butler **Date:** March 20, 2016 
    68 * **Last Reviewed by:** Paul Butler **Date:** September 7, 2018 
     60* **Last Reviewed by:** Paul Butler **Date:** March 20, 2016 
    6961""" 
    7062 
     
    7365 
    7466name = "vesicle" 
    75 title = "Vesicle model representing a hollow sphere" 
     67title = "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." 
    7671description = """ 
    7772    Model parameters: 
Note: See TracChangeset for help on using the changeset viewer.