Changeset 3556ad7 in sasmodels for sasmodels/models/ellipsoid.py


Ignore:
Timestamp:
Mar 20, 2016 6:24:32 AM (8 years ago)
Author:
richardh
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
e796fcb
Parents:
09d7a54
Message:

more docs changes, renamed sld's in core_shell_sphere

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/ellipsoid.py

    rcedad32 r3556ad7  
    22# Note: model title and parameter table are inserted automatically 
    33r""" 
    4 The form factor is normalized by the particle volume. 
     4The form factor is normalized by the particle volume  
    55 
    66Definition 
     
    3131 
    3232$\alpha$ is the angle between the axis of the ellipsoid and $\vec q$, 
    33 $V$ is the volume of the ellipsoid, $R_p$ is the polar radius along the 
     33$V = (4/3)\pi R_pR_e^2$ is the volume of the ellipsoid , $R_p$ is the polar radius along the 
    3434rotational axis of the ellipsoid, $R_e$ is the equatorial radius perpendicular 
    3535to the rotational axis of the ellipsoid and $\Delta \rho$ (contrast) is the 
     
    4141:ref:`cylinder orientation figure <cylinder-angle-definition>`. 
    4242For the ellipsoid, $\theta$ is the angle between the rotational axis 
    43 and the $z$-axis. 
     43and the $z$ -axis. 
    4444 
    4545NB: The 2nd virial coefficient of the solid ellipsoid is calculated based 
     
    5454.. figure:: img/ellipsoid_angle_projection.jpg 
    5555 
    56     The angles for oriented ellipsoid. 
     56    The angles for oriented ellipsoid, shown here as oblate, $a$ = $R_p$ and $b$ = $R_e$ 
    5757 
    5858Validation 
     
    7474    calculated from our 2D model and the intensity from the NIST SANS 
    7575    analysis software. The parameters used were: *scale* = 1.0, 
    76     *rpolar* = 20 |Ang|, *requatorial* = 400 |Ang|, 
     76    *r_polar* = 20 |Ang|, *r_equatorial* = 400 |Ang|, 
    7777    *contrast* = 3e-6 |Ang^-2|, and *background* = 0.0 |cm^-1|. 
    7878 
     
    102102description = """\ 
    103103P(q.alpha)= scale*f(q)^2 + background, where f(q)= 3*(sld 
    104         - solvent_sld)*V*[sin(q*r(Rp,Re,alpha)) 
     104        - sld_solvent)*V*[sin(q*r(Rp,Re,alpha)) 
    105105        -q*r*cos(qr(Rp,Re,alpha))] 
    106106        /[qr(Rp,Re,alpha)]^3" 
     
    110110 
    111111        sld: SLD of the ellipsoid 
    112         solvent_sld: SLD of the solvent 
     112        sld_solvent: SLD of the solvent 
    113113        V: volume of the ellipsoid 
    114114        Rp: polar radius of the ellipsoid 
     
    120120parameters = [["sld", "1e-6/Ang^2", 4, [-inf, inf], "", 
    121121               "Ellipsoid scattering length density"], 
    122               ["solvent_sld", "1e-6/Ang^2", 1, [-inf, inf], "", 
     122              ["sld_solvent", "1e-6/Ang^2", 1, [-inf, inf], "", 
    123123               "Solvent scattering length density"], 
    124               ["rpolar", "Ang", 20, [0, inf], "volume", 
     124              ["r_polar", "Ang", 20, [0, inf], "volume", 
    125125               "Polar radius"], 
    126               ["requatorial", "Ang", 400, [0, inf], "volume", 
     126              ["r_equatorial", "Ang", 400, [0, inf], "volume", 
    127127               "Equatorial radius"], 
    128128              ["theta", "degrees", 60, [-inf, inf], "orientation", 
     
    134134source = ["lib/sph_j1c.c", "lib/gauss76.c", "ellipsoid.c"] 
    135135 
    136 def ER(rpolar, requatorial): 
     136def ER(r_polar, r_equatorial): 
    137137    import numpy as np 
    138138 
    139     ee = np.empty_like(rpolar) 
    140     idx = rpolar > requatorial 
    141     ee[idx] = (rpolar[idx] ** 2 - requatorial[idx] ** 2) / rpolar[idx] ** 2 
    142     idx = rpolar < requatorial 
    143     ee[idx] = (requatorial[idx] ** 2 - rpolar[idx] ** 2) / requatorial[idx] ** 2 
    144     idx = rpolar == requatorial 
    145     ee[idx] = 2 * rpolar[idx] 
    146     valid = (rpolar * requatorial != 0) 
     139    ee = np.empty_like(r_polar) 
     140    idx = r_polar > r_equatorial 
     141    ee[idx] = (r_polar[idx] ** 2 - r_equatorial[idx] ** 2) / r_polar[idx] ** 2 
     142    idx = r_polar < r_equatorial 
     143    ee[idx] = (r_equatorial[idx] ** 2 - r_polar[idx] ** 2) / r_equatorial[idx] ** 2 
     144    idx = r_polar == r_equatorial 
     145    ee[idx] = 2 * r_polar[idx] 
     146    valid = (r_polar * r_equatorial != 0) 
    147147    bd = 1.0 - ee[valid] 
    148148    e1 = np.sqrt(ee[valid]) 
     
    152152    delta = 0.75 * b1 * b2 
    153153 
    154     ddd = np.zeros_like(rpolar) 
    155     ddd[valid] = 2.0 * (delta + 1.0) * rpolar * requatorial ** 2 
     154    ddd = np.zeros_like(r_polar) 
     155    ddd[valid] = 2.0 * (delta + 1.0) * r_polar * r_equatorial ** 2 
    156156    return 0.5 * ddd ** (1.0 / 3.0) 
    157157 
    158158 
    159159demo = dict(scale=1, background=0, 
    160             sld=6, solvent_sld=1, 
    161             rpolar=50, requatorial=30, 
     160            sld=6, sld_solvent=1, 
     161            r_polar=50, r_equatorial=30, 
    162162            theta=30, phi=15, 
    163             rpolar_pd=.2, rpolar_pd_n=15, 
    164             requatorial_pd=.2, requatorial_pd_n=15, 
     163            r_polar_pd=.2, r_polar_pd_n=15, 
     164            r_equatorial_pd=.2, r_equatorial_pd_n=15, 
    165165            theta_pd=15, theta_pd_n=45, 
    166166            phi_pd=15, phi_pd_n=1) 
    167167oldname = 'EllipsoidModel' 
    168168oldpars = dict(theta='axis_theta', phi='axis_phi', 
    169                sld='sldEll', solvent_sld='sldSolv', 
    170                rpolar='radius_a', requatorial='radius_b') 
     169               sld='sldEll', sld_solvent='sldSolv', 
     170               r_polar='radius_a', r_equatorial='radius_b') 
Note: See TracChangeset for help on using the changeset viewer.