Ignore:
Timestamp:
Nov 29, 2017 11:13:23 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:
237b800f
Parents:
a839b22
Message:

lint

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/core_shell_bicelle_elliptical.py

    r30b60d2 r2d81cfe  
    77of the core-shell bicelle model, but with an elliptical cylinder for the core. 
    88Outer shells on the rims and flat ends may be of different thicknesses and 
    9 scattering length densities. The form factor is normalized by the total particle volume. 
     9scattering length densities. The form factor is normalized by the total 
     10particle volume. 
    1011 
    1112 
     
    3637 
    3738The form factor for the bicelle is calculated in cylindrical coordinates, where 
    38 $\alpha$ is the angle between the $Q$ vector and the cylinder axis, and $\psi$ is the angle 
    39 for the ellipsoidal cross section core, to give: 
     39$\alpha$ is the angle between the $Q$ vector and the cylinder axis, and $\psi$ 
     40is the angle for the ellipsoidal cross section core, to give: 
    4041 
    4142.. math:: 
     
    4445        F(Q,\alpha, \psi)^2 \cdot sin(\alpha) + \text{background} 
    4546 
    46 where a numerical integration of $F(Q,\alpha, \psi)^2 \cdot sin(\alpha)$ is carried out over \alpha and \psi for: 
     47where a numerical integration of $F(Q,\alpha, \psi)^2 \cdot sin(\alpha)$ 
     48is carried out over \alpha and \psi for: 
    4749 
    4850.. math:: 
     
    5153    \begin{align*} 
    5254    F(Q,\alpha,\psi) = &\bigg[ 
    53     (\rho_c - \rho_f) V_c \frac{2J_1(QR'sin \alpha)}{QR'sin\alpha}\frac{sin(QLcos\alpha/2)}{Q(L/2)cos\alpha} \\ 
    54     &+(\rho_f - \rho_r) 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} \\ 
    55     &+(\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} 
     55    (\rho_c - \rho_f) V_c 
     56     \frac{2J_1(QR'sin \alpha)}{QR'sin\alpha} 
     57     \frac{sin(QLcos\alpha/2)}{Q(L/2)cos\alpha} \\ 
     58    &+(\rho_f - \rho_r) V_{c+f} 
     59     \frac{2J_1(QR'sin\alpha)}{QR'sin\alpha} 
     60     \frac{sin(Q(L/2+t_f)cos\alpha)}{Q(L/2+t_f)cos\alpha} \\ 
     61    &+(\rho_r - \rho_s) V_t 
     62     \frac{2J_1(Q(R'+t_r)sin\alpha)}{Q(R'+t_r)sin\alpha} 
     63     \frac{sin(Q(L/2+t_f)cos\alpha)}{Q(L/2+t_f)cos\alpha} 
    5664    \bigg] 
    5765    \end{align*} 
     
    6472 
    6573 
    66 and $V_t = \pi.(R+t_r)(Xcore.R+t_r)^2.(L+2.t_f)$ is the total volume of the bicelle, 
    67 $V_c = \pi.Xcore.R^2.L$ the volume of the core, $V_{c+f} = \pi.Xcore.R^2.(L+2.t_f)$ 
    68 the volume of the core plus the volume of the faces, $R$ is the radius 
    69 of the core, $Xcore$ is the axial ratio of the core, $L$ the length of the core, 
    70 $t_f$ the thickness of the face, $t_r$ the thickness of the rim and $J_1$ the usual 
    71 first order bessel function. The core has radii $R$ and $Xcore.R$ so is circular, 
    72 as for the core_shell_bicelle model, for $Xcore$ =1. Note that you may need to 
    73 limit the range of $Xcore$, especially if using the Monte-Carlo algorithm, as 
    74 setting radius to $R/Xcore$ and axial ratio to $1/Xcore$ gives an equivalent solution! 
     74and $V_t = \pi.(R+t_r)(Xcore.R+t_r)^2.(L+2.t_f)$ is the total volume of 
     75the bicelle, $V_c = \pi.Xcore.R^2.L$ the volume of the core, 
     76$V_{c+f} = \pi.Xcore.R^2.(L+2.t_f)$ the volume of the core plus the volume 
     77of the faces, $R$ is the radius of the core, $Xcore$ is the axial ratio of 
     78the core, $L$ the length of the core, $t_f$ the thickness of the face, $t_r$ 
     79the thickness of the rim and $J_1$ the usual first order bessel function. 
     80The core has radii $R$ and $Xcore.R$ so is circular, as for the 
     81core_shell_bicelle model, for $Xcore$ =1. Note that you may need to 
     82limit the range of $Xcore$, especially if using the Monte-Carlo algorithm, 
     83as setting radius to $R/Xcore$ and axial ratio to $1/Xcore$ gives an 
     84equivalent solution! 
    7585 
    7686The output of the 1D scattering intensity function for randomly oriented 
    7787bicelles is then given by integrating over all possible $\alpha$ and $\psi$. 
    7888 
    79 For oriented bicelles the *theta*, *phi* and *psi* orientation parameters will appear when fitting 2D data, 
    80 see the :ref:`elliptical-cylinder` model for further information. 
     89For oriented bicelles the *theta*, *phi* and *psi* orientation parameters will 
     90appear when fitting 2D data, see the :ref:`elliptical-cylinder` model 
     91for further information. 
    8192 
    8293 
     
    100111""" 
    101112 
     113import numpy as np 
    102114from numpy import inf, sin, cos, pi 
    103115 
     
    138150 
    139151def random(): 
    140     import numpy as np 
    141152    outer_major = 10**np.random.uniform(1, 4.7) 
    142153    outer_minor = 10**np.random.uniform(1, 4.7) 
     
    170181 
    171182tests = [ 
    172     [{'radius': 30.0, 'x_core': 3.0, 'thick_rim':8.0, 'thick_face':14.0, 'length':50.0}, 'ER', 1], 
    173     [{'radius': 30.0, 'x_core': 3.0, 'thick_rim':8.0, 'thick_face':14.0, 'length':50.0}, 'VR', 1], 
     183    [{'radius': 30.0, 'x_core': 3.0, 
     184      'thick_rim': 8.0, 'thick_face': 14.0, 'length': 50.0}, 'ER', 1], 
     185    [{'radius': 30.0, 'x_core': 3.0, 
     186      'thick_rim': 8.0, 'thick_face': 14.0, 'length': 50.0}, 'VR', 1], 
    174187 
    175     [{'radius': 30.0, 'x_core': 3.0, 'thick_rim':8.0, 'thick_face':14.0, 'length':50.0, 
    176     'sld_core':4.0, 'sld_face':7.0, 'sld_rim':1.0, 'sld_solvent':6.0, 'background':0.0}, 
    177     0.015, 286.540286], 
    178 #    [{'theta':80., 'phi':10.}, (qx, qy), 7.88866563001 ], 
    179         ] 
     188    [{'radius': 30.0, 'x_core': 3.0, 
     189      'thick_rim': 8.0, 'thick_face': 14.0, 'length': 50.0, 
     190      'sld_core': 4.0, 'sld_face': 7.0, 'sld_rim': 1.0, 
     191      'sld_solvent': 6.0, 'background': 0.0}, 
     192     0.015, 286.540286], 
     193    #[{'theta':80., 'phi':10.}, (qx, qy), 7.88866563001], 
     194] 
    180195 
    181196del qx, qy  # not necessary to delete, but cleaner 
Note: See TracChangeset for help on using the changeset viewer.