Changeset 0168844 in sasmodels


Ignore:
Timestamp:
Aug 17, 2018 10:27:32 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:
bd7630d, 39c2de9, 70530778
Parents:
2e6d7c8
Message:

older versions of numpy do not have the cube root function cbrt

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/ellipsoid.py

    r2e6d7c8 r0168844  
    125125import numpy as np 
    126126from numpy import inf, sin, cos, pi 
     127 
     128try: 
     129    from numpy import cbrt 
     130except ImportError: 
     131    def cbrt(x): return x ** (1.0/3.0) 
    127132 
    128133name = "ellipsoid" 
     
    180185 
    181186    r = np.zeros_like(radius_polar) 
    182     r[valid] = 0.5 * np.cbrt(ddd) 
     187    r[valid] = 0.5 * cbrt(ddd) 
    183188    idx = radius_polar == radius_equatorial 
    184189    r[idx] = radius_polar[idx] 
Note: See TracChangeset for help on using the changeset viewer.