Changeset 110f69c in sasmodels for sasmodels/models


Ignore:
Timestamp:
Nov 28, 2017 11:17:57 AM (6 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
e65c3ba
Parents:
167d0f1
Message:

lint

Location:
sasmodels/models
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/core_shell_bicelle_elliptical_belt_rough.py

    r129bdc4 r110f69c  
    66core-shell scattering length density profile. Thus this is a variation 
    77of the core-shell bicelle model, but with an elliptical cylinder for the core. 
    8 In this version the "rim" or "belt" does NOT extend the full length of the particle, 
    9 but has the same length as the core. 
    10 Outer shells on the rims and flat ends may be of different thicknesses and  
    11 scattering length densities. The form factor is normalized by the total particle volume. 
     8In this version the "rim" or "belt" does NOT extend the full length of 
     9the particle, but has the same length as the core. Outer shells on the 
     10rims and flat ends may be of different thicknesses and scattering length 
     11densities. The form factor is normalized by the total particle volume. 
    1212This version includes an approximate "interfacial roughness". 
    1313 
     
    1515.. figure:: img/core_shell_bicelle_belt_geometry.png 
    1616 
    17     Schematic cross-section of bicelle with belt. Note however that the model here 
    18     calculates for rectangular, not curved, rims as shown below. 
     17    Schematic cross-section of bicelle with belt. Note however that the model 
     18    here calculates for rectangular, not curved, rims as shown below. 
    1919 
    2020.. figure:: img/core_shell_bicelle_belt_parameters.png 
    2121 
    22    Cross section of model used here. Users will have  
    23    to decide how to distribute "heads" and "tails" between the rim, face  
     22   Cross section of model used here. Users will have 
     23   to decide how to distribute "heads" and "tails" between the rim, face 
    2424   and core regions in order to estimate appropriate starting parameters. 
    2525 
     
    3030.. math:: 
    3131 
    32     \rho(r) =  
    33       \begin{cases}  
     32    \rho(r) = 
     33      \begin{cases} 
    3434      &\rho_c \text{ for } 0 \lt r \lt R;   -L/2 \lt z\lt L/2 \\[1.5ex] 
    35       &\rho_f \text{ for } 0 \lt r \lt R;   -(L/2 +t_{face}) \lt z\lt -L/2;   
    36       L/2 \lt z\lt (L/2+t_{face}) \\[1.5ex] 
    37       &\rho_r\text{ for } R \lt r \lt R+t_{rim}; -L/2 \lt z\lt L/2 
     35      &\rho_f \text{ for } 0 \lt r \lt R;   -(L/2 +t_\text{face}) \lt z\lt -L/2; 
     36      L/2 \lt z\lt (L/2+t_\text{face}) \\[1.5ex] 
     37      &\rho_r\text{ for } R \lt r \lt R+t_\text{rim}; -L/2 \lt z\lt L/2 
    3838      \end{cases} 
    3939 
    4040The form factor for the bicelle is calculated in cylindrical coordinates, where 
    41 $\alpha$ is the angle between the $Q$ vector and the cylinder axis, and $\psi$ is the angle 
    42 for the ellipsoidal cross section core, to give: 
     41$\alpha$ is the angle between the $Q$ vector and the cylinder axis, and $\psi$ 
     42is the angle for the ellipsoidal cross section core, to give: 
    4343 
    4444.. math:: 
    4545 
    46     I(Q,\alpha,\psi) = \frac{\text{scale}}{V_t} \cdot 
    47         F(Q,\alpha, \psi)^2.sin(\alpha).exp\left \{ -\frac{1}{2}Q^2\sigma^2 \right \} + \text{background} 
     46    I(Q,\alpha,\psi) = \frac{\text{scale}}{V_t} 
     47        \cdot F(Q,\alpha, \psi)^2 \cdot \sin(\alpha) 
     48        \cdot\exp\left\{ -\frac{1}{2}Q^2\sigma^2 \right\} + \text{background} 
    4849 
    49 where a numerical integration of $F(Q,\alpha, \psi)^2.sin(\alpha)$ is carried out over \alpha and \psi for: 
     50where a numerical integration of $F(Q,\alpha, \psi)^2\sin(\alpha)$ is 
     51carried out over $\alpha$ and $\psi$ for: 
    5052 
    5153.. math:: 
    5254 
    53         \begin{align}     
    54     F(Q,\alpha,\psi) = &\bigg[  
    55     (\rho_c -\rho_r - \rho_f + \rho_s) V_c \frac{2J_1(QR'sin \alpha)}{QR'sin\alpha}\frac{sin(QLcos\alpha/2)}{Q(L/2)cos\alpha} \\ 
    56     &+(\rho_f - \rho_s) V_{c+f} \frac{2J_1(QR'sin\alpha)}{QR'sin\alpha}\frac{sin(Q(L/2+t_f)cos\alpha)}{Q(L/2+t_f)cos\alpha} \\ 
    57     &+(\rho_r - \rho_s) V_{c+r} \frac{2J_1(Q(R'+t_r)sin\alpha)}{Q(R'+t_r)sin\alpha}\frac{sin(Q(L/2)cos\alpha)}{Q(L/2)cos\alpha} 
     55    F(Q,\alpha,\psi) = &\bigg[ 
     56      (\rho_c -\rho_r - \rho_f + \rho_s) V_c 
     57      \frac{2J_1(QR'\sin \alpha)}{QR'\sin\alpha} 
     58      \frac{\sin(QL\cos\alpha/2)}{Q(L/2)\cos\alpha} \\ 
     59    &+(\rho_f - \rho_s) V_{c+f} 
     60      \frac{2J_1(QR'\sin\alpha)}{QR'\sin\alpha} 
     61      \frac{\sin(Q(L/2+t_f)\cos\alpha)}{Q(L/2+t_f)\cos\alpha} \\ 
     62    &+(\rho_r - \rho_s) V_{c+r} 
     63      \frac{2J_1(Q(R'+t_r)\sin\alpha)}{Q(R'+t_r)\sin\alpha} 
     64      \frac{\sin(Q(L/2)\cos\alpha)}{Q(L/2)\cos\alpha} 
    5865    \bigg] 
    59     \end{align}  
    6066 
    6167where 
     
    6369.. math:: 
    6470 
    65     R'=\frac{R}{\sqrt{2}}\sqrt{(1+X_{core}^{2}) + (1-X_{core}^{2})cos(\psi)} 
    66      
    67      
    68 and $V_t = \pi.(R+t_r)(Xcore.R+t_r).L + 2.\pi.Xcore.R^2.t_f$ is the total volume of the bicelle,  
    69 $V_c = \pi.Xcore.R^2.L$ the volume of the core, $V_{c+f} = \pi.Xcore.R^2.(L+2.t_f)$  
    70 the volume of the core plus the volume of the faces, $V_{c+r} = \pi.(R+t_r)(Xcore.R+t_r),.L$  
    71 the volume of the core plus the rim, $R$ is the radius 
    72 of the core, $Xcore$ is the axial ratio of the core, $L$ the length of the core,  
    73 $t_f$ the thickness of the face, $t_r$ the thickness of the rim and $J_1$ the usual  
    74 first order bessel function. The core has radii $R$ and $Xcore.R$ so is circular,  
    75 as for the core_shell_bicelle model, for $Xcore$ =1. Note that you may need to  
    76 limit the range of $Xcore$, especially if using the Monte-Carlo algorithm, as  
    77 setting radius to $R/Xcore$ and axial ratio to $1/Xcore$ gives an equivalent solution! 
     71    R' = \frac{R}{\sqrt{2}} 
     72        \sqrt{(1+X_\text{core}^{2}) + (1-X_\text{core}^{2})\cos(\psi)} 
    7873 
    79 An approximation for the effects of "Gaussian interfacial roughness" $\sigma$ is included,  
    80 by multiplying $I(Q)$ by $exp\left \{ -\frac{1}{2}Q^2\sigma^2 \right \}$ . This  
    81 applies, in some way, to all interfaces in the model not just the external ones. 
    82 (Note that for a one dimensional system convolution of the scattering length density profile 
    83 with a Gaussian of standard deviation $\sigma$ does exactly this multiplication.) Leave  
    84 $\sigma$ set to zero for the usual sharp interfaces. 
     74 
     75and $V_t = \pi (R+t_r)(X_\text{core} R+t_r) L + 2 \pi X_\text{core} R^2 t_f$ is 
     76the total volume of the bicelle, $V_c = \pi X_\text{core} R^2 L$ the volume of 
     77the core, $V_{c+f} = \pi X_\text{core} R^2 (L+2 t_f)$ the volume of the core 
     78plus the volume of the faces, $V_{c+r} = \pi (R+t_r)(X_\text{core} R+t_r) L$ 
     79the volume of the core plus the rim, $R$ is the radius of the core, 
     80$X_\text{core}$ is the axial ratio of the core, $L$ the length of the core, 
     81$t_f$ the thickness of the face, $t_r$ the thickness of the rim and $J_1$ the 
     82usual first order bessel function. The core has radii $R$ and $X_\text{core} R$ 
     83so is circular, as for the core_shell_bicelle model, for $X_\text{core}=1$. 
     84Note that you may need to limit the range of $X_\text{core}$, especially if 
     85using the Monte-Carlo algorithm, as setting radius to $R/X_\text{core}$ and 
     86axial ratio to $1/X_\text{core}$ gives an equivalent solution! 
     87 
     88An approximation for the effects of "Gaussian interfacial roughness" $\sigma$ 
     89is included, by multiplying $I(Q)$ by 
     90$\exp\left \{ -\frac{1}{2}Q^2\sigma^2 \right \}$. This applies, in some way, to 
     91all interfaces in the model not just the external ones. (Note that for a one 
     92dimensional system convolution of the scattering length density profile with 
     93a Gaussian of standard deviation $\sigma$ does exactly this multiplication.) 
     94Leave $\sigma$ set to zero for the usual sharp interfaces. 
    8595 
    8696The output of the 1D scattering intensity function for randomly oriented 
    8797bicelles is then given by integrating over all possible $\alpha$ and $\psi$. 
    8898 
    89 For oriented bicelles the *theta*, *phi* and *psi* orientation parameters will appear when fitting 2D data,  
    90 for further details of the calculation and angular dispersions  see :ref:`orientation` . 
     99For oriented bicelles the *theta*, *phi* and *psi* orientation parameters 
     100will appear when fitting 2D data, for further details of the calculation 
     101and angular dispersions  see :ref:`orientation` . 
    91102 
    92103.. figure:: img/elliptical_cylinder_angle_definition.png 
    93104 
    94     Definition of the angles for the oriented core_shell_bicelle_elliptical particles.    
     105    Definition of the angles for the oriented core_shell_bicelle_elliptical 
     106    particles. 
    95107 
    96108 
     
    115127description = """ 
    116128    core_shell_bicelle_elliptical_belt_rough 
    117     Elliptical cylinder core, optional shell on the two flat faces, and "belt" shell of  
     129    Elliptical cylinder core, optional shell on the two flat faces, and "belt" shell of 
    118130    uniform thickness on its rim (in this case NOT extending around the end faces). 
    119131    with approximate interfacial roughness. 
     
    173185 
    174186    [{'radius': 30.0, 'x_core': 3.0, 'thick_rim':8.0, 'thick_face':14.0, 'length':50.0, 
    175     'sld_core':4.0, 'sld_face':7.0, 'sld_rim':1.0, 'sld_solvent':6.0, 'background':0.0}, 
    176     0.015, 189.328], 
    177 #    [{'theta':80., 'phi':10.}, (qx, qy), 7.88866563001 ], 
    178         ] 
     187      'sld_core':4.0, 'sld_face':7.0, 'sld_rim':1.0, 'sld_solvent':6.0, 'background':0.0}, 
     188     0.015, 189.328], 
     189    #[{'theta':80., 'phi':10.}, (qx, qy), 7.88866563001 ], 
     190] 
    179191 
    180192del qx, qy  # not necessary to delete, but cleaner 
  • sasmodels/models/ellipsoid.py

    reda8b30 r110f69c  
    5353    r = R_e \left[ 1 + u^2\left(R_p^2/R_e^2 - 1\right)\right]^{1/2} 
    5454 
    55 For 2d data from oriented ellipsoids the direction of the rotation axis of  
    56 the ellipsoid is defined using two angles $\theta$ and $\phi$ as for the  
     55For 2d data from oriented ellipsoids the direction of the rotation axis of 
     56the ellipsoid is defined using two angles $\theta$ and $\phi$ as for the 
    5757:ref:`cylinder orientation figure <cylinder-angle-definition>`. 
    5858For the ellipsoid, $\theta$ is the angle between the rotational axis 
    5959and the $z$ -axis in the $xz$ plane followed by a rotation by $\phi$ 
    60 in the $xy$ plane, for further details of the calculation and angular  
     60in the $xy$ plane, for further details of the calculation and angular 
    6161dispersions see :ref:`orientation` . 
    6262 
     
    209209qy = q*sin(pi/6.0) 
    210210tests = [[{}, 0.05, 54.8525847025], 
    211         [{'theta':80., 'phi':10.}, (qx, qy), 1.74134670026 ], 
     211        [{'theta':80., 'phi':10.}, (qx, qy), 1.74134670026], 
    212212        ] 
    213213del qx, qy  # not necessary to delete, but cleaner 
  • sasmodels/models/stacked_disks.py

    reda8b30 r110f69c  
    7474    the layers. 
    7575 
    76 2d scattering from oriented stacks is calculated in the same way as for cylinders, 
    77 for further details of the calculation and angular dispersions see :ref:`orientation` .  
     762d scattering from oriented stacks is calculated in the same way as for 
     77cylinders, for further details of the calculation and angular dispersions 
     78see :ref:`orientation`. 
    7879 
    7980.. figure:: img/cylinder_angle_definition.png 
    8081 
    8182    Angles $\theta$ and $\phi$ orient the stack of discs relative 
    82     to the beam line coordinates, where the beam is along the $z$ axis. Rotation $\theta$, initially  
    83     in the $xz$ plane, is carried out first, then rotation $\phi$ about the $z$ axis. Orientation distributions 
    84     are described as rotations about two perpendicular axes $\delta_1$ and $\delta_2$ 
    85     in the frame of the cylinder itself, which when $\theta = \phi = 0$ are parallel to the $Y$ and $X$ axes. 
     83    to the beam line coordinates, where the beam is along the $z$ axis. 
     84    Rotation $\theta$, initially in the $xz$ plane, is carried out first, 
     85    then rotation $\phi$ about the $z$ axis. Orientation distributions are 
     86    described as rotations about two perpendicular axes $\delta_1$ and 
     87    $\delta_2$ in the frame of the cylinder itself, which when 
     88    $\theta = \phi = 0$ are parallel to the $Y$ and $X$ axes. 
    8689 
    8790 
Note: See TracChangeset for help on using the changeset viewer.