Changes in sasmodels/models/ellipsoid.py [2d81cfe:0168844] in sasmodels
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/ellipsoid.py
r2d81cfe r0168844 125 125 import numpy as np 126 126 from numpy import inf, sin, cos, pi 127 128 try: 129 from numpy import cbrt 130 except ImportError: 131 def cbrt(x): return x ** (1.0/3.0) 127 132 128 133 name = "ellipsoid" … … 170 175 idx = radius_polar < radius_equatorial 171 176 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) 177 valid = (radius_polar * radius_equatorial != 0) & (radius_polar != radius_equatorial) 175 178 bd = 1.0 - ee[valid] 176 179 e1 = np.sqrt(ee[valid]) … … 179 182 b2 = 1.0 + bd / 2 / e1 * np.log(bL) 180 183 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) 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 185 191 186 192 def random():
Note: See TracChangeset
for help on using the changeset viewer.