[93d0ea7] | 1 | import sys |
---|
[1f7792e] | 2 | #sys.path.append('path_to_sasmodels') |
---|
[93d0ea7] | 3 | |
---|
[8a5f021] | 4 | import numpy as np |
---|
| 5 | |
---|
[93d0ea7] | 6 | from bumps.names import * |
---|
| 7 | from sasmodels.core import load_model |
---|
| 8 | from sasmodels.bumps_model import Model, Experiment |
---|
| 9 | from sasmodels.data import load_data, plot_data |
---|
| 10 | |
---|
[8a5f021] | 11 | # IMPORT THE DATA USED |
---|
| 12 | data = load_data(sys.argv[1]) |
---|
[93d0ea7] | 13 | |
---|
| 14 | #setattr(data, 'qmin', 0.0) |
---|
| 15 | #setattr(data, 'qmax', 10.0) |
---|
| 16 | |
---|
[8a5f021] | 17 | # DEFINE THE MODEL |
---|
[9a99993] | 18 | kernel = load_model('ellipsoid@hayter_msa') |
---|
[93d0ea7] | 19 | |
---|
[8a5f021] | 20 | pars = dict(scale=6.4, background=0.06, sld=0.33, sld_solvent=2.15, radius_polar=14.0, |
---|
| 21 | radius_equatorial=24.0, volfraction=0.075, charge=66.373, temperature=298.0, |
---|
[93d0ea7] | 22 | concentration_salt=0.001, dielectconst=71.0) |
---|
[8a5f021] | 23 | |
---|
[93d0ea7] | 24 | model = Model(kernel, **pars) |
---|
| 25 | |
---|
[8a5f021] | 26 | # PARAMETER RANGES (ONLY THOSE PARAMETERS ARE FITTED) |
---|
[93d0ea7] | 27 | model.scale.range(0, inf) |
---|
| 28 | model.background.range(-inf, inf) |
---|
| 29 | #model.sld.range(-inf, inf) |
---|
| 30 | model.sld_solvent.range(-inf, inf) |
---|
| 31 | #model.radius_polar.range(0, inf) |
---|
| 32 | #model.radius_equatorial.range(0, inf) |
---|
| 33 | #model.volfraction.range(0,0.74) |
---|
| 34 | #model.charge.range(0, inf) |
---|
| 35 | #model.temperature.range(0,1000) |
---|
| 36 | #model.concentration_salt.range(0, 1) |
---|
| 37 | #model.dielectconst.range(0,inf) |
---|
| 38 | |
---|
| 39 | M = Experiment(data=data, model=model) |
---|
| 40 | |
---|
| 41 | problem = FitProblem(M) |
---|