Changeset 6f0e04f in sasmodels
- Timestamp:
- Mar 30, 2016 5:14:38 PM (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:
- 204fd9b
- Parents:
- b7172bb
- Location:
- sasmodels/models
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/core_multi_shell.py
rb274bec r6f0e04f 89 89 parameters = [["volfraction", "", 0.05, [0,1],"", 90 90 "volume fraction of spheres"], 91 ["sld ", "1e-6/Ang^2", 1.0, [-inf, inf], "",91 ["sld_core", "1e-6/Ang^2", 1.0, [-inf, inf], "", 92 92 "Core scattering length density"], 93 ["radius", "Ang", 200., [0, inf], " ",93 ["radius", "Ang", 200., [0, inf], "volume", 94 94 "Radius of the core"], 95 95 ["sld_solvent", "1e-6/Ang^2", 6.4, [-inf, inf], "", … … 97 97 ["n", "", 1, [0, 10], "volume", 98 98 "number of shells"], 99 ["sld _shell[n]", "1e-6/Ang^2", 1.7, [-inf, inf], "",99 ["sld[n]", "1e-6/Ang^2", 1.7, [-inf, inf], "", 100 100 "scattering length density of shell k"], 101 ["thick _shell[n]", "Ang", 40., [0, inf], "volume",101 ["thickness[n]", "Ang", 40., [0, inf], "volume", 102 102 "Thickness of shell k"], 103 103 ] … … 112 112 113 113 114 def shape(core_sld, core_radius, solvent_sld, n, in_sld, out_sld, thickness, A):114 def profile(volfraction, sld_core, radius, sld_solvent, n, sld, thickness): 115 115 """ 116 116 SLD profile … … 153 153 # cut an the onion. Seems like we should be consistant? 154 154 155 total_radius = 1.25*(sum(thickness[:n]) + core_radius + 1) 156 dr = total_radius/400 # 400 points for a smooth plot 155 total_radius = 1.25*(sum(thickness[:n]) + radius + 1) 157 156 158 157 r = [] … … 170 169 r0 = r[-1] 171 170 r.append(r0) 172 beta.append(sld _shell[k])171 beta.append(sld[k]) 173 172 r.append(r0 + thickness[k]) 174 beta.append(sld _shell[k])173 beta.append(sld[k]) 175 174 # add in the solvent 176 175 r.append(r[-1]) 177 beta.append(s olvent_sld)176 beta.append(sld_solvent) 178 177 r.append(total_radius) 179 beta.append(s olvent_sld)178 beta.append(sld_solvent) 180 179 181 180 return np.asarray(r), np.asarray(beta) 182 181 183 def ER(radius, n, thick_shell): 184 return np.sum(thick_shell[:n], axis=0) + core_radius 182 def ER(radius, n, thickness): 183 n = n[0] # n cannot be polydisperse 184 return np.sum(thickness[:n], axis=0) + radius 185 185 186 186 def VR(radius, n, thick_shell): 187 return 1.0 188 189 parameters = [["volfraction", "", 0.05, [0,1],"", 190 "volume fraction of spheres"], 191 ["sld", "1e-6/Ang^2", 1.0, [-inf, inf], "", 192 "Core scattering length density"], 193 ["radius", "Ang", 200., [0, inf], "", 194 "Radius of the core"], 195 ["sld_solvent", "1e-6/Ang^2", 6.4, [-inf, inf], "", 196 "Solvent scattering length density"], 197 ["n", "", 1, [0, 10], "volume", 198 "number of shells"], 199 ["sld_shell[n]", "1e-6/Ang^2", 1.7, [-inf, inf], "", 200 "scattering length density of shell k"], 201 ["thick_shell[n]", "Ang", 40., [0, inf], "volume", 202 "Thickness of shell k"], 203 ] 187 return 1.0, 1.0 204 188 205 189 demo = dict(volfraction = 1.0, -
sasmodels/models/spherical_sld.py
re42b0b9 r6f0e04f 171 171 # ["name", "units", default, [lower, upper], "type", "description"], 172 172 parameters = [["n_shells", "", 1, [0, 9], "", "number of shells"], 173 ["thick_inter[n]", "Ang", 50, [-inf, inf], "", "intern layer thickness"], 173 ["radius_core", "Ang", 50.0, [0, inf], "", "intern layer thickness"], 174 ["sld_core", "1e-6/Ang^2", 2.07, [-inf, inf], "", "sld function flat"], 175 ["sld_flat[n]", "1e-6/Ang^2", 4.06, [-inf, inf], "", "sld function flat"], 176 ["thick_flat[n]", "Ang", 100.0, [0, inf], "", "flat layer_thickness"], 174 177 ["func_inter[n]", "", 0, [0, 4], "", "Erf:0, RPower:1, LPower:2, RExp:3, LExp:4"], 175 ["sld_core", "1e-6/Ang^2", 2.07, [-inf, inf], "", "sld function flat"], 176 ["sld_solvent", "1e-6/Ang^2", 1.0, [-inf, inf], "", "sld function solvent"], 177 ["sld_flat[n]", "1e-6/Ang^2", 4.06, [-inf, inf], "", "sld function flat"], 178 ["thick_inter[n]", "Ang", 50.0, [0, inf], "", "intern layer thickness"], 179 ["thick_flat[n]", "Ang", 100.0, [0, inf], "", "flat layer_thickness"], 178 ["thick_inter[n]", "Ang", 50.0, [0, inf], "", "intern layer thickness"], 180 179 ["inter_nu[n]", "", 2.5, [-inf, inf], "", "steepness parameter"], 181 180 ["npts_inter", "", 35, [0, 35], "", "number of points in each sublayer Must be odd number"], 182 [" core_rad", "Ang", 50.0, [0, inf], "", "intern layer thickness"],181 ["sld_solvent", "1e-6/Ang^2", 1.0, [-inf, inf], "", "sld function solvent"], 183 182 ] 184 183 # pylint: enable=bad-whitespace, line-too-long … … 193 192 194 193 demo = dict( 195 n_shells=4, 196 scale=1.0, 197 solvent_sld=1.0, 198 background=0.0, 199 npts_inter=35.0, 200 func_inter_0=0, 201 nu_inter_0=2.5, 202 rad_core_0=50.0, 203 core0_sld=2.07, 204 thick_inter_0=50.0, 205 func_inter_1=0, 206 nu_inter_1=2.5, 207 thick_inter_1=50.0, 208 flat1_sld=4.0, 209 thick_flat_1=100.0, 210 func_inter_2=0, 211 nu_inter_2=2.5, 212 thick_inter_2=50.0, 213 flat2_sld=3.5, 214 thick_flat_2=100.0, 215 func_inter_3=0, 216 nu_inter_3=2.5, 217 thick_inter_3=50.0, 218 flat3_sld=4.0, 219 thick_flat_3=100.0, 220 func_inter_4=0, 221 nu_inter_4=2.5, 222 thick_inter_4=50.0, 223 flat4_sld=3.5, 224 thick_flat_4=100.0, 225 func_inter_5=0, 226 nu_inter_5=2.5, 227 thick_inter_5=50.0, 228 flat5_sld=4.0, 229 thick_flat_5=100.0, 230 func_inter_6=0, 231 nu_inter_6=2.5, 232 thick_inter_6=50.0, 233 flat6_sld=3.5, 234 thick_flat_6=100.0, 235 func_inter_7=0, 236 nu_inter_7=2.5, 237 thick_inter_7=50.0, 238 flat7_sld=4.0, 239 thick_flat_7=100.0, 240 func_inter_8=0, 241 nu_inter_8=2.5, 242 thick_inter_8=50.0, 243 flat8_sld=3.5, 244 thick_flat_8=100.0, 245 func_inter_9=0, 246 nu_inter_9=2.5, 247 thick_inter_9=50.0, 248 flat9_sld=4.0, 249 thick_flat_9=100.0, 250 func_inter_10=0, 251 nu_inter_10=2.5, 252 thick_inter_10=50.0, 253 flat10_sld=3.5, 254 thick_flat_10=100.0 255 ) 194 n_shells=4, 195 scale=1.0, 196 solvent_sld=1.0, 197 background=0.0, 198 npts_inter=35.0, 199 ) 256 200 257 201 oldname = "SphereSLDModel" 258 202 oldpars = dict( 259 n_shells="n_shells", 260 scale="scale", 261 npts_inter='npts_inter', 262 solvent_sld='sld_solv', 263 func_inter_0='func_inter0', 264 nu_inter_0='nu_inter0', 265 background='background', 266 rad_core_0='rad_core0', 267 core0_sld='sld_core0', 268 thick_inter_0='thick_inter0', 269 func_inter_1='func_inter1', 270 nu_inter_1='nu_inter1', 271 thick_inter_1='thick_inter1', 272 flat1_sld='sld_flat1', 273 thick_flat_1='thick_flat1', 274 func_inter_2='func_inter2', 275 nu_inter_2='nu_inter2', 276 thick_inter_2='thick_inter2', 277 flat2_sld='sld_flat2', 278 thick_flat_2='thick_flat2', 279 func_inter_3='func_inter3', 280 nu_inter_3='nu_inter3', 281 thick_inter_3='thick_inter3', 282 flat3_sld='sld_flat3', 283 thick_flat_3='thick_flat3', 284 func_inter_4='func_inter4', 285 nu_inter_4='nu_inter4', 286 thick_inter_4='thick_inter4', 287 flat4_sld='sld_flat4', 288 thick_flat_4='thick_flat4', 289 func_inter_5='func_inter5', 290 nu_inter_5='nu_inter5', 291 thick_inter_5='thick_inter5', 292 flat5_sld='sld_flat5', 293 thick_flat_5='thick_flat5', 294 func_inter_6='func_inter6', 295 nu_inter_6='nu_inter6', 296 thick_inter_6='thick_inter6', 297 flat6_sld='sld_flat6', 298 thick_flat_6='thick_flat6', 299 func_inter_7='func_inter7', 300 nu_inter_7='nu_inter7', 301 thick_inter_7='thick_inter7', 302 flat7_sld='sld_flat7', 303 thick_flat_7='thick_flat7', 304 func_inter_8='func_inter8', 305 nu_inter_8='nu_inter8', 306 thick_inter_8='thick_inter8', 307 flat8_sld='sld_flat8', 308 thick_flat_8='thick_flat8', 309 func_inter_9='func_inter9', 310 nu_inter_9='nu_inter9', 311 thick_inter_9='thick_inter9', 312 flat9_sld='sld_flat9', 313 thick_flat_9='thick_flat9', 314 func_inter_10='func_inter10', 315 nu_inter_10='nu_inter10', 316 thick_inter_10='thick_inter10', 317 flat10_sld='sld_flat10', 318 thick_flat_10='thick_flat10') 203 #scale="scale", 204 #background='background', 205 #n_shells="n_shells", 206 radius_core='rad_core', 207 #sld_core='sld_core', 208 #sld_flat='sld_flat', 209 #thick_flat='thick_flat', 210 #func_inter='func_inter', 211 #thick_inter='thick_inter', 212 #inter_nu='nu_inter', 213 #npts_inter='npts_inter', 214 sld_solvent='sld_solv', 215 ) 319 216 320 217 #TODO: Not working yet … … 323 220 [{'npts_iter':35, 324 221 'sld_solv':1, 325 ' func_inter_1':0.0,326 ' nu_inter':2.5,327 ' thick_inter_1':50,328 ' sld_flat_1':4,329 ' thick_flat_1':100,330 ' func_inter_0':0.0,331 ' nu_inter_0':2.5,332 ' rad_core_0':50.0,333 ' sld_core_0':2.07,334 ' thick_inter_0':50,222 'radius_core':50.0, 223 'sld_core':2.07, 224 'func_inter2':0.0, 225 'thick_inter2':50, 226 'nu_inter2':2.5, 227 'sld_flat2':4, 228 'thick_flat2':100, 229 'func_inter1':0.0, 230 'thick_inter1':50, 231 'nu_inter1':2.5, 335 232 'background': 0.0, 336 }, 0.001, 1000],233 }, 0.001, 0.001], 337 234 ]
Note: See TracChangeset
for help on using the changeset viewer.