source: sasmodels/example/sesansfit.py @ efc517c

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since efc517c was 0ac3db5, checked in by jhbakker, 10 years ago

SESANSfit now uses sesans_reader dataloader

  • Property mode set to 100644
File size: 1.2 KB
Line 
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
8if True: # fix when data loader exists
9#    from sas.dataloader.readers\
10    from sas.dataloader.loader import Loader
11    loader=Loader()
12    data=loader.load('testsasview1.ses')
13   
14#    data = load_sesans('mydatfile.pz')
15#    sans_data = load_sans('mysansfile.xml')
16
17else:
18    SElength = np.linspace(0, 2400, 61) # [A]
19    data = np.ones_like(SElength)
20    err_data = np.ones_like(SElength)*0.03
21
22    class SESANSData1D:
23        #q_zmax = 0.23 # [A^-1]
24        zacceptance = 0.1 # [A^-1]
25        lam = 2e-10 # [m]
26        thickness = 0.2 # [cm]
27        x = SElength
28        y = data
29        dy = err_data
30    data = SesansData()
31print dir(data)
32
33radius = 1000
34data.Rmax = 3*radius # [A]
35
36phi = Parameter(0.1, name="phi")
37model = sas.BumpsModel(data, kernel,
38    scale=phi*(1-phi), sld=7.0, solvent_sld=1.0, radius=radius)
39phi.pmp(10)
40model.radius.pmp(40)
41model.sld.pm(2)
42model.background.range(0,5)
43
44
45if False: # have sans data
46    sansmodel = sas.BumpsModel(sans_data, kernel, **model.parameters())
47    problem = FitProblem([model, sansmodel])
48else:
49    problem = FitProblem(model)
50
Note: See TracBrowser for help on using the repository browser.