Changeset 3e428ec in sasmodels
- Timestamp:
- Mar 9, 2015 1:14:03 PM (10 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:
- ddfe69c
- Parents:
- 485aee2
- Location:
- sasmodels/models
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/cylinder.py
r9890053 r3e428ec 130 130 category = "shape:cylinder" 131 131 132 parameters = [ 133 # [ "name", "units", default, [lower, upper], "type", 134 # "description" ], 135 [ "sld", "1e-6/Ang^2", 4, [-inf,inf], "", 136 "Cylinder scattering length density" ], 137 [ "solvent_sld", "1e-6/Ang^2", 1, [-inf,inf], "", 138 "Solvent scattering length density" ], 139 [ "radius", "Ang", 20, [0, inf], "volume", 140 "Cylinder radius" ], 141 [ "length", "Ang", 400, [0, inf], "volume", 142 "Cylinder length" ], 143 [ "theta", "degrees", 60, [-inf, inf], "orientation", 144 "In plane angle" ], 145 [ "phi", "degrees", 60, [-inf, inf], "orientation", 146 "Out of plane angle" ], 147 ] 132 # [ "name", "units", default, [lower, upper], "type", "description"], 133 parameters = [["sld", "1e-6/Ang^2", 4, [-inf, inf], "", 134 "Cylinder scattering length density"], 135 ["solvent_sld", "1e-6/Ang^2", 1, [-inf, inf], "", 136 "Solvent scattering length density"], 137 ["radius", "Ang", 20, [0, inf], "volume", 138 "Cylinder radius"], 139 ["length", "Ang", 400, [0, inf], "volume", 140 "Cylinder length"], 141 ["theta", "degrees", 60, [-inf, inf], "orientation", 142 "In plane angle"], 143 ["phi", "degrees", 60, [-inf, inf], "orientation", 144 "Out of plane angle"], 145 ] 148 146 149 source = [ "lib/J1.c", "lib/gauss76.c", "cylinder.c"]147 source = ["lib/J1.c", "lib/gauss76.c", "cylinder.c"] 150 148 151 149 def ER(radius, length): 152 ddd = 0.75 *radius*(2*radius*length + (length+radius)*(length+pi*radius))153 return 0.5 * (ddd) **(1./3.)150 ddd = 0.75 * radius * (2 * radius * length + (length + radius) * (length + pi * radius)) 151 return 0.5 * (ddd) ** (1. / 3.) 154 152 155 153 # parameters for demo 156 demo = dict( 157 scale=1, background=0, 158 sld=6, solvent_sld=1, 159 #radius=5, length=20, 160 radius=20, length=300, 161 theta=60, phi=60, 162 radius_pd=.2, radius_pd_n=9, 163 length_pd=.2,length_pd_n=10, 164 theta_pd=10, theta_pd_n=5, 165 phi_pd=10, phi_pd_n=5, 166 ) 154 demo = dict(scale=1, background=0, 155 sld=6, solvent_sld=1, 156 radius=20, length=300, 157 theta=60, phi=60, 158 radius_pd=.2, radius_pd_n=9, 159 length_pd=.2, length_pd_n=10, 160 theta_pd=10, theta_pd_n=5, 161 phi_pd=10, phi_pd_n=5) 167 162 168 163 # For testing against the old sasview models, include the converted parameter 169 164 # names and the target sasview model name. 170 oldname ='CylinderModel'171 oldpars =dict(theta='cyl_theta', phi='cyl_phi', sld='sldCyl', solvent_sld='sldSolv')165 oldname = 'CylinderModel' 166 oldpars = dict(theta='cyl_theta', phi='cyl_phi', sld='sldCyl', solvent_sld='sldSolv') 172 167 173 168 174 qx,qy = 0.2*np.cos(2.5), 0.2*np.sin(2.5) 175 tests = [ 176 [{}, 0.2, 0.041761386790780453], 177 [{}, [0.2], [0.041761386790780453]], 178 [{'theta':10.0, 'phi':10.0}, (qx, qy), 0.03414647218513852], 179 [{'theta':10.0, 'phi':10.0}, [(qx, qy)], [0.03414647218513852]], 180 ] 181 del qx,qy # not necessary to delete, but cleaner 169 qx, qy = 0.2 * np.cos(2.5), 0.2 * np.sin(2.5) 170 tests = [[{}, 0.2, 0.041761386790780453], 171 [{}, [0.2], [0.041761386790780453]], 172 [{'theta':10.0, 'phi':10.0}, (qx, qy), 0.03414647218513852], 173 [{'theta':10.0, 'phi':10.0}, [(qx, qy)], [0.03414647218513852]], 174 ] 175 del qx, qy # not necessary to delete, but cleaner -
sasmodels/models/dab.py
ra5d0d00 r3e428ec 46 46 category = "shape-independent" 47 47 48 parameters = [ 49 # [ "name", "units", default, [lower, upper], "type", "description" ], 50 [ "length", "Ang", 50.0, [0, inf], "", "correlation length" ], 51 ] 48 # ["name", "units", default, [lower, upper], "type", "description"], 49 parameters = [["length", "Ang", 50.0, [0, inf], "", "correlation length"], 50 ] 52 51 53 52 Iq = """ … … 68 67 # VR defaults to 1.0 69 68 70 demo = dict( 71 scale=1, background=0, 72 length=50, 73 ) 69 demo = dict(scale=1, background=0, length=50) 74 70 oldname = "DABModel" 75 71 oldpars = dict(length='length') -
sasmodels/models/ellipsoid.py
r3c56da87 r3e428ec 123 123 description = """\ 124 124 P(q.alpha)= scale*f(q)^2 + background, where f(q)= 3*(sld 125 126 127 125 - solvent_sld)*V*[sin(q*r(Rp,Re,alpha)) 126 -q*r*cos(qr(Rp,Re,alpha))] 127 /[qr(Rp,Re,alpha)]^3" 128 128 129 129 r(Rp,Re,alpha)= [Re^(2)*(sin(alpha))^2 130 130 + Rp^(2)*(cos(alpha))^2]^(1/2) 131 131 132 133 134 135 136 132 sld: SLD of the ellipsoid 133 solvent_sld: SLD of the solvent 134 V: volume of the ellipsoid 135 Rp: polar radius of the ellipsoid 136 Re: equatorial radius of the ellipsoid 137 137 """ 138 138 category = "shape:ellipsoid" 139 139 140 parameters = [ 141 # [ "name", "units", default, [lower, upper], "type", 142 # "description" ], 143 [ "sld", "1e-6/Ang^2", 4, [-inf,inf], "", 144 "Ellipsoid scattering length density" ], 145 [ "solvent_sld", "1e-6/Ang^2", 1, [-inf,inf], "", 146 "Solvent scattering length density" ], 147 [ "rpolar", "Ang", 20, [0, inf], "volume", 148 "Polar radius" ], 149 [ "requatorial", "Ang", 400, [0, inf], "volume", 150 "Equatorial radius" ], 151 [ "theta", "degrees", 60, [-inf, inf], "orientation", 152 "In plane angle" ], 153 [ "phi", "degrees", 60, [-inf, inf], "orientation", 154 "Out of plane angle" ], 155 ] 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 ] 156 154 157 source = [ 155 source = ["lib/J1.c", "lib/gauss76.c", "ellipsoid.c"] 158 156 159 157 def ER(rpolar, requatorial): … … 162 160 ee = np.empty_like(rpolar) 163 161 idx = rpolar > requatorial 164 ee[idx] = (rpolar[idx] **2 - requatorial[idx]**2)/rpolar[idx]**2162 ee[idx] = (rpolar[idx] ** 2 - requatorial[idx] ** 2) / rpolar[idx] ** 2 165 163 idx = rpolar < requatorial 166 ee[idx] = (requatorial[idx] **2 - rpolar[idx]**2)/requatorial[idx]**2164 ee[idx] = (requatorial[idx] ** 2 - rpolar[idx] ** 2) / requatorial[idx] ** 2 167 165 idx = rpolar == requatorial 168 ee[idx] = 2 *rpolar[idx]169 valid = (rpolar *requatorial != 0)170 bd = 1.0 -ee[valid]166 ee[idx] = 2 * rpolar[idx] 167 valid = (rpolar * requatorial != 0) 168 bd = 1.0 - ee[valid] 171 169 e1 = np.sqrt(ee[valid]) 172 b1 = 1.0 + np.arcsin(e1) /(e1*np.sqrt(bd))173 bL = (1.0 +e1)/(1.0-e1)174 b2 = 1.0 + bd /2/e1*np.log(bL)175 delta = 0.75 *b1*b2170 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 * b2 176 174 177 175 ddd = np.zeros_like(rpolar) 178 ddd[valid] = 2.0 *(delta+1.0)*rpolar*requatorial**2179 return 0.5 *ddd**(1.0/3.0)176 ddd[valid] = 2.0 * (delta + 1.0) * rpolar * requatorial ** 2 177 return 0.5 * ddd ** (1.0 / 3.0) 180 178 181 179 182 demo = dict( 183 scale=1, background=0, 184 sld=6, solvent_sld=1, 185 rpolar=50, requatorial=30, 186 theta=30, phi=15, 187 rpolar_pd=.2, rpolar_pd_n=15, 188 requatorial_pd=.2, requatorial_pd_n=15, 189 theta_pd=15, theta_pd_n=45, 190 phi_pd=15, phi_pd_n=1, 191 ) 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) 192 188 oldname = 'EllipsoidModel' 193 189 oldpars = dict(theta='axis_theta', phi='axis_phi', -
sasmodels/models/fcc.py
r3c56da87 r3e428ec 98 98 category = "shape:paracrystal" 99 99 100 parameters = [ 101 # [ "name", "units", default, [lower, upper], "type","description" ], 102 [ "dnn", "Ang", 220, [-inf,inf],"","Nearest neighbour distance"], 103 [ "d_factor", "", 0.06,[-inf,inf],"","Paracrystal distortion factor" ], 104 [ "radius", "Ang", 40, [0, inf], "volume","Particle radius" ], 105 [ "sld", "1e-6/Ang^2", 4, [-inf,inf], "", "Particle scattering length density" ], 106 [ "solvent_sld", "1e-6/Ang^2", 1, [-inf,inf], "","Solvent scattering length density" ], 107 [ "theta", "degrees", 60, [-inf, inf], "orientation","In plane angle" ], 108 [ "phi", "degrees", 60, [-inf, inf], "orientation","Out of plane angle" ], 109 [ "psi", "degrees", 60, [-inf,inf], "orientation","Out of plane angle"] 110 ] 100 # ["name", "units", default, [lower, upper], "type","description"], 101 parameters = [["dnn", "Ang", 220, [-inf, inf], "", "Nearest neighbour distance"], 102 ["d_factor", "", 0.06, [-inf, inf], "", "Paracrystal distortion factor"], 103 ["radius", "Ang", 40, [0, inf], "volume", "Particle radius"], 104 ["sld", "1e-6/Ang^2", 4, [-inf, inf], "", "Particle scattering length density"], 105 ["solvent_sld", "1e-6/Ang^2", 1, [-inf, inf], "", "Solvent scattering length density"], 106 ["theta", "degrees", 60, [-inf, inf], "orientation", "In plane angle"], 107 ["phi", "degrees", 60, [-inf, inf], "orientation", "Out of plane angle"], 108 ["psi", "degrees", 60, [-inf, inf], "orientation", "Out of plane angle"] 109 ] 111 110 112 source = [ "lib/J1.c", "lib/gauss150.c", "fcc.c"]111 source = ["lib/J1.c", "lib/gauss150.c", "fcc.c"] 113 112 114 113 # parameters for demo 115 demo = dict( 116 scale=1, background=0, 117 dnn=220, d_factor=0.06, sld=4, solvent_sld=1, 118 radius=40, 119 theta=60, phi=60, psi=60, 120 radius_pd=.2, radius_pd_n=0.2, 121 theta_pd=15, theta_pd_n=0, 122 phi_pd=15, phi_pd_n=0, 123 psi_pd=15, psi_pd_n=0, 124 ) 114 demo = dict(scale=1, background=0, 115 dnn=220, d_factor=0.06, sld=4, solvent_sld=1, 116 radius=40, 117 theta=60, phi=60, psi=60, 118 radius_pd=.2, radius_pd_n=0.2, 119 theta_pd=15, theta_pd_n=0, 120 phi_pd=15, phi_pd_n=0, 121 psi_pd=15, psi_pd_n=0, 122 ) 125 123 126 124 # For testing against the old sasview models, include the converted parameter 127 125 # names and the target sasview model name. 128 oldname ='FCCrystalModel'129 oldpars =dict(sld='sldSph', solvent_sld='sldSolv')126 oldname = 'FCCrystalModel' 127 oldpars = dict(sld='sldSph', solvent_sld='sldSolv') -
sasmodels/models/gaussian_peak.py
r3c56da87 r3e428ec 31 31 category = "shape-independent" 32 32 33 parameters = [ 34 # [ "name", "units", default, [lower, upper], "type", 35 # "description" ], 36 [ "q0", "1/Ang", 0.05, [-inf,inf], "", 37 "Peak position" ], 38 [ "sigma", "1/Ang", 0.005, [-inf,inf], "", 39 "Peak width (standard deviation)" ], 40 ] 41 33 # ["name", "units", default, [lower, upper], "type","description"], 34 parameters = [["q0", "1/Ang", 0.05, [-inf, inf], "", "Peak position"], 35 ["sigma", "1/Ang", 0.005, [-inf, inf], "", 36 "Peak width (standard deviation)"], 37 ] 42 38 43 39 # No volume normalization despite having a volume parameter … … 61 57 # VR defaults to 1.0 62 58 63 demo = dict( 64 scale=1, background=0, 65 q0 = 0.05, sigma = 0.005, 66 ) 59 demo = dict(scale=1, background=0, q0=0.05, sigma=0.005) 67 60 oldname = "PeakGaussModel" 68 61 oldpars = dict(sigma='B') -
sasmodels/models/hardsphere.py
r3c56da87 r3e428ec 37 37 title = "Hard sphere structure factor, with Percus-Yevick closure" 38 38 description = """\ 39 39 [Hard sphere structure factor, with Percus-Yevick closure] 40 40 Interparticle S(Q) for random, non-interacting spheres. 41 42 43 systems. Though strictly the maths needs to be modified - 44 45 46 41 May be a reasonable approximation for other shapes of 42 particles that freely rotate, and for moderately polydisperse 43 systems. Though strictly the maths needs to be modified - 44 which sasview does not do yet. 45 effect_radius is the hard sphere radius 46 volfraction is the volume fraction occupied by the spheres. 47 47 """ 48 48 category = "structure-factor" 49 49 50 parameters = [ 51 # [ "name", "units", default, [lower, upper], "type", 52 # "description" ], 53 [ "effect_radius", "Ang", 50.0, [0, inf], "volume", 54 "effective radius of hard sphere" ], 55 [ "volfraction", "", 0.2, [0, 0.74], "", 56 "volume fraction of hard spheres" ], 57 ] 50 # ["name", "units", default, [lower, upper], "type","description"], 51 parameters = [["effect_radius", "Ang", 50.0, [0, inf], "volume", 52 "effective radius of hard sphere"], 53 ["volfraction", "", 0.2, [0, 0.74], "", 54 "volume fraction of hard spheres"], 55 ] 58 56 59 57 # No volume normalization despite having a volume parameter … … 64 62 65 63 Iq = """ 66 67 68 69 70 71 72 73 74 75 76 77 78 // 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 64 double denom,dnum,alpha,beta,gamm,a,asq,ath,afor,rca,rsa; 65 double calp,cbeta,cgam,prefac,c,vstruc; 66 double struc; 67 68 // compute constants 69 denom = pow((1.0-volfraction),4); 70 dnum = pow((1.0 + 2.0*volfraction),2); 71 alpha = dnum/denom; 72 beta = -6.0*volfraction*pow((1.0 + volfraction/2.0),2)/denom; 73 gamm = 0.50*volfraction*dnum/denom; 74 // 75 // calculate the structure factor 76 // 77 a = 2.0*q*effect_radius; 78 asq = a*a; 79 ath = asq*a; 80 afor = ath*a; 81 SINCOS(a,rsa,rca); 82 //rca = cos(a); 83 //rsa = sin(a); 84 calp = alpha*(rsa/asq - rca/a); 85 cbeta = beta*(2.0*rsa/asq - (asq - 2.0)*rca/ath - 2.0/ath); 86 cgam = gamm*(-rca/a + (4.0/a)*((3.0*asq - 6.0)*rca/afor + (asq - 6.0)*rsa/ath + 6.0/afor)); 87 prefac = -24.0*volfraction/a; 88 c = prefac*(calp + cbeta + cgam); 89 vstruc = 1.0/(1.0-c); 90 struc = vstruc; 91 92 return(struc); 95 93 """ 96 94 … … 103 101 # VR defaults to 1.0 104 102 105 demo = dict(effect_radius = 200,volfraction = 0.2,effect_radius_pd = 0.1,effect_radius_pd_n =40)103 demo = dict(effect_radius=200, volfraction=0.2, effect_radius_pd=0.1, effect_radius_pd_n=40) 106 104 oldname = 'HardsphereStructure' 107 105 oldpars = dict() -
sasmodels/models/lamellar.py
r3c56da87 r3e428ec 52 52 title = "Lyotropic lamellar phase with uniform SLD and random distribution" 53 53 description = """\ 54 55 56 57 58 59 60 61 54 [Dilute Lamellar Form Factor](from a lyotropic lamellar phase) 55 I(q)= 2*pi*P(q)/(delta *q^(2)), where 56 P(q)=2*(contrast/q)^(2)*(1-cos(q*delta))^(2)) 57 thickness = layer thickness 58 sld = layer scattering length density 59 sld_solvent = solvent scattering length density 60 background = incoherent background 61 scale = scale factor 62 62 """ 63 63 category = "shape:lamellae" 64 64 65 parameters = [ 66 # [ "name", "units", default, [lower, upper], "type", 67 # "description" ], 68 [ "sld", "1e-6/Ang^2", 1, [-inf,inf], "", 69 "Layer scattering length density" ], 70 [ "solvent_sld", "1e-6/Ang^2", 6, [-inf,inf], "", 71 "Solvent scattering length density" ], 72 [ "thickness", "Ang", 50, [0, inf], "volume", 73 "Bilayer thickness" ], 74 ] 65 # ["name", "units", default, [lower, upper], "type","description"], 66 parameters = [["sld", "1e-6/Ang^2", 1, [-inf, inf], "", 67 "Layer scattering length density" ], 68 ["solvent_sld", "1e-6/Ang^2", 6, [-inf, inf], "", 69 "Solvent scattering length density" ], 70 ["thickness", "Ang", 50, [0, inf], "volume","Bilayer thickness" ], 71 ] 75 72 76 73 … … 95 92 # VR defaults to 1.0 96 93 97 demo = dict( 98 scale=1, background=0, 99 sld=6, solvent_sld=1, 100 thickness=40, 101 thickness_pd= 0.2, thickness_pd_n=40, 102 ) 94 demo = dict(scale=1, background=0, 95 sld=6, solvent_sld=1, 96 thickness=40, 97 thickness_pd=0.2, thickness_pd_n=40) 103 98 oldname = 'LamellarModel' 104 99 oldpars = dict(sld='sld_bi', solvent_sld='sld_sol', thickness='bi_thick') -
sasmodels/models/lamellarCaille.py
r3c56da87 r3e428ec 85 85 category = "shape:lamellae" 86 86 87 parameters = [ 88 # [ "name", "units", default, [lower, upper], "type", 89 # "description" ], 90 [ "thickness", "Ang", 30.0, [0, inf], "volume", 91 "sheet thickness" ], 92 [ "Nlayers", "", 20, [0, inf], "", 93 "Number of layers" ], 94 [ "spacing", "Ang", 400., [0.0,inf], "volume", 95 "d-spacing of Caille S(Q)" ], 96 [ "Caille_parameter", "1/Ang^2", 0.1, [0.0,0.8], "", 97 "Caille parameter" ], 98 [ "sld", "1e-6/Ang^2", 6.3, [-inf,inf], "", 99 "layer scattering length density" ], 100 [ "solvent_sld", "1e-6/Ang^2", 1.0, [-inf,inf], "", 101 "Solvent scattering length density" ], 102 ] 87 # ["name", "units", default, [lower, upper], "type","description"], 88 parameters = [["thickness", "Ang", 30.0, [0, inf], "volume", "sheet thickness"], 89 ["Nlayers", "", 20, [0, inf], "", "Number of layers"], 90 ["spacing", "Ang", 400., [0.0,inf], "volume", "d-spacing of Caille S(Q)"], 91 ["Caille_parameter", "1/Ang^2", 0.1, [0.0,0.8], "", "Caille parameter"], 92 ["sld", "1e-6/Ang^2", 6.3, [-inf,inf], "", 93 "layer scattering length density"], 94 ["solvent_sld", "1e-6/Ang^2", 1.0, [-inf,inf], "", 95 "Solvent scattering length density"], 96 ] 103 97 104 source = [ 98 source = ["lamellarCaille_kernel.c"] 105 99 106 100 # No volume normalization despite having a volume parameter … … 117 111 # VR defaults to 1.0 118 112 119 demo = dict( 120 scale=1, background=0, 121 thickness=67.,Nlayers=3.75,spacing=200., 122 Caille_parameter=0.268,sld=1.0, solvent_sld=6.34, 123 thickness_pd= 0.1, thickness_pd_n=100, 124 spacing_pd= 0.05, spacing_pd_n=40 125 ) 113 demo = dict(scale=1, background=0, 114 thickness=67.,Nlayers=3.75,spacing=200., 115 Caille_parameter=0.268,sld=1.0, solvent_sld=6.34, 116 thickness_pd= 0.1, thickness_pd_n=100, 117 spacing_pd= 0.05, spacing_pd_n=40) 126 118 127 119 oldname = 'LamellarPSModel' 128 oldpars = dict(thickness='delta',Nlayers='N_plates',Caille_parameter='caille', sld='sld_bi',solvent_sld='sld_sol') 120 oldpars = dict(thickness='delta', Nlayers='N_plates', Caille_parameter='caille', 121 sld='sld_bi',solvent_sld='sld_sol') -
sasmodels/models/lamellarCailleHG.py
r3c56da87 r3e428ec 79 79 title = "Random lamellar sheet with Caille structure factor" 80 80 description = """\ 81 81 [Random lamellar phase with Caille structure factor] 82 82 randomly oriented stacks of infinite sheets 83 84 85 86 87 88 89 83 with Caille S(Q), having polydisperse spacing. 84 layer thickness =(H+T+T+H) = 2(Head+Tail) 85 sld = Tail scattering length density 86 sld_head = Head scattering length density 87 sld_solvent = solvent scattering length density 88 background = incoherent background 89 scale = scale factor 90 90 """ 91 91 category = "shape:lamellae" 92 92 93 93 parameters = [ 94 # [ "name", "units", default, [lower, upper], "type",95 # "description" ],96 [ "tail_length", "Ang", 10, [0, inf], "volume",97 "Tail thickness" ],98 [ "head_length", "Ang", 2, [0, inf], "volume",99 "head thickness" ],100 [ "Nlayers", "", 30, [0, inf], "",101 "Number of layers" ],102 [ "spacing", "Ang", 40., [0.0,inf], "volume",103 "d-spacing of Caille S(Q)" ],104 [ "Caille_parameter", "", 0.001, [0.0,0.8], "",105 "Caille parameter" ],106 [ "sld", "1e-6/Ang^2", 0.4, [-inf,inf], "",107 "Tail scattering length density" ],108 [ "head_sld", "1e-6/Ang^2", 2.0, [-inf,inf], "",109 "Head scattering length density" ],110 [ "solvent_sld", "1e-6/Ang^2", 6, [-inf,inf], "",111 "Solvent scattering length density" ],94 # [ "name", "units", default, [lower, upper], "type", 95 # "description" ], 96 [ "tail_length", "Ang", 10, [0, inf], "volume", 97 "Tail thickness" ], 98 [ "head_length", "Ang", 2, [0, inf], "volume", 99 "head thickness" ], 100 [ "Nlayers", "", 30, [0, inf], "", 101 "Number of layers" ], 102 [ "spacing", "Ang", 40., [0.0,inf], "volume", 103 "d-spacing of Caille S(Q)" ], 104 [ "Caille_parameter", "", 0.001, [0.0,0.8], "", 105 "Caille parameter" ], 106 [ "sld", "1e-6/Ang^2", 0.4, [-inf,inf], "", 107 "Tail scattering length density" ], 108 [ "head_sld", "1e-6/Ang^2", 2.0, [-inf,inf], "", 109 "Head scattering length density" ], 110 [ "solvent_sld", "1e-6/Ang^2", 6, [-inf,inf], "", 111 "Solvent scattering length density" ], 112 112 ] 113 113 … … 128 128 129 129 demo = dict( 130 scale=1, background=0,131 Nlayers=20,132 spacing=200., Caille_parameter=0.05,133 tail_length=15,head_length=10,134 #sld=-1, head_sld=4.0, solvent_sld=6.0,135 sld=-1, head_sld=4.1, solvent_sld=6.0,136 tail_length_pd= 0.1, tail_length_pd_n=20,137 head_length_pd= 0.05, head_length_pd_n=30,138 spacing_pd= 0.2, spacing_pd_n=40139 )130 scale=1, background=0, 131 Nlayers=20, 132 spacing=200., Caille_parameter=0.05, 133 tail_length=15,head_length=10, 134 #sld=-1, head_sld=4.0, solvent_sld=6.0, 135 sld=-1, head_sld=4.1, solvent_sld=6.0, 136 tail_length_pd= 0.1, tail_length_pd_n=20, 137 head_length_pd= 0.05, head_length_pd_n=30, 138 spacing_pd= 0.2, spacing_pd_n=40 139 ) 140 140 141 141 oldname = 'LamellarPSHGModel' -
sasmodels/models/lamellarFFHG.py
r3c56da87 r3e428ec 53 53 title = "Random lamellar phase with Head Groups " 54 54 description = """\ 55 56 57 58 59 60 61 62 63 55 [Random lamellar phase with Head Groups] 56 I(q)= 2*pi*P(q)/(2(H+T)*q^(2)), where 57 P(q)= see manual 58 layer thickness =(H+T+T+H) = 2(Head+Tail) 59 sld = Tail scattering length density 60 sld_head = Head scattering length density 61 sld_solvent = solvent scattering length density 62 background = incoherent background 63 scale = scale factor 64 64 """ 65 65 category = "shape:lamellae" 66 66 67 parameters = [ 68 # [ "name", "units", default, [lower, upper], "type", 69 # "description" ], 70 [ "tail_length", "Ang", 15, [0, inf], "volume", 71 "Tail thickness" ], 72 [ "head_length", "Ang", 10, [0, inf], "volume", 73 "head thickness" ], 74 [ "sld", "1e-6/Ang^2", 0.4, [-inf,inf], "", 75 "Tail scattering length density" ], 76 [ "head_sld", "1e-6/Ang^2", 3.0, [-inf,inf], "", 77 "Head scattering length density" ], 78 [ "solvent_sld", "1e-6/Ang^2", 6, [-inf,inf], "", 79 "Solvent scattering length density" ], 80 ] 67 # ["name", "units", default, [lower, upper], "type","description"], 68 parameters = [["tail_length", "Ang", 15, [0, inf], "volume", 69 "Tail thickness"], 70 ["head_length", "Ang", 10, [0, inf], "volume", 71 "head thickness"], 72 ["sld", "1e-6/Ang^2", 0.4, [-inf,inf], "", 73 "Tail scattering length density"], 74 ["head_sld", "1e-6/Ang^2", 3.0, [-inf,inf], "", 75 "Head scattering length density"], 76 ["solvent_sld", "1e-6/Ang^2", 6, [-inf,inf], "", 77 "Solvent scattering length density"], 78 ] 81 79 82 80 # No volume normalization despite having a volume parameter … … 111 109 # VR defaults to 1.0 112 110 113 demo = dict( 114 scale=1, background=0, 115 tail_length=15,head_length=10, 116 sld=0.4, head_sld=3.0, solvent_sld=6.0, 117 tail_length_pd= 0.2, tail_length_pd_n=40, 118 head_length_pd= 0.01, head_length_pd_n=40, 119 ) 111 demo = dict(scale=1, background=0, 112 tail_length=15,head_length=10, 113 sld=0.4, head_sld=3.0, solvent_sld=6.0, 114 tail_length_pd= 0.2, tail_length_pd_n=40, 115 head_length_pd= 0.01, head_length_pd_n=40) 120 116 121 117 oldname = 'LamellarFFHGModel' -
sasmodels/models/lamellarPC.py
r3c56da87 r3e428ec 72 72 title = "Random lamellar sheet with paracrystal structure factor" 73 73 description = """\ 74 74 [Random lamellar phase with paracrystal structure factor] 75 75 randomly oriented stacks of infinite sheets 76 77 78 79 80 76 with paracrytal S(Q), having polydisperse spacing. 77 sld = sheet scattering length density 78 sld_solvent = solvent scattering length density 79 background = incoherent background 80 scale = scale factor 81 81 """ 82 82 category = "shape:lamellae" 83 83 84 parameters = [ 85 # [ "name", "units", default, [lower, upper], "type", 86 # "description" ], 87 [ "thickness", "Ang", 33.0, [0, inf], "volume", 88 "sheet thickness" ], 89 [ "Nlayers", "", 20, [0, inf], "", 90 "Number of layers" ], 91 [ "spacing", "Ang", 250., [0.0,inf], "", 92 "d-spacing of paracrystal stack" ], 93 [ "spacing_polydisp", "Ang", 0.0, [0.0,inf], "", 94 "d-spacing of paracrystal stack" ], 95 [ "sld", "1e-6/Ang^2", 1.0, [-inf,inf], "", 96 "layer scattering length density" ], 97 [ "solvent_sld", "1e-6/Ang^2", 6.34, [-inf,inf], "", 98 "Solvent scattering length density" ], 99 ] 84 # ["name", "units", default, [lower, upper], "type","description"], 85 parameters = [["thickness", "Ang", 33.0, [0, inf], "volume", 86 "sheet thickness"], 87 ["Nlayers", "", 20, [0, inf], "", 88 "Number of layers"], 89 ["spacing", "Ang", 250., [0.0, inf], "", 90 "d-spacing of paracrystal stack"], 91 ["spacing_polydisp", "Ang", 0.0, [0.0, inf], "", 92 "d-spacing of paracrystal stack"], 93 ["sld", "1e-6/Ang^2", 1.0, [-inf, inf], "", 94 "layer scattering length density"], 95 ["solvent_sld", "1e-6/Ang^2", 6.34, [-inf, inf], "", 96 "Solvent scattering length density"], 97 ] 100 98 101 99 102 source = [ 100 source = ["lamellarPC_kernel.c"] 103 101 104 102 form_volume = """ … … 113 111 # VR defaults to 1.0 114 112 115 demo = dict( 116 scale=1, background=0, 117 thickness=33, Nlayers=20, spacing=250, spacing_polydisp=0.2, 118 sld=1.0, solvent_sld=6.34, 119 thickness_pd= 0.2, thickness_pd_n=40 120 ) 113 demo = dict(scale=1, background=0, 114 thickness=33, Nlayers=20, spacing=250, spacing_polydisp=0.2, 115 sld=1.0, solvent_sld=6.34, 116 thickness_pd=0.2, thickness_pd_n=40) 121 117 122 118 oldname = 'LamellarPCrystalModel' 123 oldpars = dict( 124 spacing_polydisp='pd_spacing', sld='sld_layer', 125 solvent_sld='sld_solvent' 126 ) 127 128 119 oldpars = dict(spacing_polydisp='pd_spacing', sld='sld_layer', 120 solvent_sld='sld_solvent') -
sasmodels/models/parallelepiped.py
r33e91b1 r3e428ec 116 116 category = "shape:parallelpiped" 117 117 118 parameters = [ 119 # [ "name", "units", default, [lower, upper], "type", 120 # "description" ], 121 ["sld", "1e-6/Ang^2", 4, [-inf, inf], "", 122 "Parallelepiped scattering length density"], 123 ["solvent_sld", "1e-6/Ang^2", 1, [-inf, inf], "", 124 "Solvent scattering length density"], 125 ["a_side", "Ang", 35, [0, inf], "volume", 126 "Shorter side of the parallelepiped"], 127 ["b_side", "Ang", 75, [0, inf], "volume", 128 "Second side of the parallelepiped"], 129 ["c_side", "Ang", 400, [0, inf], "volume", 130 "Larger side of the parallelepiped"], 131 ["theta", "degrees", 60, [-inf, inf], "orientation", 132 "In plane angle"], 133 ["phi", "degrees", 60, [-inf, inf], "orientation", 134 "Out of plane angle"], 135 ["psi", "degrees", 60, [-inf, inf], "orientation", 136 "Rotation angle around its own c axis against q plane"], 137 ] 118 # ["name", "units", default, [lower, upper], "type","description"], 119 parameters = [["sld", "1e-6/Ang^2", 4, [-inf, inf], "", 120 "Parallelepiped scattering length density"], 121 ["solvent_sld", "1e-6/Ang^2", 1, [-inf, inf], "", 122 "Solvent scattering length density"], 123 ["a_side", "Ang", 35, [0, inf], "volume", 124 "Shorter side of the parallelepiped"], 125 ["b_side", "Ang", 75, [0, inf], "volume", 126 "Second side of the parallelepiped"], 127 ["c_side", "Ang", 400, [0, inf], "volume", 128 "Larger side of the parallelepiped"], 129 ["theta", "degrees", 60, [-inf, inf], "orientation", 130 "In plane angle"], 131 ["phi", "degrees", 60, [-inf, inf], "orientation", 132 "Out of plane angle"], 133 ["psi", "degrees", 60, [-inf, inf], "orientation", 134 "Rotation angle around its own c axis against q plane"], 135 ] 138 136 139 137 source = ["lib/J1.c", "lib/gauss76.c", "parallelepiped.c"] … … 154 152 155 153 # parameters for demo 156 demo = dict( 157 scale=1, background=0, 158 sld=6.3e-6, solvent_sld=1.0e-6, 159 a_side=35, b_side=75, c_side=400, 160 theta=45, phi=30, psi=15, 161 a_side_pd=0.1, a_side_pd_n=10, 162 b_side_pd=0.1, b_side_pd_n=1, 163 c_side_pd=0.1, c_side_pd_n=10, 164 theta_pd=10, theta_pd_n=1, 165 phi_pd=10, phi_pd_n=1, 166 psi_pd=10, psi_pd_n=10, 167 ) 154 demo = dict(scale=1, background=0, 155 sld=6.3e-6, solvent_sld=1.0e-6, 156 a_side=35, b_side=75, c_side=400, 157 theta=45, phi=30, psi=15, 158 a_side_pd=0.1, a_side_pd_n=10, 159 b_side_pd=0.1, b_side_pd_n=1, 160 c_side_pd=0.1, c_side_pd_n=10, 161 theta_pd=10, theta_pd_n=1, 162 phi_pd=10, phi_pd_n=1, 163 psi_pd=10, psi_pd_n=10) 168 164 169 165 # For testing against the old sasview models, include the converted parameter -
sasmodels/models/sphere.py
r3c56da87 r3e428ec 72 72 category = "shape:sphere" 73 73 74 parameters = [ 75 # [ "name", "units", default, [lower, upper], "type", 76 # "description" ], 77 [ "sld", "1e-6/Ang^2", 1, [-inf,inf], "", 78 "Layer scattering length density" ], 79 [ "solvent_sld", "1e-6/Ang^2", 6, [-inf,inf], "", 80 "Solvent scattering length density" ], 81 [ "radius", "Ang", 50, [0, inf], "volume", 82 "Sphere radius" ], 83 ] 74 # ["name", "units", default, [lower, upper], "type","description"], 75 parameters = [["sld", "1e-6/Ang^2", 1, [-inf, inf], "", 76 "Layer scattering length density"], 77 ["solvent_sld", "1e-6/Ang^2", 6, [-inf, inf], "", 78 "Solvent scattering length density"], 79 ["radius", "Ang", 50, [0, inf], "volume", 80 "Sphere radius"], 81 ] 84 82 85 83 … … 111 109 # VR defaults to 1.0 112 110 113 demo = dict( 114 scale=1, background=0, 115 sld=6, solvent_sld=1, 116 radius=120, 117 radius_pd=.2, radius_pd_n=45, 118 ) 111 demo = dict(scale=1, background=0, 112 sld=6, solvent_sld=1, 113 radius=120, 114 radius_pd=.2, radius_pd_n=45) 119 115 oldname = "SphereModel" 120 116 oldpars = dict(sld='sldSph', solvent_sld='sldSolv', radius='radius') -
sasmodels/models/spherepy.py
r3c56da87 r3e428ec 73 73 category = "shape:sphere" 74 74 75 parameters = [ 76 # [ "name", "units", default, [lower, upper], "type", 77 # "description" ], 78 [ "sld", "1e-6/Ang^2", 1, [-inf,inf], "", 79 "Layer scattering length density" ], 80 [ "solvent_sld", "1e-6/Ang^2", 6, [-inf,inf], "", 81 "Solvent scattering length density" ], 82 [ "radius", "Ang", 50, [0, inf], "volume", 83 "Sphere radius" ], 84 ] 75 # ["name", "units", default, [lower, upper], "type","description"], 76 parameters = [["sld", "1e-6/Ang^2", 1, [-inf, inf], "", 77 "Layer scattering length density"], 78 ["solvent_sld", "1e-6/Ang^2", 6, [-inf, inf], "", 79 "Solvent scattering length density"], 80 ["radius", "Ang", 50, [0, inf], "volume", 81 "Sphere radius"], 82 ] 85 83 86 84 87 85 def form_volume(radius): 88 return 1.333333333333333 *pi*radius**386 return 1.333333333333333 * pi * radius ** 3 89 87 90 88 def Iq(q, sld, solvent_sld, radius): 91 89 #print "q",q 92 90 #print "sld,r",sld,solvent_sld,radius 93 qr = q *radius91 qr = q * radius 94 92 sn, cn = sin(qr), cos(qr) 95 93 # FOR VECTORIZED VERSION, UNCOMMENT THE NEXT TWO LINES 96 bes = 3 * (sn -qr*cn)/qr**3 # may be 0/0 but we fix that next line97 bes[qr ==0] = 194 bes = 3 * (sn - qr * cn) / qr ** 3 # may be 0/0 but we fix that next line 95 bes[qr == 0] = 1 98 96 # FOR NON VECTORIZED VERSION, UNCOMMENT THE NEXT LINE 99 97 #bes = 3 * (sn-qr*cn)/qr**3 if qr>0 else 1 100 98 fq = bes * (sld - solvent_sld) * form_volume(radius) 101 return 1.0e-4 *fq**299 return 1.0e-4 * fq ** 2 102 100 # FOR VECTORIZED VERSION, UNCOMMENT THE NEXT LINE 103 101 Iq.vectorized = True 104 102 105 103 def Iqxy(qx, qy, sld, solvent_sld, radius): 106 return Iq(sqrt(qx **2 + qy**2), sld, solvent_sld, radius)104 return Iq(sqrt(qx ** 2 + qy ** 2), sld, solvent_sld, radius) 107 105 Iqxy.vectorized = True 108 106 … … 113 111 Wim Bouwman after formulae Timofei Kruglov J.Appl.Cryst. 2003 article 114 112 """ 115 d = z /radius113 d = z / radius 116 114 g = np.zeros_like(z) 117 g[d ==0] = 1.115 g[d == 0] = 1. 118 116 low = ((d > 0) & (d < 2)) 119 117 dlow = d[low] 120 dlow2 = dlow **2121 g[low] = sqrt(1 -dlow2/4.)*(1+dlow2/8.) + dlow2/2.*(1-dlow2/16.)*log(dlow/(2.+sqrt(4.-dlow2)))118 dlow2 = dlow ** 2 119 g[low] = sqrt(1 - dlow2 / 4.) * (1 + dlow2 / 8.) + dlow2 / 2.*(1 - dlow2 / 16.) * log(dlow / (2. + sqrt(4. - dlow2))) 122 120 return g 123 121 sesans.vectorized = True … … 128 126 # VR defaults to 1.0 129 127 130 demo = dict( 131 scale=1, background=0, 132 sld=6, solvent_sld=1, 133 radius=120, 134 radius_pd=.2, radius_pd_n=45, 135 ) 128 demo = dict(scale=1, background=0, 129 sld=6, solvent_sld=1, 130 radius=120, 131 radius_pd=.2, radius_pd_n=45) 136 132 oldname = "SphereModel" 137 133 oldpars = dict(sld='sldSph', solvent_sld='sldSolv', radius='radius') -
sasmodels/models/stickyhardsphere.py
r3c56da87 r3e428ec 76 76 title = "Sticky hard sphere structure factor, with Percus-Yevick closure" 77 77 description = """\ 78 78 [Sticky hard sphere structure factor, with Percus-Yevick closure] 79 79 Interparticle structure factor S(Q)for a hard sphere fluid with 80 81 82 83 80 a narrow attractive well. Fits are prone to deliver non-physical 81 parameters, use with care and read the references in the full manual. 82 In sasview the effective radius will be calculated from the 83 parameters used in P(Q). 84 84 """ 85 85 category = "structure-factor" 86 86 87 # ["name", "units", default, [lower, upper], "type","description"], 87 88 parameters = [ 88 89 # [ "name", "units", default, [lower, upper], "type", … … 126 127 if(radic<0) { 127 128 //if(x>0.01 && x<0.015) 128 // 129 // Print "Lambda unphysical - both roots imaginary" 129 130 //endif 130 131 return(-1.0); -
sasmodels/models/triaxial_ellipsoid.py
r3c56da87 r3e428ec 102 102 category = "shape:ellipsoid" 103 103 104 parameters = [ 105 # [ "name", "units", default, [lower, upper], "type", 106 # "description" ], 107 [ "sld", "1e-6/Ang^2", 4, [-inf,inf], "", 108 "Ellipsoid scattering length density" ], 109 [ "solvent_sld", "1e-6/Ang^2", 1, [-inf,inf], "", 110 "Solvent scattering length density" ], 111 [ "req_minor", "Ang", 20, [0, inf], "volume", 112 "Minor equitorial radius" ], 113 [ "req_major", "Ang", 400, [0, inf], "volume", 114 "Major equatorial radius" ], 115 [ "rpolar", "Ang", 10, [0, inf], "volume", 116 "Polar radius" ], 117 [ "theta", "degrees", 60, [-inf, inf], "orientation", 118 "In plane angle" ], 119 [ "phi", "degrees", 60, [-inf, inf], "orientation", 120 "Out of plane angle" ], 121 [ "psi", "degrees", 60, [-inf, inf], "orientation", 122 "Out of plane angle" ], 123 ] 104 # ["name", "units", default, [lower, upper], "type","description"], 105 parameters = [["sld", "1e-6/Ang^2", 4, [-inf, inf], "", 106 "Ellipsoid scattering length density"], 107 ["solvent_sld", "1e-6/Ang^2", 1, [-inf, inf], "", 108 "Solvent scattering length density"], 109 ["req_minor", "Ang", 20, [0, inf], "volume", 110 "Minor equitorial radius"], 111 ["req_major", "Ang", 400, [0, inf], "volume", 112 "Major equatorial radius"], 113 ["rpolar", "Ang", 10, [0, inf], "volume", 114 "Polar radius"], 115 ["theta", "degrees", 60, [-inf, inf], "orientation", 116 "In plane angle"], 117 ["phi", "degrees", 60, [-inf, inf], "orientation", 118 "Out of plane angle"], 119 ["psi", "degrees", 60, [-inf, inf], "orientation", 120 "Out of plane angle"], 121 ] 124 122 125 source = [ 123 source = ["lib/J1.c", "lib/gauss76.c", "triaxial_ellipsoid.c"] 126 124 127 125 def ER(req_minor, req_major, rpolar): 128 126 import numpy as np 129 127 from .ellipsoid import ER as ellipsoid_ER 130 return ellipsoid_ER(rpolar, np.sqrt(req_minor *req_major))128 return ellipsoid_ER(rpolar, np.sqrt(req_minor * req_major)) 131 129 132 demo = dict( 133 scale=1, background=0, 134 sld=6, solvent_sld=1, 135 theta=30, phi=15, psi=5, 136 req_minor=25, req_major=36, rpolar=50, 137 req_minor_pd=0, req_minor_pd_n=1, 138 req_major_pd=0, req_major_pd_n=1, 139 rpolar_pd=.2, rpolar_pd_n=30, 140 theta_pd=15, theta_pd_n=45, 141 phi_pd=15, phi_pd_n=1, 142 psi_pd=15, psi_pd_n=1, 143 ) 130 demo = dict(scale=1, background=0, 131 sld=6, solvent_sld=1, 132 theta=30, phi=15, psi=5, 133 req_minor=25, req_major=36, rpolar=50, 134 req_minor_pd=0, req_minor_pd_n=1, 135 req_major_pd=0, req_major_pd_n=1, 136 rpolar_pd=.2, rpolar_pd_n=30, 137 theta_pd=15, theta_pd_n=45, 138 phi_pd=15, phi_pd_n=1, 139 psi_pd=15, psi_pd_n=1) 144 140 oldname = 'TriaxialEllipsoidModel' 145 141 oldpars = dict(theta='axis_theta', phi='axis_phi', psi='axis_psi', 146 sld='sldEll', 142 sld='sldEll', solvent_sld='sldSolv', 147 143 req_minor='semi_axisA', req_major='semi_axisB', 148 144 rpolar='semi_axisC')
Note: See TracChangeset
for help on using the changeset viewer.