Changeset 64eecf7 in sasmodels for sasmodels/models/core_shell_bicelle.py


Ignore:
Timestamp:
Sep 5, 2017 11:40:09 AM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
30b60d2
Parents:
a53bf6b (diff), 142a8e2 (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 branch 'master' into ticket-510

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/core_shell_bicelle.py

    rf52d400 r64eecf7  
    1717.. figure:: img/core_shell_bicelle_parameters.png 
    1818 
    19    Cross section of cylindrical symmetry model used here. Users will have  
    20    to decide how to distribute "heads" and "tails" between the rim, face  
     19   Cross section of cylindrical symmetry model used here. Users will have 
     20   to decide how to distribute "heads" and "tails" between the rim, face 
    2121   and core regions in order to estimate appropriate starting parameters. 
    2222 
     
    2929  .. math:: 
    3030 
    31     \rho(r) =  
    32       \begin{cases}  
     31    \rho(r) = 
     32      \begin{cases} 
    3333      &\rho_c \text{ for } 0 \lt r \lt R; -L \lt z\lt L \\[1.5ex] 
    3434      &\rho_f \text{ for } 0 \lt r \lt R; -(L+2t) \lt z\lt -L; 
     
    5151 
    5252    \begin{align} 
    53     F(Q,\alpha) = &\bigg[  
     53    F(Q,\alpha) = &\bigg[ 
    5454    (\rho_c - \rho_f) V_c \frac{2J_1(QRsin \alpha)}{QRsin\alpha}\frac{sin(QLcos\alpha/2)}{Q(L/2)cos\alpha} \\ 
    5555    &+(\rho_f - \rho_r) V_{c+f} \frac{2J_1(QRsin\alpha)}{QRsin\alpha}\frac{sin(Q(L/2+t_f)cos\alpha)}{Q(L/2+t_f)cos\alpha} \\ 
    5656    &+(\rho_r - \rho_s) V_t \frac{2J_1(Q(R+t_r)sin\alpha)}{Q(R+t_r)sin\alpha}\frac{sin(Q(L/2+t_f)cos\alpha)}{Q(L/2+t_f)cos\alpha} 
    5757    \bigg] 
    58     \end{align}  
     58    \end{align} 
    5959 
    6060where $V_t$ is the total volume of the bicelle, $V_c$ the volume of the core, 
     
    6666cylinders is then given by integrating over all possible $\theta$ and $\phi$. 
    6767 
    68 The *theta* and *phi* parameters are not used for the 1D output. 
     68For oriented bicelles the *theta*, and *phi* orientation parameters will appear when fitting 2D data, 
     69see the :ref:`cylinder` model for further information. 
    6970Our implementation of the scattering kernel and the 1D scattering intensity 
    7071use the c-library from NIST. 
    7172 
    72 .. figure:: img/cylinder_angle_definition.jpg 
     73.. figure:: img/cylinder_angle_definition.png 
    7374 
    74     Definition of the angles for the oriented core shell bicelle tmodel. 
     75    Definition of the angles for the oriented core shell bicelle model, 
     76    note that the cylinder axis of the bicelle starts along the beam direction 
     77    when $\theta  = \phi = 0$. 
    7578 
    7679 
     
    9194""" 
    9295 
    93 from numpy import inf, sin, cos 
     96from numpy import inf, sin, cos, pi 
    9497 
    9598name = "core_shell_bicelle" 
    9699title = "Circular cylinder with a core-shell scattering length density profile.." 
    97100description = """ 
    98     P(q,alpha)= (scale/Vs)*f(q)^(2) + bkg,  where:  
     101    P(q,alpha)= (scale/Vs)*f(q)^(2) + bkg,  where: 
    99102    f(q)= Vt(sld_rim - sld_solvent)* sin[qLt.cos(alpha)/2] 
    100103    /[qLt.cos(alpha)/2]*J1(qRout.sin(alpha)) 
     
    138141    ["sld_rim",        "1e-6/Ang^2", 4, [-inf, inf], "sld",         "Cylinder rim scattering length density"], 
    139142    ["sld_solvent",    "1e-6/Ang^2", 1, [-inf, inf], "sld",         "Solvent scattering length density"], 
    140     ["theta",          "degrees",   90, [-inf, inf], "orientation", "In plane angle"], 
    141     ["phi",            "degrees",    0, [-inf, inf], "orientation", "Out of plane angle"], 
     143    ["theta",          "degrees",   90, [-360, 360], "orientation", "cylinder axis to beam angle"], 
     144    ["phi",            "degrees",    0, [-360, 360], "orientation", "rotation about beam"] 
    142145    ] 
    143146 
     
    146149source = ["lib/sas_Si.c", "lib/polevl.c", "lib/sas_J1.c", "lib/gauss76.c", 
    147150          "core_shell_bicelle.c"] 
     151 
     152def random(): 
     153    import numpy as np 
     154    pars = dict( 
     155        radius=10**np.random.uniform(1.3, 3), 
     156        length=10**np.random.uniform(1.3, 4), 
     157        thick_rim=10**np.random.uniform(0, 1.7), 
     158        thick_face=10**np.random.uniform(0, 1.7), 
     159    ) 
     160    return pars 
    148161 
    149162demo = dict(scale=1, background=0, 
     
    158171            theta=90, 
    159172            phi=0) 
     173q = 0.1 
     174# april 6 2017, rkh add unit tests, NOT compared with any other calc method, assume correct! 
     175qx = q*cos(pi/6.0) 
     176qy = q*sin(pi/6.0) 
     177tests = [[{}, 0.05, 7.4883545957], 
     178        [{'theta':80., 'phi':10.}, (qx, qy), 2.81048892474 ] 
     179        ] 
     180del qx, qy  # not necessary to delete, but cleaner 
    160181 
    161 #qx, qy = 0.4 * cos(pi/2.0), 0.5 * sin(0) 
Note: See TracChangeset for help on using the changeset viewer.