source: sasmodels/example/sesansfit.py @ 3b4243d

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 3b4243d was 346bc88, checked in by Paul Kienzle <pkienzle@…>, 9 years ago

Add 2D resolution smearing. Split BumpsModel? into Experiment and Model and fix up examples.

  • Property mode set to 100644
File size: 1.9 KB
RevLine 
[c97724e]1from bumps.names import *
2
[0a33675]3from sasmodels import core, bumps_model
4
[0ac3db5]5if True: # fix when data loader exists
6#    from sas.dataloader.readers\
7    from sas.dataloader.loader import Loader
[346bc88]8    loader = Loader()
[0a33675]9    filename = 'testsasview1.ses'
[346bc88]10    data = loader.load(filename)
[0a33675]11    if data is None: raise IOError("Could not load file %r"%(filename,))
[346bc88]12    data.x /= 10
[33d38d5]13#    print data
[0ac3db5]14#    data = load_sesans('mydatfile.pz')
15#    sans_data = load_sans('mysansfile.xml')
16
[e806077]17else:
[c97724e]18    SElength = np.linspace(0, 2400, 61) # [A]
[e806077]19    data = np.ones_like(SElength)
20    err_data = np.ones_like(SElength)*0.03
21
[9c117a2]22    class Sample:
[0ac3db5]23        zacceptance = 0.1 # [A^-1]
[e806077]24        thickness = 0.2 # [cm]
[9c117a2]25       
26    class SESANSData1D:
27        #q_zmax = 0.23 # [A^-1]
28        lam = 0.2 # [nm]
[0ac3db5]29        x = SElength
30        y = data
31        dy = err_data
[9c117a2]32        sample = Sample()
33    data = SESANSData1D()
[0ac3db5]34
35radius = 1000
36data.Rmax = 3*radius # [A]
[c97724e]37
[9c117a2]38##  Sphere parameters
39
[346bc88]40kernel = core.load_model("sphere", dtype='single')
[c97724e]41phi = Parameter(0.1, name="phi")
[346bc88]42model = bumps_model.Model(kernel,
43    scale=phi*(1-phi), sld=7.0, solvent_sld=1.0, radius=radius,
44    )
[33d38d5]45phi.range(0.001,0.5)
[9c117a2]46#model.radius.pmp(40)
[33d38d5]47model.radius.range(1,10000)
48#model.sld.pm(5)
[9c117a2]49#model.background
50#model.radius_pd=0
51#model.radius_pd_n=0
[e806077]52
[9c117a2]53### Tri-Axial Ellipsoid
54#
[346bc88]55#kernel = core.load_model("triaxial_ellipsoid", dtype='single')
[9c117a2]56#phi = Parameter(0.1, name='phi')
[346bc88]57#model = bumps_model.Model(kernel,
58#    scale=phi*(1-phi), sld=7.0, solvent_sld=1.0, radius=radius,
59#    )
[9c117a2]60#phi.range(0.001,0.90)
61##model.radius.pmp(40)
62#model.radius.range(100,10000)
63##model.sld.pmp(5)
64##model.background
[346bc88]65##model.radius_pd = 0
66##model.radius_pd_n = 0
67
68if False: # have sans data
69    M_sesans = bumps_model.Experiment(data=data, model=model)
70    M_sans = bumps_model.Experiment(data=sans_data, model=model)
71    problem = FitProblem([M_sesans, M_sans])
72else:
73    M_sesans = bumps_model.Experiment(data=data, model=model)
74    problem = FitProblem(M_sesans)
75
Note: See TracBrowser for help on using the repository browser.