Changeset 485aee2 in sasmodels
- Timestamp:
- Mar 9, 2015 2:45:01 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:
- 3e428ec
- Parents:
- 5ef0633
- Location:
- sasmodels/models
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/bcc.py
r3c56da87 r485aee2 113 113 assumed to be isotropic and characterized by a Gaussian distribution. 114 114 """ 115 category ="shape:paracrystal"115 category = "shape:paracrystal" 116 116 117 parameters = [ 118 # [ "name", "units", default, [lower, upper], "type","description" ], 119 [ "dnn", "Ang", 220, [-inf,inf],"","Nearest neighbour distance"], 120 [ "d_factor", "", 0.06,[-inf,inf],"","Paracrystal distortion factor" ], 121 [ "radius", "Ang", 40, [0, inf], "volume","Particle radius" ], 122 [ "sld", "1e-6/Ang^2", 4, [-inf,inf], "", "Particle scattering length density" ], 123 [ "solvent_sld", "1e-6/Ang^2", 1, [-inf,inf], "", "Solvent scattering length density" ], 124 [ "theta", "degrees", 60, [-inf, inf], "orientation","In plane angle" ], 125 [ "phi", "degrees", 60, [-inf, inf], "orientation","Out of plane angle" ], 126 [ "psi", "degrees", 60, [-inf,inf], "orientation","Out of plane angle"] 127 ] 117 # ["name", "units", default, [lower, upper], "type","description" ], 118 parameters = [["dnn", "Ang", 220, [-inf, inf], "", "Nearest neighbour distance"], 119 ["d_factor", "", 0.06, [-inf, inf], "", "Paracrystal distortion factor"], 120 ["radius", "Ang", 40, [0, inf], "volume", "Particle radius"], 121 ["sld", "1e-6/Ang^2", 4, [-inf, inf], "", "Particle scattering length density"], 122 ["solvent_sld", "1e-6/Ang^2", 1, [-inf, inf], "", "Solvent scattering length density"], 123 ["theta", "degrees", 60, [-inf, inf], "orientation", "In plane angle"], 124 ["phi", "degrees", 60, [-inf, inf], "orientation", "Out of plane angle"], 125 ["psi", "degrees", 60, [-inf, inf], "orientation", "Out of plane angle"] 126 ] 128 127 129 source = [ "lib/J1.c", "lib/gauss150.c", "bcc.c"]128 source = ["lib/J1.c", "lib/gauss150.c", "bcc.c"] 130 129 131 130 # parameters for demo … … 143 142 # For testing against the old sasview models, include the converted parameter 144 143 # names and the target sasview model name. 145 oldname='BCCrystalModel' 146 oldpars=dict(sld='sldSph', 147 solvent_sld='sldSolv') 144 oldname = 'BCCrystalModel' 145 oldpars = dict(sld='sldSph', solvent_sld='sldSolv') -
sasmodels/models/broad_peak.py
r3c56da87 r485aee2 60 60 lorentz_exp = Lorentzian exponent 61 61 background = Incoherent background""" 62 category ="shape-independent"62 category = "shape-independent" 63 63 64 parameters = [ 65 # [ "name", "units", default, [lower, upper], "type", 66 # "description" ], 67 68 [ "porod_scale", "", 1.0e-05, [-inf,inf], "", 69 "Power law scale factor" ], 70 [ "porod_exp", "", 3.0, [-inf,inf], "", 71 "Exponent of power law" ], 72 [ "lorentz_scale", "", 10.0, [-inf,inf], "", 73 "Scale factor for broad Lorentzian peak" ], 74 [ "lorentz_length", "Ang", 50.0, [-inf, inf], "", 75 "Lorentzian screening length" ], 76 [ "peak_pos", "1/Ang", 0.1, [-inf, inf], "", 77 "Peak postion in q" ], 78 [ "lorentz_exp", "", 2.0, [-inf, inf], "", 79 "exponent of Lorentz function" ], 80 ] 81 64 # ["name", "units", default, [lower, upper], "type", "description"], 65 parameters = [["porod_scale", "", 1.0e-05, [-inf, inf], "", "Power law scale factor"], 66 ["porod_exp", "", 3.0, [-inf, inf], "", "Exponent of power law"], 67 ["lorentz_scale", "", 10.0, [-inf, inf], "", "Scale factor for broad Lorentzian peak"], 68 ["lorentz_length", "Ang", 50.0, [-inf, inf], "", "Lorentzian screening length"], 69 ["peak_pos", "1/Ang", 0.1, [-inf, inf], "", "Peak postion in q"], 70 ["lorentz_exp", "", 2.0, [-inf, inf], "", "exponent of Lorentz function"], 71 ] 82 72 83 73 def Iq(q, porod_scale, porod_exp, lorentz_scale, lorentz_length, peak_pos, lorentz_exp): 84 inten = (porod_scale /q**porod_exp + lorentz_scale85 / (1.0 + (abs(q-peak_pos)*lorentz_length)**lorentz_exp))74 inten = (porod_scale / q ** porod_exp + lorentz_scale 75 / (1.0 + (abs(q - peak_pos) * lorentz_length) ** lorentz_exp)) 86 76 return inten 87 77 Iq.vectorized = True # Iq accepts an array of Q values 88 78 89 79 def Iqxy(qx, qy, *args): 90 return Iq(sqrt(qx **2 + qy**2), *args)80 return Iq(sqrt(qx ** 2 + qy ** 2), *args) 91 81 Iqxy.vectorized = True # Iqxy accepts an array of Qx, Qy values 92 82 93 83 94 demo = dict( 95 scale=1, background=0, 96 porod_scale=1.0e-05, porod_exp=3, 97 lorentz_scale=10,lorentz_length=50, peak_pos=0.1, lorentz_exp=2, 98 ) 84 demo = dict(scale=1, background=0, 85 porod_scale=1.0e-05, porod_exp=3, 86 lorentz_scale=10, lorentz_length=50, peak_pos=0.1, lorentz_exp=2) 99 87 100 88 oldname = "BroadPeakModel" 101 89 oldpars = dict(porod_scale='scale_p', porod_exp='exponent_p', 102 lorentz_scale='scale_l', lorentz_length='length_l', peak_pos='q_peak',103 lorentz_exp='exponent_l', scale=None)90 lorentz_scale='scale_l', lorentz_length='length_l', peak_pos='q_peak', 91 lorentz_exp='exponent_l', scale=None) -
sasmodels/models/capped_cylinder.py
ra5d0d00 r485aee2 115 115 title = "Right circular cylinder with spherical end caps and uniform SLD" 116 116 description = """That is, a sphereocylinder 117 118 119 120 121 122 123 124 125 126 127 128 129 130 117 with end caps that have a radius larger than 118 that of the cylinder and the center of the 119 end cap radius lies within the cylinder. 120 Note: As the length of cylinder -->0, 121 it becomes a ConvexLens. 122 It must be that radius <(=) cap_radius. 123 [Parameters]; 124 scale: volume fraction of spheres, 125 background:incoherent background, 126 radius: radius of the cylinder, 127 length: length of the cylinder, 128 cap_radius: radius of the semi-spherical cap, 129 sld: SLD of the capped cylinder, 130 solvent_sld: SLD of the solvent. 131 131 """ 132 132 category = "shape:cylinder" 133 133 134 parameters = [ 135 # [ "name", "units", default, [lower, upper], "type", 136 # "description" ], 137 [ "sld", "1e-6/Ang^2", 4, [-inf,inf], "", 138 "Cylinder scattering length density" ], 139 [ "solvent_sld", "1e-6/Ang^2", 1, [-inf,inf], "", 140 "Solvent scattering length density" ], 141 [ "radius", "Ang", 20, [0, inf], "volume", 142 "Cylinder radius" ], 143 # TODO: use an expression for cap radius with fixed bounds. 144 # The current form requires cap radius R bigger than cylinder radius r. 145 # Could instead use R/r in [1,inf], r/R in [0,1], or the angle between 146 # cylinder and cap in [0,90]. The problem is similar for the barbell 147 # model. Propose r/R in [0,1] in both cases, with the model specifying 148 # cylinder radius in the capped cylinder model and sphere radius in the 149 # barbell model. This leads to the natural value of zero for no cap 150 # in the capped cylinder, and zero for no bar in the barbell model. In 151 # both models, one would be a pill. 152 [ "cap_radius", "Ang", 20, [0, inf], "volume", 153 "Cap radius" ], 154 [ "length", "Ang", 400, [0, inf], "volume", 155 "Cylinder length" ], 156 [ "theta", "degrees", 60, [-inf, inf], "orientation", 157 "In plane angle" ], 158 [ "phi", "degrees", 60, [-inf, inf], "orientation", 159 "Out of plane angle" ], 160 ] 134 # ["name", "units", default, [lower, upper], "type", "description"], 135 parameters = [["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", "Cylinder radius"], 140 # TODO: use an expression for cap radius with fixed bounds. 141 # The current form requires cap radius R bigger than cylinder radius r. 142 # Could instead use R/r in [1,inf], r/R in [0,1], or the angle between 143 # cylinder and cap in [0,90]. The problem is similar for the barbell 144 # model. Propose r/R in [0,1] in both cases, with the model specifying 145 # cylinder radius in the capped cylinder model and sphere radius in the 146 # barbell model. This leads to the natural value of zero for no cap 147 # in the capped cylinder, and zero for no bar in the barbell model. In 148 # both models, one would be a pill. 149 ["cap_radius", "Ang", 20, [0, inf], "volume", "Cap radius"], 150 ["length", "Ang", 400, [0, inf], "volume", "Cylinder length"], 151 ["theta", "degrees", 60, [-inf, inf], "orientation", "In plane angle"], 152 ["phi", "degrees", 60, [-inf, inf], "orientation", "Out of plane angle"], 153 ] 161 154 162 source = [ "lib/J1.c", "lib/gauss76.c", "capped_cylinder.c"]155 source = ["lib/J1.c", "lib/gauss76.c", "capped_cylinder.c"] 163 156 164 165 demo = dict( 166 scale=1, background=0, 167 sld=6, solvent_sld=1, 168 radius=260, cap_radius=290, length=290, 169 theta=30, phi=15, 170 radius_pd=.2, radius_pd_n=1, 171 cap_radius_pd=.2, cap_radius_pd_n=1, 172 length_pd=.2, length_pd_n=10, 173 theta_pd=15, theta_pd_n=45, 174 phi_pd=15, phi_pd_n=1, 175 ) 157 demo = dict(scale=1, background=0, 158 sld=6, solvent_sld=1, 159 radius=260, cap_radius=290, length=290, 160 theta=30, phi=15, 161 radius_pd=.2, radius_pd_n=1, 162 cap_radius_pd=.2, cap_radius_pd_n=1, 163 length_pd=.2, length_pd_n=10, 164 theta_pd=15, theta_pd_n=45, 165 phi_pd=15, phi_pd_n=1) 176 166 oldname = 'CappedCylinderModel' 177 167 oldpars = dict(sld='sld_capcyl', solvent_sld='sld_solv', -
sasmodels/models/core_shell_cylinder.py
ra5d0d00 r485aee2 111 111 P(q,alpha)= scale/Vs*f(q)^(2) + background, 112 112 where: f(q)= 2(core_sld - solvant_sld) 113 114 115 116 117 118 113 * Vc*sin[qLcos(alpha/2)] 114 /[qLcos(alpha/2)]*J1(qRsin(alpha)) 115 /[qRsin(alpha)]+2(shell_sld-solvent_sld) 116 *Vs*sin[q(L+T)cos(alpha/2)][[q(L+T) 117 *cos(alpha/2)]*J1(q(R+T)sin(alpha)) 118 /q(R+T)sin(alpha)] 119 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 120 alpha:is the angle between the axis of 121 the cylinder and the q-vector 122 Vs: the volume of the outer shell 123 Vc: the volume of the core 124 L: the length of the core 125 shell_sld: the scattering length density of the shell 126 solvent_sld: the scattering length density of the solvent 127 background: the background 128 T: the thickness 129 R+T: is the outer radius 130 L+2T: The total length of the outershell 131 J1: the first order Bessel function 132 theta: axis_theta of the cylinder 133 phi: the axis_phi of the cylinder 134 134 """ 135 135 category = "shape:cylinder" 136 136 137 parameters = [ 138 # [ "name", "units", default, [lower, upper], "type", 139 # "description" ], 140 [ "core_sld", "1e-6/Ang^2", 4, [-inf,inf], "", 141 "Cylinder core scattering length density" ], 142 [ "shell_sld", "1e-6/Ang^2", 4, [-inf,inf], "", 143 "Cylinder shell scattering length density" ], 144 [ "solvent_sld", "1e-6/Ang^2", 1, [-inf,inf], "", 145 "Solvent scattering length density" ], 146 [ "radius", "Ang", 20, [0, inf], "volume", 147 "Cylinder core radius" ], 148 [ "thickness", "Ang", 20, [0, inf], "volume", 149 "Cylinder shell thickness" ], 150 [ "length", "Ang", 400, [0, inf], "volume", 151 "Cylinder length" ], 152 [ "theta", "degrees", 60, [-inf, inf], "orientation", 153 "In plane angle" ], 154 [ "phi", "degrees", 60, [-inf, inf], "orientation", 155 "Out of plane angle" ], 156 ] 137 # ["name", "units", default, [lower, upper], "type", "description"], 138 parameters = [["core_sld", "1e-6/Ang^2", 4, [-inf, inf], "", 139 "Cylinder core scattering length density"], 140 ["shell_sld", "1e-6/Ang^2", 4, [-inf, inf], "", 141 "Cylinder shell scattering length density"], 142 ["solvent_sld", "1e-6/Ang^2", 1, [-inf, inf], "", 143 "Solvent scattering length density"], 144 ["radius", "Ang", 20, [0, inf], "volume", 145 "Cylinder core radius"], 146 ["thickness", "Ang", 20, [0, inf], "volume", 147 "Cylinder shell thickness"], 148 ["length", "Ang", 400, [0, inf], "volume", 149 "Cylinder length"], 150 ["theta", "degrees", 60, [-inf, inf], "orientation", 151 "In plane angle"], 152 ["phi", "degrees", 60, [-inf, inf], "orientation", 153 "Out of plane angle"], 154 ] 157 155 158 source = [ 156 source = ["lib/J1.c", "lib/gauss76.c", "core_shell_cylinder.c"] 159 157 160 158 def ER(radius, thickness, length): 161 159 radius = radius + thickness 162 length = length + 2 *thickness163 ddd = 0.75 *radius*(2*radius*length + (length+radius)*(length+pi*radius))164 return 0.5 * (ddd) **(1./3.)160 length = length + 2 * thickness 161 ddd = 0.75 * radius * (2 * radius * length + (length + radius) * (length + pi * radius)) 162 return 0.5 * (ddd) ** (1. / 3.) 165 163 166 164 def VR(radius, thickness, length): 167 whole = pi * (radius +thickness)**2 * (length+2*thickness)168 core = pi * radius **2 * length169 return whole, whole -core165 whole = pi * (radius + thickness) ** 2 * (length + 2 * thickness) 166 core = pi * radius ** 2 * length 167 return whole, whole - core 170 168 171 demo = dict( 172 scale=1, background=0, 173 core_sld=6, shell_sld=8, solvent_sld=1, 174 radius=45, thickness=25, length=340, 175 theta=30, phi=15, 176 radius_pd=.2, radius_pd_n=1, 177 length_pd=.2, length_pd_n=10, 178 thickness_pd=.2, thickness_pd_n=10, 179 theta_pd=15, theta_pd_n=45, 180 phi_pd=15, phi_pd_n=1, 181 ) 169 demo = dict(scale=1, background=0, 170 core_sld=6, shell_sld=8, solvent_sld=1, 171 radius=45, thickness=25, length=340, 172 theta=30, phi=15, 173 radius_pd=.2, radius_pd_n=1, 174 length_pd=.2, length_pd_n=10, 175 thickness_pd=.2, thickness_pd_n=10, 176 theta_pd=15, theta_pd_n=45, 177 phi_pd=15, phi_pd_n=1) 182 178 oldname = 'CoreShellCylinderModel' 183 179 oldpars = dict(theta='axis_theta', phi='axis_phi')
Note: See TracChangeset
for help on using the changeset viewer.