Ignore:
Timestamp:
Jul 30, 2017 12:56:22 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:
48462b0
Parents:
a151caa
Message:

tuned random model generation for more models

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/elliptical_cylinder.py

    r9802ab3 r404ebbd  
    3333 
    3434    a = qr'\sin(\alpha) 
    35      
     35 
    3636    b = q\frac{L}{2}\cos(\alpha) 
    37      
     37 
    3838    r'=\frac{r_{minor}}{\sqrt{2}}\sqrt{(1+\nu^{2}) + (1-\nu^{2})cos(\psi)} 
    3939 
     
    5757define the axis of the cylinder using two angles $\theta$, $\phi$ and $\Psi$ 
    5858(see :ref:`cylinder orientation <cylinder-angle-definition>`). The angle 
    59 $\Psi$ is the rotational angle around its own long_c axis.  
     59$\Psi$ is the rotational angle around its own long_c axis. 
    6060 
    6161All angle parameters are valid and given only for 2D calculation; ie, an 
     
    7272    detector plane, with $\Psi$ = 0. 
    7373 
    74 The $\theta$ and $\phi$ parameters to orient the cylinder only appear in the model when fitting 2d data.  
     74The $\theta$ and $\phi$ parameters to orient the cylinder only appear in the model when fitting 2d data. 
    7575On introducing "Orientational Distribution" in the angles, "distribution of theta" and "distribution of phi" parameters will 
    76 appear. These are actually rotations about the axes $\delta_1$ and $\delta_2$ of the cylinder, the $b$ and $a$ axes of the  
    77 cylinder cross section. (When $\theta = \phi = 0$ these are parallel to the $Y$ and $X$ axes of the instrument.)  
    78 The third orientation distribution, in $\psi$, is about the $c$ axis of the particle. Some experimentation may be required to  
    79 understand the 2d patterns fully. (Earlier implementations had numerical integration issues in some circumstances when orientation  
    80 distributions passed through 90 degrees, such situations, with very broad distributions, should still be approached with care.)  
     76appear. These are actually rotations about the axes $\delta_1$ and $\delta_2$ of the cylinder, the $b$ and $a$ axes of the 
     77cylinder cross section. (When $\theta = \phi = 0$ these are parallel to the $Y$ and $X$ axes of the instrument.) 
     78The third orientation distribution, in $\psi$, is about the $c$ axis of the particle. Some experimentation may be required to 
     79understand the 2d patterns fully. (Earlier implementations had numerical integration issues in some circumstances when orientation 
     80distributions passed through 90 degrees, such situations, with very broad distributions, should still be approached with care.) 
    8181 
    8282NB: The 2nd virial coefficient of the cylinder is calculated based on the 
     
    110110 
    111111* **Author:** 
    112 * **Last Modified by:**  
     112* **Last Modified by:** 
    113113* **Last Reviewed by:**  Richard Heenan - corrected equation in docs **Date:** December 21, 2016 
    114114 
     
    156156                           + (length + radius) * (length + pi * radius)) 
    157157    return 0.5 * (ddd) ** (1. / 3.) 
     158 
     159def random(): 
     160    import numpy as np 
     161    # V = pi * radius_major * radius_minor * length; 
     162    V = 10**np.random.uniform(3, 9) 
     163    length = 10**np.random.uniform(1, 3) 
     164    axis_ratio = 10**(4*np.random.uniform(-2, 2) 
     165    radius_minor = np.sqrt(V/length/axis_ratio) 
     166    Vf = 10**np.random.uniform(-4, -2) 
     167    pars = dict( 
     168        #background=0, sld=0, sld_solvent=1, 
     169        scale=1e9*Vf/V, 
     170        length=length, 
     171        radius_minor=radius_minor, 
     172        axis_ratio=axis_ratio, 
     173    ) 
     174    return pars 
     175 
    158176q = 0.1 
    159177# april 6 2017, rkh added a 2d unit test, NOT READY YET pull #890 branch assume correct! 
Note: See TracChangeset for help on using the changeset viewer.