source: sasmodels/example/sesansfit.py @ f224873

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since f224873 was c210c94, checked in by Paul Kienzle <pkienzle@…>, 10 years ago

fix sesansfit merge

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