source: sasmodels/example/sesansfit.py @ 6a729a2

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 6a729a2 was e806077, checked in by pkienzle, 10 years ago

add example of sans/sesans simultaneous system

  • Property mode set to 100644
File size: 1.2 KB
RevLine 
[c97724e]1import numpy as np
2from bumps.names import *
3
4from sasmodels import bumps_model as sas
5kernel = sas.load_model('sphere', dtype='single')
6
7
[e806077]8radius = 1000
9if False: # fix when data loader exists
10    from sasmodels.dataloader import load_sesans, load_sans
11    data = load_sesans('mydatfile.pz')
12    sans_data = load_sans('mysansfile.xml')
13else:
[c97724e]14    SElength = np.linspace(0, 2400, 61) # [A]
[e806077]15    data = np.ones_like(SElength)
16    err_data = np.ones_like(SElength)*0.03
17
18    class SesansData:
19        #q_zmax = 0.23 # [A^-1]
20        q_zmax = 0.1 # [A^-1]
21        SElength = np.linspace(0, 2400, 61) # [A]
22        Rmax = 3*radius # [A]
23        wavelength = 2e-10 # [m]
24        thickness = 0.2 # [cm]
25        SElength = SElength
26        data = data
27        err_data = err_data
28    data = SesansData()
[c97724e]29
30phi = Parameter(0.1, name="phi")
31model = sas.BumpsModel(data, kernel,
32    scale=phi*(1-phi), sld=7.0, solvent_sld=1.0, radius=radius)
33phi.pmp(10)
34model.radius.pmp(40)
35model.sld.pm(2)
36model.background.range(0,5)
37
[e806077]38
39if False: # have sans data
40    sansmodel = sas.BumpsModel(sans_data, kernel, **model.parameters())
41    problem = FitProblem([model, sansmodel])
42else:
43    problem = FitProblem(model)
[c97724e]44
Note: See TracBrowser for help on using the repository browser.