Changes in sasmodels/models/ellipsoid.py [0168844:d277229] in sasmodels
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/ellipsoid.py
r0168844 rd277229 126 126 from numpy import inf, sin, cos, pi 127 127 128 try:129 from numpy import cbrt130 except ImportError:131 def cbrt(x): return x ** (1.0/3.0)132 133 128 name = "ellipsoid" 134 129 title = "Ellipsoid of revolution with uniform scattering length density." … … 166 161 ] 167 162 163 168 164 source = ["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 165 have_Fq = True 166 effective_radius_type = ["equivalent sphere","average curvature", "min radius", "max radius"] 191 167 192 168 def random():
Note: See TracChangeset
for help on using the changeset viewer.