Changeset 9eb5eca in sasmodels


Ignore:
Timestamp:
Dec 5, 2016 7:55:55 AM (7 years ago)
Author:
krzywon
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
4b4eee1
Parents:
e1ea6b5 (diff), ccd5f01 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge remote-tracking branch 'origin/ticket-816' into ticket-795

Location:
sasmodels
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/compare.py

    r8c65a33 rfe25eda  
    10631063    # Evaluate preset parameter expressions 
    10641064    context = MATH.copy() 
     1065    context['np'] = np 
    10651066    context.update(pars) 
    10661067    context.update((k,v) for k,v in presets.items() if isinstance(v, float)) 
  • sasmodels/details.py

    r6dc78e4 rccd5f01  
    230230    npars = kernel.info.parameters.npars 
    231231    nvalues = kernel.info.parameters.nvalues 
    232     scalars = [v[0][0] for v in pairs] 
     232    scalars = [(v[0] if len(v) else np.NaN) for v, w in pairs] 
    233233    values, weights = zip(*pairs[2:npars+2]) if npars else ((),()) 
    234234    length = np.array([len(w) for w in weights]) 
  • sasmodels/models/be_polyelectrolyte.py

    r5df888c rbf9de53  
    6767* **Author:** NIST IGOR/DANSE **Date:** pre 2010 
    6868* **Last Modified by:** Paul Kienzle **Date:** July 24, 2016 
    69 * **Last Reviewed by:** Piotr rozyczko **Date:** January 27, 2016 
     69* **Last Reviewed by:** Paul Butler and Richard Heenan **Date:**  
     70  October 07, 2016 
    7071""" 
    7172 
  • sasmodels/models/core_multi_shell.py

    rb0c4271 r2d73a53  
    1313 
    1414The 2D scattering intensity is the same as $P(q)$ above, regardless of the 
    15 orientation of the $q$ vector which is defined as 
     15orientation of the $\vec q$ vector which is defined as 
    1616 
    1717.. math:: 
     
    2929 
    3030Our model uses the form factor calculations implemented in a c-library provided 
    31 by the NIST Center for Neutron Research (Kline, 2006). 
     31by the NIST Center for Neutron Research (Kline, 2006) [#kline]_. 
    3232 
    3333References 
     
    3535 
    3636.. [#] See the :ref:`core-shell-sphere` model documentation. 
    37 .. [#] L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and Neutron Scattering*, 
    38    Plenum Press, New York, 1987. 
     37.. [#kline] S R Kline, *J Appl. Cryst.*, 39 (2006) 895 
     38.. [#] L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and 
     39   Neutron Scattering*, Plenum Press, New York, 1987. 
    3940 
    4041Authorship and Verification 
     
    4344* **Author:** NIST IGOR/DANSE **Date:** pre 2010 
    4445* **Last Modified by:** Paul Kienzle **Date:** September 12, 2016 
    45 * **Last Reviewed by:** Under Review **Date:** as of October 5, 2016 
     46* **Last Reviewed by:** Paul Kienzle **Date:** September 12, 2016 
    4647""" 
    4748 
  • sasmodels/models/core_shell_cylinder.py

    r40a87fa r755ecc2  
    1 # core shell cylinder model 
    2 # Note: model title and parameter table are inserted automatically 
    31r""" 
    4 The form factor is normalized by the particle volume. 
    5  
    62Definition 
    73---------- 
    84 
    95The output of the 2D scattering intensity function for oriented core-shell 
    10 cylinders is given by (Kline, 2006) 
     6cylinders is given by (Kline, 2006 [#kline]_). The form factor is normalized 
     7by the particle volume. 
    118 
    129.. math:: 
     
    6158The $\theta$ and $\phi$ parameters are not used for the 1D output. 
    6259 
    63 Validation 
    64 ---------- 
    65  
    66 Validation of our code was done by comparing the output of the 1D model to 
    67 the output of the software provided by the NIST (Kline, 2006). 
    68  
    69 Averaging over a distribution of orientation is done by evaluating the 
    70 equation above. Since we have no other software to compare the 
    71 implementation of the intensity for fully oriented cylinders, we 
    72 compared the result of averaging our 2D output using a uniform 
    73 distribution $p(\theta,\phi) = 1.0$. 
    74  
    7560Reference 
    7661--------- 
    77 see, for example, Ian Livsey  J. Chem. Soc., Faraday Trans. 2, 1987,83, 1445-1452 
    7862 
    79 2016/03/18 - Description reviewed by RKH 
     63.. [#] see, for example, Ian Livsey  J. Chem. Soc., Faraday Trans. 2, 1987,83, 
     64   1445-1452 
     65.. [#kline] S R Kline, *J Appl. Cryst.*, 39 (2006) 895 
     66 
     67Authorship and Verification 
     68---------------------------- 
     69 
     70* **Author:** NIST IGOR/DANSE **Date:** pre 2010 
     71* **Last Modified by:** Paul Kienzle **Date:** Aug 8, 2016 
     72* **Last Reviewed by:** Richard Heenan **Date:** March 18, 2016 
    8073""" 
    8174 
     
    158151            theta_pd=15, theta_pd_n=45, 
    159152            phi_pd=15, phi_pd_n=1) 
    160 # ADDED by:  RKH  ON: 18Mar2016 renamed sld's etc 
     153 
  • sasmodels/models/core_shell_parallelepiped.py

    r14838a3 r797a8e3  
    1 # core_shell_parallelepiped model 
    2 # Note: model title and parameter table are inserted automatically 
    31r""" 
     2Definition 
     3---------- 
     4 
    45Calculates the form factor for a rectangular solid with a core-shell structure. 
    56**The thickness and the scattering length density of the shell or "rim" 
     
    1516of the rectangular solid. 
    1617 
    17 An instrument resolution smeared version of the model is also provided. 
    18  
    19  
    20 Definition 
    21 ---------- 
    2218 
    2319The function calculated is the form factor of the rectangular solid below. 
     
    4137**meaning that there are "gaps" at the corners of the solid.** 
    4238 
    43 The intensity calculated follows the :ref:`parallelepiped` model, with the core-shell 
    44 intensity being calculated as the square of the sum of the amplitudes of the 
    45 core and shell, in the same manner as a core-shell model. 
    46  
    47 **For the calculation of the form factor to be valid, the sides of the solid 
    48 MUST be chosen such that** $A < B < C$. 
    49 **If this inequality is not satisfied, the model will not report an error, 
    50 and the calculation will not be correct.** 
     39The intensity calculated follows the :ref:`parallelepiped` model, with the 
     40core-shell intensity being calculated as the square of the sum of the 
     41amplitudes of the core and shell, in the same manner as a core-shell model. 
     42 
     43.. math:: 
     44 
     45    F_{a}(Q,\alpha,\beta)= 
     46    \Bigg(\frac{sin(Q(L_A+2t_A)/2sin\alpha sin\beta)}{Q(L_A+2t_A)/2sin\alpha 
     47    sin\beta)} 
     48    - \frac{sin(QL_A/2sin\alpha sin\beta)}{QL_A/2sin\alpha sin\beta)} \Bigg) 
     49    + \frac{sin(QL_B/2sin\alpha sin\beta)}{QL_B/2sin\alpha sin\beta)} 
     50    + \frac{sin(QL_C/2sin\alpha sin\beta)}{QL_C/2sin\alpha sin\beta)} 
     51 
     52.. note:: 
     53 
     54    For the calculation of the form factor to be valid, the sides of the solid 
     55    MUST be chosen such that** $A < B < C$. 
     56    If this inequality is not satisfied, the model will not report an error, 
     57    but the calculation will not be correct and thus the result wrong. 
    5158 
    5259FITTING NOTES 
    5360If the scale is set equal to the particle volume fraction, |phi|, the returned 
    5461value is the scattered intensity per unit volume, $I(q) = \phi P(q)$. 
    55 However, **no interparticle interference effects are included in this calculation.** 
     62However, **no interparticle interference effects are included in this 
     63calculation.** 
    5664 
    5765There are many parameters in this model. Hold as many fixed as possible with 
     
    6876and length $(C+2t_C)$ values, and used as the effective radius 
    6977for $S(Q)$ when $P(Q) * S(Q)$ is applied. 
    70  
    71 .. Comment by Miguel Gonzalez: 
    72    The later seems to contradict the previous statement that interparticle interference 
    73    effects are not included. 
    7478 
    7579To provide easy access to the orientation of the parallelepiped, we define the 
     
    98102---------- 
    99103 
    100 P Mittelbach and G Porod, *Acta Physica Austriaca*, 14 (1961) 185-211 
    101 Equations (1), (13-14). (in German) 
    102  
     104.. [#] P Mittelbach and G Porod, *Acta Physica Austriaca*, 14 (1961) 185-211 
     105    Equations (1), (13-14). (in German) 
     106.. [#] D Singh (2009). *Small angle scattering studies of self assembly in 
     107   lipid mixtures*, John's Hopkins University Thesis (2009) 223-225. `Available 
     108   from Proquest <http://search.proquest.com/docview/304915826?accountid 
     109   =26379>`_ 
     110 
     111Authorship and Verification 
     112---------------------------- 
     113 
     114* **Author:** NIST IGOR/DANSE **Date:** pre 2010 
     115* **Last Modified by:** Paul Butler **Date:** September 30, 2016 
     116* **Last Reviewed by:** Miguel Gonzales **Date:** March 21, 2016 
    103117""" 
    104118 
  • sasmodels/models/fractal_core_shell.c

    r217590b rbdd08df  
    1616   double cor_length) 
    1717{ 
    18     const double sq = fractal_sq(q, radius, fractal_dim, cor_length); 
     18    //The radius for the building block of the core shell particle that is  
     19    //needed by the Teixeira fractal S(q) is the radius of the whole particle. 
     20    const double cs_radius = radius + thickness; 
     21    const double sq = fractal_sq(q, cs_radius, fractal_dim, cor_length); 
    1922    const double pq = core_shell_kernel(q, radius, thickness, 
    2023                                        core_sld, shell_sld, solvent_sld); 
  • sasmodels/models/fractal_core_shell.py

    r217590b rd6f60c3  
    11r""" 
     2Definition 
     3---------- 
    24Calculates the scattering from a fractal structure with a primary building 
    35block of core-shell spheres, as opposed to just homogeneous spheres in 
    4 the fractal model. 
    5 This model could find use for aggregates of coated particles, or aggregates 
    6 of vesicles. 
    7  
    8 Definition 
    9 ---------- 
     6the fractal model. It is an extension of the well known Teixeira\ [#teixeira]_ 
     7fractal model replacing the $P(q)$ of a solid sphere with that of a core-shell 
     8sphere. This model could find use for aggregates of coated particles, or 
     9aggregates of vesicles for example. 
    1010 
    1111.. math:: 
    1212 
    13     I(q) = \text{background} + P(q)S(q) 
     13    I(q) = P(q)S(q) + \text{background} 
    1414 
    15 The form factor $P(q)$ is that from core_shell model with $bkg$ = 0 
    16  
     15Where $P(q)$ is the core-shell form factor and $S(q)$ is the 
     16Teixeira\ [#teixeira]_ fractal structure factor both of which are given again 
     17below: 
    1718 
    1819.. math:: 
    1920 
    20     P(q)=\frac{scale}{V_s}\left[3V_c(\rho_c-\rho_s) 
     21    P(q) &= \frac{\phi}{V_s}\left[3V_c(\rho_c-\rho_s) 
    2122    \frac{\sin(qr_c)-qr_c\cos(qr_c)}{(qr_c)^3}+ 
    2223    3V_s(\rho_s-\rho_{solv}) 
    2324    \frac{\sin(qr_s)-qr_s\cos(qr_s)}{(qr_s)^3}\right]^2 
    2425 
     26    S(q) &= 1 + \frac{D_f\ \Gamma\!(D_f-1)}{[1+1/(q\xi)^2]^{(D_f-1)/2}}  
     27    \frac{\sin[(D_f-1)\tan^{-1}(q\xi)]}{(qr_s)^{D_f}} 
    2528 
    26 while the fractal structure factor $S(q)$ is 
     29where $\phi$ is the volume fraction of particles, $V_s$ is the volume of the 
     30whole particle, $V_c$ is the volume of the core, $\rho_c$, $\rho_s$, and 
     31$\rho_{solv}$ are the scattering length densities of the core, shell, and 
     32solvent respectively, $r_c$ and $r_s$ are the radius of the core and the radius 
     33of the whole particle respectively, $D_f$ is the fractal dimension, and |xi| the 
     34correlation length. 
     35  
     36Polydispersity of radius and thickness are also provided for. 
    2737 
    28 .. math:: 
    29  
    30     S(q) = \frac{D_f\Gamma(D_f-1)\sin((D_f-1)\tan^{-1}(q\xi))} 
    31     {(qr_c)^{D_f}\left(1+\frac{1}{q^2\xi ^2} \right)^{\frac{D_f-1}{2}}} 
    32  
    33 where $D_f$ = fractal_dim, |xi| = cor_length, $r_c$ = (core) radius, and 
    34 $scale$ = volume fraction. 
    35  
    36 The fractal structure is as documented in the fractal model. 
    37 Polydispersity of radius and thickness is provided for. 
    38  
    39 For 2D data: The 2D scattering intensity is calculated in the same way as 1D, 
    40 where the $q$ vector is defined as 
     38This model does not allow for anisotropy and thus the 2D scattering intensity 
     39is calculated in the same way as 1D, where the $q$ vector is defined as 
    4140 
    4241.. math:: 
     
    4443    q = \sqrt{q_x^2 + q_y^2} 
    4544 
     45Our model is derived from the form factor calculations implemented in IGOR 
     46macros by the NIST Center for Neutron Research\ [#Kline]_ 
     47 
    4648References 
    4749---------- 
    4850 
    49 See the core_shell and fractal model descriptions 
     51.. [#teixeira] J Teixeira, *J. Appl. Cryst.*, 21 (1988) 781-785 
     52.. [#Kline]  S R Kline, *J Appl. Cryst.*, 39 (2006) 895 
     53 
     54Authorship and Verification 
     55---------------------------- 
     56 
     57* **Author:** NIST IGOR/DANSE **Date:** pre 2010 
     58* **Last Modified by:** Paul Butler and Paul Kienzle **on:** November 27, 2016 
     59* **Last Reviewed by:** Paul Butler and Paul Kienzle **on:** November 27, 2016 
    5060 
    5161""" 
     
    5464 
    5565name = "fractal_core_shell" 
    56 title = "" 
    57 description = """ 
     66title = "Scattering from a fractal structure formed from core shell spheres" 
     67description = """\ 
     68    Model for fractal aggregates of core-shell primary particles. It is based on 
     69    the Teixeira model for the S(q) of a fractal * P(q) for a core-shell sphere 
    5870 
    59 """ 
     71    radius =  the radius of the core 
     72    thickness = thickness of the shell 
     73    thick_layer = thickness of a layer 
     74    sld_core = the SLD of the core 
     75    sld_shell = the SLD of the shell 
     76    sld_solvent = the SLD of the solvent 
     77    volfraction = volume fraction of core-shell particles 
     78    fractal_dim = fractal dimension 
     79    cor_length = correlation length of the fractal like aggretates 
     80    """ 
    6081category = "shape-independent" 
    6182 
     
    107128 
    108129tests = [[{'radius': 20.0, 'thickness': 10.0}, 'ER', 30.0], 
    109          [{'radius': 20.0, 'thickness': 10.0}, 'VR', 0.703703704], 
     130         [{'radius': 20.0, 'thickness': 10.0}, 'VR', 0.703703704]] 
    110131 
    111          # The SasView test result was 0.00169, with a background of 0.001 
    112          [{'radius': 60.0, 
    113            'thickness': 10.0, 
    114            'sld_core': 1.0, 
    115            'sld_shell': 2.0, 
    116            'sld_solvent': 3.0, 
    117            'background': 0.0 
    118           }, 0.4, 0.00070126]] 
     132#         # The SasView test result was 0.00169, with a background of 0.001 
     133#         # They are however wrong as we now know.  IGOR might be a more 
     134#         # appropriate source. Otherwise will just have to assume this is now 
     135#         # correct and self generate a correct answer for the future. Until we 
     136#         # figure it out leave the tests commented out 
     137#         [{'radius': 60.0, 
     138#           'thickness': 10.0, 
     139#           'sld_core': 1.0, 
     140#           'sld_shell': 2.0, 
     141#           'sld_solvent': 3.0, 
     142#           'background': 0.0 
     143#          }, 0.015211, 692.84]] 
  • sasmodels/models/stacked_disks.c

    r3ac4e1b r98ce141  
    7171    // loop for the structure factor S(q) 
    7272    double qd_cos_alpha = q*d*cos_alpha; 
     73    //d*cos_alpha is the projection of d onto q (in other words the component 
     74    //of d that is parallel to q. 
    7375    double debye_arg = -0.5*square(qd_cos_alpha*sigma_dnn); 
    7476    double sq=0.0; 
     
    7981    sq = 1.0 + 2.0*sq/n_stacking; 
    8082 
    81     return pq * sq; 
     83    return pq * sq * n_stacking; 
     84    // volume normalization should be per disk not per stack but form_volume 
     85    // is per stack so correct here for now.  Could change form_volume but 
     86    // if one ever wants to use P*S we need the ER based on the total volume 
    8287} 
    8388 
  • sasmodels/models/stacked_disks.py

    ref5a314 r07300ea  
    11r""" 
    2 This model provides the form factor, $P(q)$, for stacked discs (tactoids) 
    3 with a core/layer structure where the form factor is normalized by the volume 
    4 of the cylinder. Assuming the next neighbor distance (d-spacing) in a stack 
    5 of parallel discs obeys a Gaussian distribution, a structure factor $S(q)$ 
    6 proposed by Kratky and Porod in 1949 is used in this function. 
    7  
    8 Note that the resolution smearing calculation uses 76 Gauss quadrature points 
    9 to properly smear the model since the function is HIGHLY oscillatory, 
    10 especially around the q-values that correspond to the repeat distance of 
    11 the layers. 
    12  
    13 The 2D scattering intensity is the same as 1D, regardless of the orientation 
    14 of the q vector which is defined as 
    15  
    16 .. math:: q = \sqrt{q_x^2 + q_y^2} 
    17  
    182Definition 
    193---------- 
    204 
     5This model provides the form factor, $P(q)$, for stacked discs (tactoids) 
     6with a core/layer structure which is constructed itself as $P(q) S(Q)$ 
     7multiplying a $P(q)$ for individual core/layer disks by a structure factor 
     8$S(q)$ proposed by Kratky and Porod in 1949\ [#CIT1949]_ assuming the next 
     9neighbor distance (d-spacing) in the stack of parallel discs obeys a Gaussian 
     10distribution. As such the normalization of this "composite" form factor is 
     11relative to the individual disk volume, not the volume of the stack of disks. 
     12This model is appropriate for example for non non exfoliated clay particles such 
     13as Laponite. 
     14 
    2115.. figure:: img/stacked_disks_geometry.png 
    2216 
     17   Geometry of a single core/layer disk 
     18 
    2319The scattered intensity $I(q)$ is calculated as 
    2420 
     
    2622 
    2723    I(q) = N\int_{0}^{\pi /2}\left[ \Delta \rho_t 
    28     \left( V_t f_t(q) - V_c f_c(q)\right) + \Delta \rho_c V_c f_c(q) 
    29     \right]^2 S(q)\sin{\alpha}\ d\alpha + \text{background} 
     24    \left( V_t f_t(q,\alpha) - V_c f_c(q,\alpha)\right) + \Delta 
     25    \rho_c V_c f_c(q,\alpha)\right]^2 S(q,\alpha)\sin{\alpha}\ d\alpha 
     26    + \text{background} 
    3027 
    3128where the contrast 
     
    3532    \Delta \rho_i = \rho_i - \rho_\text{solvent} 
    3633 
    37 and $N$ is the number of discs per unit volume, 
    38 $\alpha$ is the angle between the axis of the disc and $q$, 
    39 and $V_t$ and $V_c$ are the total volume and the core volume of 
    40 a single disc, respectively. 
    41  
    42 .. math:: 
    43  
    44     \left\langle f_{t}^2(q)\right\rangle_{\alpha} = 
    45     \int_{0}^{\pi/2}\left[ 
     34and $N$ is the number of individual (single) discs per unit volume, $\alpha$ is 
     35the angle between the axis of the disc and $q$, and $V_t$ and $V_c$ are the 
     36total volume and the core volume of a single disc, respectively, and 
     37 
     38.. math:: 
     39 
     40    f_t(q,\alpha) = 
    4641    \left(\frac{\sin(q(d+h)\cos{\alpha})}{q(d+h)\cos{\alpha}}\right) 
    4742    \left(\frac{2J_1(qR\sin{\alpha})}{qR\sin{\alpha}} \right) 
    48     \right]^2 \sin{\alpha}\ d\alpha 
    49  
    50     \left\langle f_{c}^2(q)\right\rangle_{\alpha} = 
    51     \int_{0}^{\pi/2}\left[ 
     43 
     44    f_c(q,\alpha) = 
    5245    \left(\frac{\sin(qh)\cos{\alpha})}{qh\cos{\alpha}}\right) 
    5346    \left(\frac{2J_1(qR\sin{\alpha})}{qR\sin{\alpha}}\right) 
    54     \right]^2 \sin{\alpha}\ d\alpha 
    5547 
    5648where $d$ = thickness of the layer (*thick_layer*), 
     
    5951.. math:: 
    6052 
    61     S(q) = 1 + \frac{1}{2}\sum_{k=1}^n(n-k)\cos{(kDq\cos{\alpha})} 
    62     \exp\left[ -k(q\cos{\alpha})^2\sigma_d/2\right] 
     53    S(q,\alpha) = 1 + \frac{1}{2}\sum_{k=1}^n(n-k)\cos{(kDq\cos{\alpha})} 
     54    \exp\left[ -k(q)^2(D\cos{\alpha}~\sigma_d)^2/2\right] 
    6355 
    6456where $n$ is the total number of the disc stacked (*n_stacking*), 
    6557$D = 2(d+h)$ is the next neighbor center-to-center distance (d-spacing), 
    6658and $\sigma_d$ = the Gaussian standard deviation of the d-spacing (*sigma_d*). 
     59Note that $D\cos(\alpha)$ is the component of $D$ parallel to $q$ and the last 
     60term in the equation above is effectively a Debye-Waller factor term.  
    6761 
    6862.. note:: 
    69     Each assembly in the stack is layer/core/layer, so the spacing of the 
     63 
     64    1. Each assembly in the stack is layer/core/layer, so the spacing of the 
    7065    cores is core plus two layers. The 2nd virial coefficient of the cylinder 
    7166    is calculated based on the *radius* and *length* 
     
    7469    is applied. 
    7570 
     71    2. the resolution smearing calculation uses 76 Gaussian quadrature points 
     72    to properly smear the model since the function is HIGHLY oscillatory, 
     73    especially around the q-values that correspond to the repeat distance of 
     74    the layers. 
     75 
    7676To provide easy access to the orientation of the stacked disks, we define 
    7777the axis of the cylinder using two angles $\theta$ and $\varphi$. 
     
    7979.. figure:: img/cylinder_angle_definition.jpg 
    8080 
    81     Examples of the angles against 
    82     the detector plane. 
    83  
    84  
    85 Our model uses the form factor calculations implemented in a c-library provided 
    86 by the NIST Center for Neutron Research (Kline, 2006) 
     81    Examples of the angles against the detector plane. 
     82 
     83 
     84Our model is derived from the form factor calculations implemented in a 
     85c-library provided by the NIST Center for Neutron Research\ [#CIT_Kline]_ 
    8786 
    8887References 
    8988---------- 
    9089 
    91 A Guinier and G Fournet, *Small-Angle Scattering of X-Rays*, 
    92 John Wiley and Sons, New York, 1955 
    93  
    94 O Kratky and G Porod, *J. Colloid Science*, 4, (1949) 35 
    95  
    96 J S Higgins and H C Benoit, *Polymers and Neutron Scattering*, 
    97 Clarendon, Oxford, 1994 
    98  
    99 **Author:** NIST IGOR/DANSE **on:** pre 2010 
    100  
    101 **Last Modified by:** Piotr Rozyczko **on:** February 18, 2016 
    102  
    103 **Last Reviewed by:** Richard Heenan **on:** March 22, 2016 
     90.. [#CIT1949] O Kratky and G Porod, *J. Colloid Science*, 4, (1949) 35 
     91.. [#CIT_Kline] S R Kline, *J Appl. Cryst.*, 39 (2006) 895 
     92.. [#] J S Higgins and H C Benoit, *Polymers and Neutron Scattering*, 
     93   Clarendon, Oxford, 1994 
     94.. [#] A Guinier and G Fournet, *Small-Angle Scattering of X-Rays*, 
     95   John Wiley and Sons, New York, 1955 
     96 
     97Authorship and Verification 
     98---------------------------- 
     99 
     100* **Author:** NIST IGOR/DANSE **Date:** pre 2010 
     101* **Last Modified by:** Paul Butler and Paul Kienzle **on:** November 26, 2016 
     102* **Last Reviewed by:** Paul Butler and Paul Kienzle **on:** November 26, 2016 
    104103""" 
    105104 
     
    107106 
    108107name = "stacked_disks" 
    109 title = "" 
     108title = "Form factor for a stacked set of non exfoliated core/shell disks" 
    110109description = """\ 
    111110    One layer of disk consists of a core, a top layer, and a bottom layer. 
  • sasmodels/conversion_table.py

    rfa6d6fc re1ea6b5  
    88""" 
    99 
     10# TODO: May need to version this for future versions of sasview when 
     11# TODO: models are reparameterized 
    1012 
    1113CONVERSION_TABLE = { 
     
    211213    ], 
    212214    "correlation_length": [ 
    213         "CorrLengthModel", 
     215        "CorrLength", 
    214216        { 
    215217            "porod_scale": "scale_p", 
     
    299301    ], 
    300302    "fractal_core_shell": [ 
    301         "FractalCoreShellModel", 
     303        "FractalCoreShell", 
    302304        { 
    303305            "sld_core": "core_sld", 
     
    321323    ], 
    322324    "gauss_lorentz_gel": [ 
    323         "GaussLorentzGelModel", 
     325        "GaussLorentzGel", 
    324326        { 
    325327            "gauss_scale": "scale_g", 
     
    331333    ], 
    332334    "gaussian_peak": [ 
    333         "PeakGaussModel", 
     335        "Peak Gauss Model", 
    334336        { 
    335337            "peak_pos": "q0", 
     
    343345            "lorentz_scale": "lScale", 
    344346            "guinier_scale": "gScale", 
    345             "fractal_dim": "scale", 
     347            "fractal_dim": "FractalExp", 
    346348            "cor_length": "zeta", 
    347349        } 
    348350    ], 
    349351    "guinier": [ 
    350         "GuinierModel", 
     352        "Guinier", 
    351353        { 
    352354            "rg": "rg" 
     
    354356    ], 
    355357    "guinier_porod": [ 
    356         "GuinierPorodModel", 
     358        "GuinierPorod", 
    357359        { 
    358360            "s": "dim", 
     
    454456            "d_spacing": "spacing", 
    455457            "Caille_parameter": "caille", 
    456             "Nlayers": "N_plates", 
     458            "Nlayers": "n_plates", 
    457459        } 
    458460    ], 
     
    486488    ], 
    487489    "lorentz": [ 
    488         "LorentzModel", 
     490        "Lorentz", 
    489491        { 
    490492            "cor_length": "length" 
     
    510512    ], 
    511513    "mono_gauss_coil": [ 
    512         "DebyeModel", 
     514        "Debye", 
    513515        { 
    514516            "rg": "rg", 
     
    564566    ], 
    565567    "peak_lorentz": [ 
    566         "PeakLorentzModel", 
     568        "Peak Lorentz Model", 
    567569        { 
    568570            "peak_pos": "q0", 
     
    802804    ], 
    803805    "two_lorentzian": [ 
    804         "TwoLorentzianModel", 
     806        "TwoLorentzian", 
    805807        { 
    806808            "lorentz_scale_1": "scale_1", 
     
    814816    ], 
    815817    "two_power_law": [ 
    816         "TwoPowerLawModel", 
     818        "TwoPowerLaw", 
    817819        { 
    818820            "coefficent_1": "coef_A", 
     
    824826    ], 
    825827    "unified_power_Rg": [ 
    826         "UnifiedPowerRgModel", 
    827         { 
    828         } 
     828        "UnifiedPowerRg", 
     829        dict(((field_new+str(index), field_old+str(index)) 
     830              for field_new, field_old in [("rg", "Rg"), 
     831                                           ("power", "power"), 
     832                                           ("G", "G"), 
     833                                           ("B", "B"),] 
     834              for index in range(11)), 
     835             **{ 
     836                   "background": "background", 
     837                   "scale": "scale", 
     838               }) 
    829839    ], 
    830840    "vesicle": [ 
  • sasmodels/convert.py

    rf80f334 re1ea6b5  
    5353    ("_pd_nsigma", ".nsigmas"), 
    5454    ("_pd_type", ".type"), 
     55    (".lower", ".lower"), 
     56    (".upper", ".upper"), 
     57    (".fittable", ".fittable"), 
     58    (".std", ".std"), 
     59    (".units", ".units"), 
     60    ("", "") 
    5561    ] 
    5662 
     
    6470    if id.startswith('M0:'): 
    6571        return True 
    66     if id.startswith('volfraction') or id.startswith('radius_effective'): 
    67         return False 
    6872    if '_pd' in id or '.' in id: 
    6973        return False 
     
    7579        if p.id == id: 
    7680            return p.type == 'sld' 
    77     raise ValueError("unknown parameter %r in conversion"%id) 
     81    return False 
    7882 
    7983def _rescale_sld(model_info, pars, scale): 
     
    119123def _pd_to_underscores(pars): 
    120124    return dict((_dot_pd_to_underscore_pd(k), v) for k, v in pars.items()) 
    121  
    122 def _convert_name(conv_dict, pars): 
    123     """ 
    124     Renames parameter values (upper, lower, etc) to v4.0 names 
    125     :param conv_dict: conversion dictionary mapping new name : old name 
    126     :param pars: parameters to convert 
    127     :return: 
    128     """ 
    129     new_pars = {} 
    130     i = 0 
    131     j = 0 
    132     for key_par, value_par in pars.iteritems(): 
    133         j += 1 
    134         for key_conv, value_conv in conv_dict.iteritems(): 
    135             if re.search(value_conv, key_par): 
    136                 new_pars[key_par.replace(value_conv, key_conv)] = value_par 
    137                 i += 1 
    138                 break 
    139             elif re.search("background", key_par) or re.search("scale", key_par): 
    140                 new_pars[key_par] = value_par 
    141                 i += 1 
    142                 break 
    143         if i != j: 
    144             new_pars[key_par] = value_par 
    145             i += 1 
    146     return new_pars 
    147125 
    148126def _convert_pars(pars, mapping): 
     
    166144                    del newpars[source] 
    167145    return newpars 
    168  
    169146 
    170147def _conversion_target(model_name): 
     
    215192            pd = oldpars['radius.width']*oldpars['radius']/thickness 
    216193            oldpars['radius.width'] = pd 
     194    elif name == 'multilayer_vesicle': 
     195        if 'scale' in oldpars: 
     196            oldpars['volfraction'] = oldpars['scale'] 
     197            oldpars['scale'] = 1.0 
     198        if 'scale.lower' in oldpars: 
     199            oldpars['volfraction.lower'] = oldpars['scale.lower'] 
     200        if 'scale.upper' in oldpars: 
     201            oldpars['volfraction.upper'] = oldpars['scale.upper'] 
     202        if 'scale.fittable' in oldpars: 
     203            oldpars['volfraction.fittable'] = oldpars['scale.fittable'] 
     204        if 'scale.std' in oldpars: 
     205            oldpars['volfraction.std'] = oldpars['scale.std'] 
     206        if 'scale.units' in oldpars: 
     207            oldpars['volfraction.units'] = oldpars['scale.units'] 
    217208    elif name == 'pearl_necklace': 
    218209        pass 
     
    236227                oldpars[p + ".upper"] /= 1e-13 
    237228    elif name == 'spherical_sld': 
    238         oldpars["CONTROL"] += 1 
     229        oldpars["CONTROL"] = 0 
     230        i = 0 
     231        while "nu_inter" + str(i) in oldpars: 
     232            oldpars["CONTROL"] += 1 
     233            i += 1 
    239234    elif name == 'teubner_strey': 
    240235        # basically undoing the entire Teubner-Strey calculations here. 
     
    298293        translation = _get_translation_table(model_info) 
    299294    newpars = _hand_convert(newname, pars.copy()) 
    300     newpars = _convert_name(translation, newpars) 
    301295    newpars = _convert_pars(newpars, translation) 
    302296    if not model_info.structure_factor: 
Note: See TracChangeset for help on using the changeset viewer.