Changeset e187b25 in sasmodels for sasmodels/models/onion.py
- Timestamp:
- Aug 5, 2016 8:48:52 AM (8 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:
- 785cbec
- Parents:
- 50ec515
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/onion.py
rd119f34 re187b25 306 306 parameters = [["sld_core", "1e-6/Ang^2", 1.0, [-inf, inf], "sld", 307 307 "Core scattering length density"], 308 [" core_radius", "Ang", 200., [0, inf], "volume",308 ["radius_core", "Ang", 200., [0, inf], "volume", 309 309 "Radius of the core"], 310 310 ["sld_solvent", "1e-6/Ang^2", 6.4, [-inf, inf], "sld", … … 325 325 single = False 326 326 327 #def Iq(q, *args, **kw):328 # return q329 330 327 profile_axes = ['Radius (A)', 'SLD (1e-6/A^2)'] 331 def profile( core_sld, core_radius, solvent_sld, n_shells,332 in_sld, out_sld, thickness, A):328 def profile(sld_core, radius_core, sld_solvent, n_shells, 329 sld_in, sld_out, thickness, A): 333 330 """ 334 331 Returns shape profile with x=radius, y=SLD. 335 332 """ 336 333 337 total_radius = 1.25*(sum(thickness[:n_shells]) + core_radius+ 1)334 total_radius = 1.25*(sum(thickness[:n_shells]) + radius_core + 1) 338 335 dr = total_radius/400 # 400 points for a smooth plot 339 336 340 337 r = [] 341 beta= []338 rho = [] 342 339 343 340 # add in the core 344 341 r.append(0) 345 beta.append(core_sld)346 r.append( core_radius)347 beta.append(core_sld)342 rho.append(sld_core) 343 r.append(radius_core) 344 rho.append(sld_core) 348 345 349 346 # add in the shells … … 352 349 r0 = r[-1] 353 350 r.append(r0) 354 beta.append(in_sld[k])351 rho.append(sld_in[k]) 355 352 356 353 if fabs(A[k]) < 1.0e-16: 357 354 # flat shell 358 355 r.append(r0 + thickness[k]) 359 beta.append(out_sld[k])356 rho.append(sld_out[k]) 360 357 else: 361 358 # exponential shell … … 363 360 # to protect against a thickness0. 364 361 num_steps = np.floor(thickness[k]/dr) + 1 365 slope = ( out_sld[k] - in_sld[k])/expm1(A[k])366 const = ( in_sld[k] - slope)362 slope = (sld_out[k] - sld_in[k]) / expm1(A[k]) 363 const = (sld_in[k] - slope) 367 364 for rk in np.linspace(0, thickness[k], num_steps+1): 368 365 r.append(r0+rk) 369 beta.append(slope*exp(A[k]*rk/thickness[k]) + const)366 rho.append(slope*exp(A[k]*rk/thickness[k]) + const) 370 367 371 368 # add in the solvent 372 369 r.append(r[-1]) 373 beta.append(solvent_sld)370 rho.append(sld_solvent) 374 371 r.append(total_radius) 375 beta.append(solvent_sld)376 377 return np.asarray(r), np.asarray( beta)*1e-6372 rho.append(sld_solvent) 373 374 return np.asarray(r), np.asarray(rho) 378 375 379 376 def ER(core_radius, n, thickness):
Note: See TracChangeset
for help on using the changeset viewer.