source: sasmodels/example/sesans_parameters_css-hs.py @ b955dd5

Last change on this file since b955dd5 was ca3abe6, checked in by awashington, 9 years ago

Improve parameters for sesans core shell example

  • Property mode set to 100644
File size: 1.3 KB
Line 
1"""
2This is a data file  used to load in sesans data and fit it using the bumps engine
3"""
4from bumps.names import *
5
6import sesansfit
7
8# Enter the model name to use
9model_name = "core_shell_sphere*hardsphere"
10
11# DO NOT MODIFY THIS LINE
12model = sesansfit.get_bumps_model(model_name)
13
14# Enter any custom parameters
15phi = Parameter(0.45, name='phi')
16pen = Parameter(0.95, name='solvent penetration')
17custom_params = {"phi" : phi, "pen" : pen}
18
19# SESANS data file
20sesans_file = "core_shell.ses"
21
22# Initial parameter values (if other than defaults)
23initial_vals = {
24    "sld_core" : 1.05,
25    "sld_shell" : 2.88*pen-0.05*(1-pen),
26    "sld_solvent" : 2.88,
27    "radius" : 730,
28    "thickness" : 20,
29    "volfraction" : phi,
30    "scale" : (1-phi)
31}
32
33# Ranges for parameters if other than default
34param_range = {
35    "phi" : [0.2, 0.5],
36    "pen" : [0,1],
37    "radius" : [500, 3000],
38    "thickness" : [0,200]
39}
40
41# Constraints
42# model.param_name = f(other params)
43# EXAMPLE: model.scale = model.radius*model.radius*(1 - phi) - where radius and scale are model functions and phi is
44# a custom parameter
45model.scale = phi*(1-phi)
46model.volfraction = phi
47model.shell_sld = pen*2.88
48
49# Send to the fitting engine
50problem = sesansfit.sesans_fit(sesans_file, model_name, initial_vals, custom_params, param_range)
Note: See TracBrowser for help on using the repository browser.