Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/ellipsoid.py

    r0168844 rd277229  
    126126from numpy import inf, sin, cos, pi 
    127127 
    128 try: 
    129     from numpy import cbrt 
    130 except ImportError: 
    131     def cbrt(x): return x ** (1.0/3.0) 
    132  
    133128name = "ellipsoid" 
    134129title = "Ellipsoid of revolution with uniform scattering length density." 
     
    166161             ] 
    167162 
     163 
    168164source = ["lib/sas_3j1x_x.c", "lib/gauss76.c", "ellipsoid.c"] 
    169  
    170 def ER(radius_polar, radius_equatorial): 
    171     # see equation (26) in A.Isihara, J.Chem.Phys. 18(1950)1446-1449 
    172     ee = np.empty_like(radius_polar) 
    173     idx = radius_polar > radius_equatorial 
    174     ee[idx] = (radius_polar[idx] ** 2 - radius_equatorial[idx] ** 2) / radius_polar[idx] ** 2 
    175     idx = radius_polar < radius_equatorial 
    176     ee[idx] = (radius_equatorial[idx] ** 2 - radius_polar[idx] ** 2) / radius_equatorial[idx] ** 2 
    177     valid = (radius_polar * radius_equatorial != 0) & (radius_polar != radius_equatorial) 
    178     bd = 1.0 - ee[valid] 
    179     e1 = np.sqrt(ee[valid]) 
    180     b1 = 1.0 + np.arcsin(e1) / (e1 * np.sqrt(bd)) 
    181     bL = (1.0 + e1) / (1.0 - e1) 
    182     b2 = 1.0 + bd / 2 / e1 * np.log(bL) 
    183     delta = 0.75 * b1 * b2 
    184     ddd = 2.0 * (delta + 1.0) * (radius_polar * radius_equatorial**2)[valid] 
    185  
    186     r = np.zeros_like(radius_polar) 
    187     r[valid] = 0.5 * cbrt(ddd) 
    188     idx = radius_polar == radius_equatorial 
    189     r[idx] = radius_polar[idx] 
    190     return r 
     165have_Fq = True 
     166effective_radius_type = ["equivalent sphere","average curvature", "min radius", "max radius"] 
    191167 
    192168def random(): 
Note: See TracChangeset for help on using the changeset viewer.