source: sasmodels/example/simul_fit.py @ bb4b509

core_shell_microgelscostrafo411magnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since bb4b509 was 1a4d4c0, checked in by Paul Kienzle <pkienzle@…>, 8 years ago

add example for simultaneous fit

  • Property mode set to 100644
File size: 1.1 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4# To Sasview/documents/scripts
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
12""" IMPORT THE DATA USED """
13datafiles = ['latex_smeared_out_0.txt', 'latex_smeared_out_1.txt']
14datasets = [load_data(el) for el in datafiles]
15
16for data in datasets:
17    data.qmin = 0.0
18    data.qmax = 10.0
19
20#sphere model
21kernel = load_model('sphere', dtype="single")
22pars = dict(scale=0.01, background=0.0, sld=1.0, sld_solvent=6.0, radius=1500.)
23model = Model(kernel, **pars)
24model.radius.range(0, inf)
25#model.background.range(-inf, inf)
26#model.scale.range(0, inf)
27model.sld.range(-inf, inf)
28model.sld_solvent.range(-inf, inf)
29
30free = FreeVariables(
31    names=[data.filename for data in datasets],
32    background=model.background,
33    scale=model.scale,
34    )
35free.background.range(-inf, inf)
36free.scale.range(0, inf)
37
38M = [Experiment(data=data, model=model) for data in datasets]
39
40problem = FitProblem(M, freevars=free)
41
42print(problem._parameters)
Note: See TracBrowser for help on using the repository browser.