Last change
on this file since 35d2300 was
fa79f5c,
checked in by Paul Kienzle <pkienzle@…>, 7 years ago
|
restore working sesans example using direct model
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Rev | Line | |
---|
[a98958b] | 1 | """ |
---|
| 2 | This is a data file used to load in sesans data and fit it using the bumps engine |
---|
| 3 | """ |
---|
| 4 | from bumps.names import * |
---|
| 5 | |
---|
| 6 | import sesansfit |
---|
| 7 | |
---|
| 8 | # Enter the model name to use |
---|
| 9 | model_name = "sphere" |
---|
| 10 | |
---|
[84db7a5] | 11 | # DO NOT MODIFY THIS LINE |
---|
| 12 | model = sesansfit.get_bumps_model(model_name) |
---|
[fa902d4] | 13 | model.radius.range(1,10000) |
---|
[84db7a5] | 14 | |
---|
[a98958b] | 15 | # Enter any custom parameters |
---|
[84db7a5] | 16 | # name = Parameter(initial_value, name='name') |
---|
[a98958b] | 17 | phi = Parameter(0.10, name='phi') |
---|
[84db7a5] | 18 | # Add the parameters to this list that should be displayed in the fitting window |
---|
[a98958b] | 19 | custom_params = {"phi" : phi} |
---|
| 20 | |
---|
[84db7a5] | 21 | # SESANS data file name |
---|
[a98958b] | 22 | sesans_file = "sphere.ses" |
---|
| 23 | |
---|
| 24 | # Initial parameter values (if other than defaults) |
---|
[84db7a5] | 25 | # "model_parameter_name" : value |
---|
[a98958b] | 26 | initial_vals = { |
---|
| 27 | "sld" : 7.0, |
---|
| 28 | "radius" : 1000, |
---|
[9217ef8] | 29 | "sld_solvent" : 1.0, |
---|
[a98958b] | 30 | } |
---|
| 31 | |
---|
| 32 | # Ranges for parameters if other than default |
---|
[84db7a5] | 33 | # "model_parameter_name" : [min, max] |
---|
[a98958b] | 34 | param_range = { |
---|
| 35 | "phi" : [0.001, 0.5], |
---|
| 36 | "radius" : [1, 10000] |
---|
| 37 | } |
---|
| 38 | |
---|
[84db7a5] | 39 | # Constraints |
---|
| 40 | # model.param_name = f(other params) |
---|
| 41 | # EXAMPLE: model.scale = model.radius*model.radius*(1 - phi) - where radius and scale are model functions and phi is |
---|
| 42 | # a custom parameter |
---|
| 43 | model.scale = phi*(1-phi) |
---|
| 44 | |
---|
[a98958b] | 45 | # Send to the fitting engine |
---|
[84db7a5] | 46 | # DO NOT MODIFY THIS LINE |
---|
| 47 | problem = sesansfit.sesans_fit(sesans_file, model, initial_vals, custom_params, param_range) |
---|
Note: See
TracBrowser
for help on using the repository browser.