1 | import sys |
---|
2 | #sys.path.append('path_to_sasmodels') |
---|
3 | |
---|
4 | import numpy as np |
---|
5 | |
---|
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 | |
---|
11 | # IMPORT THE DATA USED |
---|
12 | data = load_data(sys.argv[1]) |
---|
13 | |
---|
14 | #setattr(data, 'qmin', 0.0) |
---|
15 | #setattr(data, 'qmax', 10.0) |
---|
16 | |
---|
17 | # DEFINE THE MODEL |
---|
18 | kernel = load_model('ellipsoid@hayter_msa') |
---|
19 | |
---|
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, |
---|
22 | concentration_salt=0.001, dielectconst=71.0) |
---|
23 | |
---|
24 | model = Model(kernel, **pars) |
---|
25 | |
---|
26 | # PARAMETER RANGES (ONLY THOSE PARAMETERS ARE FITTED) |
---|
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) |
---|