Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/triaxial_ellipsoid.py

    r0b56f38 r15a90c1  
    6565To provide easy access to the orientation of the triaxial ellipsoid, 
    6666we define the axis of the cylinder using the angles $\theta$, $\phi$ 
    67 and $\psi$. These angles are defined on 
    68 :numref:`triaxial-ellipsoid-angles` . 
     67and $\psi$. These angles are defined analogously to the elliptical_cylinder below 
     68 
     69.. figure:: img/elliptical_cylinder_angle_definition.png 
     70 
     71    Definition of angles for oriented triaxial ellipsoid, where radii shown here are $a < b << c$ 
     72    and angle $\Psi$ is a rotation around the axis of the particle. 
     73 
    6974The angle $\psi$ is the rotational angle around its own $c$ axis 
    7075against the $q$ plane. For example, $\psi = 0$ when the 
     
    7378.. _triaxial-ellipsoid-angles: 
    7479 
    75 .. figure:: img/triaxial_ellipsoid_angle_projection.jpg 
     80.. figure:: img/triaxial_ellipsoid_angle_projection.png 
    7681 
    77     The angles for oriented ellipsoid. 
     82    Some example angles for oriented ellipsoid. 
    7883 
    7984The radius-of-gyration for this system is  $R_g^2 = (R_a R_b R_c)^2/5$. 
     
    8186The contrast $\Delta\rho$ is defined as SLD(ellipsoid) - SLD(solvent).  In the 
    8287parameters, $R_a$ is the minor equatorial radius, $R_b$ is the major 
    83 equatorial radius, and $R_c$ is the polar radius of the ellipsoid. 
     88equatorial radius, and $R_c$ is the polar radius of the ellipsoid.  
    8489 
    8590NB: The 2nd virial coefficient of the triaxial solid ellipsoid is 
     
    112117""" 
    113118 
    114 from numpy import inf, sin, cos, pi 
     119from numpy import inf 
    115120 
    116121name = "triaxial_ellipsoid" 
     
    147152def ER(radius_equat_minor, radius_equat_major, radius_polar): 
    148153    """ 
    149         Returns the effective radius used in the S*P calculation 
     154    Returns the effective radius used in the S*P calculation 
    150155    """ 
    151156    import numpy as np 
    152157    from .ellipsoid import ER as ellipsoid_ER 
    153      # now that radii can be in any size order, radii need sorting a,b,c where a~b and c is either much smaller or much larger 
    154      # also need some unit tests! 
    155      
    156     return ellipsoid_ER(radius_polar, np.sqrt(radius_equat_minor * radius_equat_major)) 
     158 
     159    # now that radii can be in any size order, radii need sorting a,b,c where a~b and c is either much smaller  
     160    # or much larger 
     161    radii = np.vstack((radius_equat_major, radius_equat_minor, radius_polar)) 
     162    radii = np.sort(radii, axis=0) 
     163    selector = (radii[1] - radii[0]) > (radii[2] - radii[1]) 
     164    polar = np.where(selector, radii[0], radii[2]) 
     165    equatorial = np.sqrt(np.where(~selector, radii[0]*radii[1], radii[1]*radii[2])) 
     166    return ellipsoid_ER(polar, equatorial) 
    157167 
    158168demo = dict(scale=1, background=0, 
     
    166176            phi_pd=15, phi_pd_n=1, 
    167177            psi_pd=15, psi_pd_n=1) 
    168 q = 0.1 
    169 # april 6 2017, rkh add unit tests, NOT compared with any other calc method, assume correct! 
    170 # add 2d test after pull #890 
    171 qx = q*cos(pi/6.0) 
    172 qy = q*sin(pi/6.0) 
    173 tests = [[{}, 0.05, 24.8839548033], 
    174 #        [{'theta':80., 'phi':10.}, (qx, qy), 9999. ], 
    175         ] 
    176 del qx, qy  # not necessary to delete, but cleaner 
     178 
     179# TODO: need some unit tests! 
Note: See TracChangeset for help on using the changeset viewer.