Changeset 68532f3 in sasmodels for _sources/model/ellipsoid.txt
- Timestamp:
- Nov 1, 2015 2:10:22 PM (8 years ago)
- Branches:
- gh-pages
- Children:
- 4a9a316
- Parents:
- d1fe925
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
_sources/model/ellipsoid.txt
rd1fe925 r68532f3 1 # ellipsoid model 2 # Note: model title and parameter table are inserted automatically 3 r""" 1 .. _ellipsoid: 2 3 Ellipsoid 4 ======================================================= 5 6 Ellipsoid of revolution with uniform scattering length density. 7 8 =========== =================================== ============ ============= 9 Parameter Description Units Default value 10 =========== =================================== ============ ============= 11 scale Source intensity None 1 12 background Source background |cm^-1| 0 13 sld Ellipsoid scattering length density |1e-6Ang^-2| 4 14 solvent_sld Solvent scattering length density |1e-6Ang^-2| 1 15 rpolar Polar radius |Ang| 20 16 requatorial Equatorial radius |Ang| 400 17 theta In plane angle degree 60 18 phi Out of plane angle degree 60 19 =========== =================================== ============ ============= 20 21 The returned value is scaled to units of |cm^-1|. 22 23 4 24 The form factor is normalized by the particle volume. 5 25 … … 114 134 L A Feigin and D I Svergun. *Structure Analysis by Small-Angle X-Ray and Neutron Scattering*, Plenum, 115 135 New York, 1987. 116 """117 136 118 from numpy import inf119 120 name = "ellipsoid"121 title = "Ellipsoid of revolution with uniform scattering length density."122 123 description = """\124 P(q.alpha)= scale*f(q)^2 + background, where f(q)= 3*(sld125 - solvent_sld)*V*[sin(q*r(Rp,Re,alpha))126 -q*r*cos(qr(Rp,Re,alpha))]127 /[qr(Rp,Re,alpha)]^3"128 129 r(Rp,Re,alpha)= [Re^(2)*(sin(alpha))^2130 + Rp^(2)*(cos(alpha))^2]^(1/2)131 132 sld: SLD of the ellipsoid133 solvent_sld: SLD of the solvent134 V: volume of the ellipsoid135 Rp: polar radius of the ellipsoid136 Re: equatorial radius of the ellipsoid137 """138 category = "shape:ellipsoid"139 140 # ["name", "units", default, [lower, upper], "type","description"],141 parameters = [["sld", "1e-6/Ang^2", 4, [-inf, inf], "",142 "Ellipsoid scattering length density"],143 ["solvent_sld", "1e-6/Ang^2", 1, [-inf, inf], "",144 "Solvent scattering length density"],145 ["rpolar", "Ang", 20, [0, inf], "volume",146 "Polar radius"],147 ["requatorial", "Ang", 400, [0, inf], "volume",148 "Equatorial radius"],149 ["theta", "degrees", 60, [-inf, inf], "orientation",150 "In plane angle"],151 ["phi", "degrees", 60, [-inf, inf], "orientation",152 "Out of plane angle"],153 ]154 155 source = ["lib/J1.c", "lib/gauss76.c", "ellipsoid.c"]156 157 def ER(rpolar, requatorial):158 import numpy as np159 160 ee = np.empty_like(rpolar)161 idx = rpolar > requatorial162 ee[idx] = (rpolar[idx] ** 2 - requatorial[idx] ** 2) / rpolar[idx] ** 2163 idx = rpolar < requatorial164 ee[idx] = (requatorial[idx] ** 2 - rpolar[idx] ** 2) / requatorial[idx] ** 2165 idx = rpolar == requatorial166 ee[idx] = 2 * rpolar[idx]167 valid = (rpolar * requatorial != 0)168 bd = 1.0 - ee[valid]169 e1 = np.sqrt(ee[valid])170 b1 = 1.0 + np.arcsin(e1) / (e1 * np.sqrt(bd))171 bL = (1.0 + e1) / (1.0 - e1)172 b2 = 1.0 + bd / 2 / e1 * np.log(bL)173 delta = 0.75 * b1 * b2174 175 ddd = np.zeros_like(rpolar)176 ddd[valid] = 2.0 * (delta + 1.0) * rpolar * requatorial ** 2177 return 0.5 * ddd ** (1.0 / 3.0)178 179 180 demo = dict(scale=1, background=0,181 sld=6, solvent_sld=1,182 rpolar=50, requatorial=30,183 theta=30, phi=15,184 rpolar_pd=.2, rpolar_pd_n=15,185 requatorial_pd=.2, requatorial_pd_n=15,186 theta_pd=15, theta_pd_n=45,187 phi_pd=15, phi_pd_n=1)188 oldname = 'EllipsoidModel'189 oldpars = dict(theta='axis_theta', phi='axis_phi',190 sld='sldEll', solvent_sld='sldSolv',191 rpolar='radius_a', requatorial='radius_b')
Note: See TracChangeset
for help on using the changeset viewer.