Changes in / [669bf21:f8da3f3] in sasmodels
- Files:
-
- 3 added
- 3 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
example/sesans_parameters_css-hs.py
r3415f4f rca3abe6 22 22 # Initial parameter values (if other than defaults) 23 23 initial_vals = { 24 "sld_core" : 1.0592, 24 "sld_core" : 1.05, 25 "sld_shell" : 2.88*pen-0.05*(1-pen), 25 26 "sld_solvent" : 2.88, 26 "radius" : 890, 27 "thickness" : 130 27 "radius" : 730, 28 "thickness" : 20, 29 "volfraction" : phi, 30 "scale" : (1-phi) 28 31 } 29 32 -
sasmodels/kernelcl.py
rc094758 r8e0d974 426 426 self._need_release = [self.loops_b, self.res_b, self.q_input] 427 427 428 def __call__(self, fixed_pars, pd_pars, cutoff =1e-5):428 def __call__(self, fixed_pars, pd_pars, cutoff): 429 429 real = (np.float32 if self.q_input.dtype == generate.F32 430 430 else np.float64 if self.q_input.dtype == generate.F64 -
sasmodels/models/core_shell_sphere.py
r3556ad7 r3f167d9 91 91 @param thickness: shell thickness 92 92 """ 93 return (1,1) 93 94 whole = 4.0 * pi / 3.0 * pow((radius + thickness), 3) 94 95 core = 4.0 * pi / 3.0 * radius * radius * radius -
sasmodels/models/hollow_rectangular_prism.py
r43b7eea r3d8283b 88 88 title = "Hollow rectangular parallelepiped with uniform scattering length density." 89 89 description = """ 90 I(q)= scale*V*(sld - s olvent_sld)^2*P(q,theta,phi)+background90 I(q)= scale*V*(sld - sld_solvent)^2*P(q,theta,phi)+background 91 91 P(q,theta,phi) = (2/pi/V^2) * double integral from 0 to pi/2 of ... 92 92 (AP1-AP2)^2(q)*sin(theta)*dtheta*dphi … … 103 103 parameters = [["sld", "1e-6/Ang^2", 6.3, [-inf, inf], "", 104 104 "Parallelepiped scattering length density"], 105 ["s olvent_sld", "1e-6/Ang^2", 1, [-inf, inf], "",105 ["sld_solvent", "1e-6/Ang^2", 1, [-inf, inf], "", 106 106 "Solvent scattering length density"], 107 107 ["a_side", "Ang", 35, [0, inf], "volume", … … 148 148 # parameters for demo 149 149 demo = dict(scale=1, background=0, 150 sld=6.3e-6, s olvent_sld=1.0e-6,150 sld=6.3e-6, sld_solvent=1.0e-6, 151 151 a_side=35, b2a_ratio=1, c2a_ratio=1, thickness=1, 152 152 a_side_pd=0.1, a_side_pd_n=10, … … 158 158 oldname = 'RectangularHollowPrismModel' 159 159 oldpars = dict(a_side='short_side', b2a_ratio='b2a_ratio', c_side='c2a_ratio', 160 thickness='thickness', sld='sldPipe', s olvent_sld='sldSolv')160 thickness='thickness', sld='sldPipe', sld_solvent='sldSolv') 161 161 162 162 tests = [[{}, 0.2, 0.76687283098], -
sasmodels/models/parallelepiped.py
r6ef4293 r76e5041 151 151 ---------- 152 152 153 None. 153 P Mittelbach and G Porod, *Acta Physica Austriaca*, 14 (1961) 185-211 154 155 R Nayuk and K Huber, *Z. Phys. Chem.*, 226 (2012) 837-854 154 156 """ 155 157 … … 160 162 title = "Rectangular parallelepiped with uniform scattering length density." 161 163 description = """ 162 I(q)= scale*V*(sld - s olvent_sld)^2*P(q,alpha)+background164 I(q)= scale*V*(sld - sld_solvent)^2*P(q,alpha)+background 163 165 P(q,alpha) = integral from 0 to 1 of ... 164 166 phi(mu*sqrt(1-sigma^2),a) * S(mu*c*sigma/2)^2 * dsigma … … 177 179 parameters = [["sld", "1e-6/Ang^2", 4, [-inf, inf], "", 178 180 "Parallelepiped scattering length density"], 179 ["s olvent_sld", "1e-6/Ang^2", 1, [-inf, inf], "",181 ["sld_solvent", "1e-6/Ang^2", 1, [-inf, inf], "", 180 182 "Solvent scattering length density"], 181 183 ["a_side", "Ang", 35, [0, inf], "volume", … … 210 212 # parameters for demo 211 213 demo = dict(scale=1, background=0, 212 sld=6.3e-6, s olvent_sld=1.0e-6,214 sld=6.3e-6, sld_solvent=1.0e-6, 213 215 a_side=35, b_side=75, c_side=400, 214 216 theta=45, phi=30, psi=15, … … 225 227 oldpars = dict(theta='parallel_theta', phi='parallel_phi', psi='parallel_psi', 226 228 a_side='short_a', b_side='short_b', c_side='long_c', 227 sld='sldPipe', s olvent_sld='sldSolv')229 sld='sldPipe', sld_solvent='sldSolv') 228 230 229 231 -
sasmodels/models/rectangular_prism.py
r43b7eea r76e5041 9 9 The only difference is that the way the relevant 10 10 parameters are defined here (*a*, *b/a*, *c/a* instead of *a*, *b*, *c*) 11 allows to usepolydispersity with this model while keeping the shape of11 which allows use of polydispersity with this model while keeping the shape of 12 12 the prism (e.g. setting *b/a* = 1 and *c/a* = 1 and applying polydispersity 13 13 to *a* will generate a distribution of cubes of different sizes). … … 86 86 title = "Rectangular parallelepiped with uniform scattering length density." 87 87 description = """ 88 I(q)= scale*V*(sld - s olvent_sld)^2*P(q,theta,phi)+background88 I(q)= scale*V*(sld - sld_solvent)^2*P(q,theta,phi)+background 89 89 P(q,theta,phi) = (2/pi) * double integral from 0 to pi/2 of ... 90 90 AP^2(q)*sin(theta)*dtheta*dphi … … 97 97 parameters = [["sld", "1e-6/Ang^2", 6.3, [-inf, inf], "", 98 98 "Parallelepiped scattering length density"], 99 ["s olvent_sld", "1e-6/Ang^2", 1, [-inf, inf], "",99 ["sld_solvent", "1e-6/Ang^2", 1, [-inf, inf], "", 100 100 "Solvent scattering length density"], 101 101 ["a_side", "Ang", 35, [0, inf], "volume", … … 125 125 # parameters for demo 126 126 demo = dict(scale=1, background=0, 127 sld=6.3e-6, s olvent_sld=1.0e-6,127 sld=6.3e-6, sld_solvent=1.0e-6, 128 128 a_side=35, b2a_ratio=1, c2a_ratio=1, 129 129 a_side_pd=0.1, a_side_pd_n=10, … … 135 135 oldname = 'RectangularPrismModel' 136 136 oldpars = dict(a_side='short_side', b2a_ratio='b2a_ratio', c_side='c2a_ratio', 137 sld='sldPipe', s olvent_sld='sldSolv')137 sld='sldPipe', sld_solvent='sldSolv') 138 138 139 139 tests = [[{}, 0.2, 0.375248406825], -
sasmodels/models/sphere.py
raa2edb2 r49da079 17 17 where *scale* is a volume fraction, $V$ is the volume of the scatterer, 18 18 $r$ is the radius of the sphere, *background* is the background level and 19 *sld* and *s olvent_sld* are the scattering length densities (SLDs) of the19 *sld* and *sld_solvent* are the scattering length densities (SLDs) of the 20 20 scatterer and the solvent respectively. 21 21 … … 49 49 title = "Spheres with uniform scattering length density" 50 50 description = """\ 51 P(q)=(scale/V)*[3V(sld-s olvent_sld)*(sin(qr)-qr cos(qr))51 P(q)=(scale/V)*[3V(sld-sld_solvent)*(sin(qr)-qr cos(qr)) 52 52 /(qr)^3]^2 + background 53 53 r: radius of sphere 54 54 V: The volume of the scatter 55 55 sld: the SLD of the sphere 56 s olvent_sld: the SLD of the solvent56 sld_solvent: the SLD of the solvent 57 57 """ 58 58 category = "shape:sphere" … … 61 61 parameters = [["sld", "1e-6/Ang^2", 1, [-inf, inf], "", 62 62 "Layer scattering length density"], 63 ["s olvent_sld", "1e-6/Ang^2", 6, [-inf, inf], "",63 ["sld_solvent", "1e-6/Ang^2", 6, [-inf, inf], "", 64 64 "Solvent scattering length density"], 65 65 ["radius", "Ang", 50, [0, inf], "volume", … … 76 76 77 77 Iq = """ 78 return sphere_form(q, radius, sld, s olvent_sld);78 return sphere_form(q, radius, sld, sld_solvent); 79 79 """ 80 80 … … 82 82 // never called since no orientation or magnetic parameters. 83 83 //return -1.0; 84 return Iq(sqrt(qx*qx + qy*qy), sld, s olvent_sld, radius);84 return Iq(sqrt(qx*qx + qy*qy), sld, sld_solvent, radius); 85 85 """ 86 86 … … 94 94 95 95 demo = dict(scale=1, background=0, 96 sld=6, s olvent_sld=1,96 sld=6, sld_solvent=1, 97 97 radius=120, 98 98 radius_pd=.2, radius_pd_n=45) 99 99 oldname = "SphereModel" 100 oldpars = dict(sld='sldSph', s olvent_sld='sldSolv', radius='radius')100 oldpars = dict(sld='sldSph', sld_solvent='sldSolv', radius='radius') -
sasmodels/models/triaxial_ellipsoid.py
r6ef4293 r49da079 91 91 "Solvent scattering length density"], 92 92 ["req_minor", "Ang", 20, [0, inf], "volume", 93 "Minor equ itorial radius"],93 "Minor equatorial radius"], 94 94 ["req_major", "Ang", 400, [0, inf], "volume", 95 95 "Major equatorial radius"], -
sasmodels/product.py
r72a081d r8e0d974 163 163 s_pd[0] = [effect_radius], [1.0] 164 164 165 p_res = self.p_kernel(p_fixed, p_pd )166 s_res = self.s_kernel(s_fixed, s_pd )165 p_res = self.p_kernel(p_fixed, p_pd, cutoff) 166 s_res = self.s_kernel(s_fixed, s_pd, cutoff) 167 167 #print s_fixed, s_pd, p_fixed, p_pd 168 168 -
sasmodels/sesans.py
rc94577f r2684d45 29 29 30 30 q_min = dq = 0.1 * 2*pi / Rmax 31 return np.arange(q_min, Converter("1/A")(q_max[0], units=q_max[1]), dq) 31 return np.arange(q_min, 32 Converter(q_max[1])(q_max[0], 33 units="1/A"), 34 dq) 32 35 33 36 def make_all_q(data): … … 75 78 76 79 def call_hankel(data, q_calc, Iq_calc): 77 return hankel(data.x, data.lam * 1e-9, 78 data.sample.thickness / 10, 80 return hankel((data.x, data.x_unit), 81 (data.lam, data.lam_unit), 82 (data.sample.thickness, 83 data.sample.thickness_unit), 79 84 q_calc, Iq_calc) 80 85 … … 182 187 *I* [cm$^{-1}$] is the value of the SANS model at *q* 183 188 """ 189 190 from sas.sascalc.data_util.nxsunit import Converter 191 wavelength = Converter(wavelength[1])(wavelength[0],"A") 192 thickness = Converter(thickness[1])(thickness[0],"A") 193 Iq = Converter("1/cm")(Iq,"1/A") # All models default to inverse centimeters 194 SElength = Converter(SElength[1])(SElength[0],"A") 195 184 196 G = np.zeros_like(SElength, 'd') 185 197 #============================================================================== … … 192 204 193 205 # [m^-1] step size in q, needed for integration 194 dq = (q[1]-q[0]) *1e10206 dq = (q[1]-q[0]) 195 207 196 208 # integration step, convert q into [m**-1] and 2 pi circle integration 197 G *= dq* 1e10*2*pi198 G0 *= dq*1e10*2*pi209 G *= dq*2*pi 210 G0 = np.sum(Iq*q)*dq*2*np.pi 199 211 200 212 P = exp(thickness*wavelength**2/(4*pi**2)*(G-G0))
Note: See TracChangeset
for help on using the changeset viewer.