Changeset c88f983 in sasmodels for sasmodels/models/ellipsoid.py
- Timestamp:
- Sep 8, 2018 5:29:57 AM (6 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- c11d09f, 0159b5e
- Parents:
- 84f2962 (diff), 475ff58 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/ellipsoid.py
r71b751d rc88f983 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" … … 172 177 idx = radius_polar < radius_equatorial 173 178 ee[idx] = (radius_equatorial[idx] ** 2 - radius_polar[idx] ** 2) / radius_equatorial[idx] ** 2 174 idx = radius_polar == radius_equatorial 175 ee[idx] = 2 * radius_polar[idx] 176 valid = (radius_polar * radius_equatorial != 0) 179 valid = (radius_polar * radius_equatorial != 0) & (radius_polar != radius_equatorial) 177 180 bd = 1.0 - ee[valid] 178 181 e1 = np.sqrt(ee[valid]) … … 181 184 b2 = 1.0 + bd / 2 / e1 * np.log(bL) 182 185 delta = 0.75 * b1 * b2 183 184 ddd = np.zeros_like(radius_polar) 185 ddd[valid] = 2.0 * (delta + 1.0) * radius_polar * radius_equatorial ** 2 186 return 0.5 * ddd ** (1.0 / 3.0) 186 ddd = 2.0 * (delta + 1.0) * (radius_polar * radius_equatorial**2)[valid] 187 188 r = np.zeros_like(radius_polar) 189 r[valid] = 0.5 * cbrt(ddd) 190 idx = radius_polar == radius_equatorial 191 r[idx] = radius_polar[idx] 192 return r 187 193 188 194 def random():
Note: See TracChangeset
for help on using the changeset viewer.