Last change
on this file since ac995be 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 | |
---|
[3330bb4] | 1 | """ |
---|
[fa79f5c] | 2 | This is a data file used to load in sesans data and fit it using the bumps engine |
---|
[3330bb4] | 3 | """ |
---|
| 4 | from bumps.names import * |
---|
| 5 | |
---|
| 6 | import sesansfit |
---|
| 7 | |
---|
| 8 | # Enter the model name to use |
---|
| 9 | model_name = "sphere" |
---|
| 10 | |
---|
| 11 | # DO NOT MODIFY THIS LINE |
---|
| 12 | model = sesansfit.get_bumps_model(model_name) |
---|
| 13 | |
---|
| 14 | # Enter any custom parameters |
---|
| 15 | # name = Parameter(initial_value, name='name') |
---|
| 16 | phi = Parameter(0.0855, name='phi') |
---|
| 17 | # Add the parameters to this list that should be displayed in the fitting window |
---|
| 18 | custom_params = {"phi" : phi} |
---|
| 19 | |
---|
| 20 | # SESANS data file name |
---|
| 21 | sesans_file = "spheres2micron.ses" |
---|
| 22 | |
---|
| 23 | # Initial parameter values (if other than defaults) |
---|
| 24 | # "model_parameter_name" : value |
---|
| 25 | initial_vals = { |
---|
| 26 | "sld" : 1.41, |
---|
| 27 | "radius" : 10000, |
---|
| 28 | "sld_solvent" : 2.70, |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | # Ranges for parameters if other than default |
---|
| 32 | # "model_parameter_name" : [min, max] |
---|
| 33 | param_range = { |
---|
| 34 | "phi" : [0.001, 0.5], |
---|
| 35 | "radius" : [100, 100000] |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | # Constraints |
---|
| 39 | # model.param_name = f(other params) |
---|
[fa79f5c] | 40 | # EXAMPLE: model.scale = model.radius*model.radius*(1 - phi) - where radius |
---|
| 41 | # and scale are model functions and phi is a custom parameter |
---|
[3330bb4] | 42 | model.scale = phi*(1-phi) |
---|
| 43 | |
---|
| 44 | # Send to the fitting engine |
---|
| 45 | # DO NOT MODIFY THIS LINE |
---|
| 46 | problem = sesansfit.sesans_fit(sesans_file, model, initial_vals, custom_params, param_range) |
---|
Note: See
TracBrowser
for help on using the repository browser.