Changeset 49da079 in sasmodels
- Timestamp:
- Mar 21, 2016 5:53:21 AM (9 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 5430333
- Parents:
- 1e9a108
- Location:
- sasmodels/models
- Files:
-
- 2 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/_spherepy.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 … … 47 47 from numpy import pi, inf, sin, cos, sqrt, log 48 48 49 name = " sphere (python)"50 title = " Spheres with uniform scattering length density"49 name = " _sphere (python)" 50 title = "PAK testing ideas for Spheres with uniform scattering length density" 51 51 description = """\ 52 P(q)=(scale/V)*[3V(sld-s olvent_sld)*(sin(qr)-qr cos(qr))52 P(q)=(scale/V)*[3V(sld-sld_solvent)*(sin(qr)-qr cos(qr)) 53 53 /(qr)^3]^2 + background 54 54 r: radius of sphere 55 55 V: The volume of the scatter 56 56 sld: the SLD of the sphere 57 s olvent_sld: the SLD of the solvent57 sld_solvent: the SLD of the solvent 58 58 """ 59 59 category = "shape:sphere" … … 62 62 parameters = [["sld", "1e-6/Ang^2", 1, [-inf, inf], "", 63 63 "Layer scattering length density"], 64 ["s olvent_sld", "1e-6/Ang^2", 6, [-inf, inf], "",64 ["sld_solvent", "1e-6/Ang^2", 6, [-inf, inf], "", 65 65 "Solvent scattering length density"], 66 66 ["radius", "Ang", 50, [0, inf], "volume", … … 72 72 return 1.333333333333333 * pi * radius ** 3 73 73 74 def Iq(q, sld, s olvent_sld, radius):74 def Iq(q, sld, sld_solvent, radius): 75 75 #print "q",q 76 #print "sld,r",sld,s olvent_sld,radius76 #print "sld,r",sld,sld_solvent,radius 77 77 qr = q * radius 78 78 sn, cn = sin(qr), cos(qr) … … 85 85 bes = 3 * (sn - qr * cn) / qr ** 3 # may be 0/0 but we fix that next line 86 86 bes[qr == 0] = 1 87 fq = bes * (sld - s olvent_sld) * form_volume(radius)87 fq = bes * (sld - sld_solvent) * form_volume(radius) 88 88 return 1.0e-4 * fq ** 2 89 89 Iq.vectorized = True # Iq accepts an array of q values 90 90 91 def Iqxy(qx, qy, sld, s olvent_sld, radius):92 return Iq(sqrt(qx ** 2 + qy ** 2), sld, s olvent_sld, radius)91 def Iqxy(qx, qy, sld, sld_solvent, radius): 92 return Iq(sqrt(qx ** 2 + qy ** 2), sld, sld_solvent, radius) 93 93 Iqxy.vectorized = True # Iqxy accepts arrays of qx, qy values 94 94 95 def sesans(z, sld, s olvent_sld, radius):95 def sesans(z, sld, sld_solvent, radius): 96 96 """ 97 97 Calculate SESANS-correlation function for a solid sphere. … … 115 115 116 116 demo = dict(scale=1, background=0, 117 sld=6, s olvent_sld=1,117 sld=6, sld_solvent=1, 118 118 radius=120, 119 119 radius_pd=.2, radius_pd_n=45) 120 120 oldname = "SphereModel" 121 oldpars = dict(sld='sldSph', s olvent_sld='sldSolv', radius='radius')121 oldpars = dict(sld='sldSph', sld_solvent='sldSolv', radius='radius') -
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"],
Note: See TracChangeset
for help on using the changeset viewer.