Changeset 2e6d7c8 in sasmodels


Ignore:
Timestamp:
Aug 17, 2018 12:05:36 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:
0168844
Parents:
6e45516
Message:

fix ellipsoid ER for polar=equatorial radius (mis-copied from sasview 3.x)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/ellipsoid.py

    r2d81cfe r2e6d7c8  
    170170    idx = radius_polar < radius_equatorial 
    171171    ee[idx] = (radius_equatorial[idx] ** 2 - radius_polar[idx] ** 2) / radius_equatorial[idx] ** 2 
    172     idx = radius_polar == radius_equatorial 
    173     ee[idx] = 2 * radius_polar[idx] 
    174     valid = (radius_polar * radius_equatorial != 0) 
     172    valid = (radius_polar * radius_equatorial != 0) & (radius_polar != radius_equatorial) 
    175173    bd = 1.0 - ee[valid] 
    176174    e1 = np.sqrt(ee[valid]) 
     
    179177    b2 = 1.0 + bd / 2 / e1 * np.log(bL) 
    180178    delta = 0.75 * b1 * b2 
    181  
    182     ddd = np.zeros_like(radius_polar) 
    183     ddd[valid] = 2.0 * (delta + 1.0) * radius_polar * radius_equatorial ** 2 
    184     return 0.5 * ddd ** (1.0 / 3.0) 
     179    ddd = 2.0 * (delta + 1.0) * (radius_polar * radius_equatorial**2)[valid] 
     180 
     181    r = np.zeros_like(radius_polar) 
     182    r[valid] = 0.5 * np.cbrt(ddd) 
     183    idx = radius_polar == radius_equatorial 
     184    r[idx] = radius_polar[idx] 
     185    return r 
    185186 
    186187def random(): 
Note: See TracChangeset for help on using the changeset viewer.