source: sasmodels/example/model_ellipsoid_hayter_msa.py @ ac995be

Last change on this file since ac995be was 8a5f021, checked in by Paul Kienzle <pkienzle@…>, 7 years ago

batch fit example: PEP8 cleanup; add .csv output; all pars on one plot; more flexible option handling

  • Property mode set to 100644
File size: 1.1 KB
Line 
1import sys
2#sys.path.append('path_to_sasmodels')
3
4import numpy as np
5
6from bumps.names import *
7from sasmodels.core import load_model
8from sasmodels.bumps_model import Model, Experiment
9from sasmodels.data import load_data, plot_data
10
11# IMPORT THE DATA USED
12data = load_data(sys.argv[1])
13
14#setattr(data, 'qmin', 0.0)
15#setattr(data, 'qmax', 10.0)
16
17# DEFINE THE MODEL
18kernel = load_model('ellipsoid*hayter_msa')
19
20pars = 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
24model = Model(kernel, **pars)
25
26# PARAMETER RANGES (ONLY THOSE PARAMETERS ARE FITTED)
27model.scale.range(0, inf)
28model.background.range(-inf, inf)
29#model.sld.range(-inf, inf)
30model.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
39M = Experiment(data=data, model=model)
40
41problem = FitProblem(M)
Note: See TracBrowser for help on using the repository browser.