1 | #!/usr/bin/env python |
---|
2 | # -*- coding: utf-8 -*- |
---|
3 | |
---|
4 | from bumps.names import * |
---|
5 | from sasmodel import SasModel, load_data, set_beam_stop, set_half, set_top |
---|
6 | from Models.code_capcyl import GpuCapCylinder |
---|
7 | from Models.code_coreshellcyl_f import GpuCoreShellCylinder |
---|
8 | from Models.code_cylinder_f import GpuCylinder |
---|
9 | #from Models.code_cylinder import GpuCylinder, OneDGpuCylinder |
---|
10 | from Models.code_ellipse_f import GpuEllipse |
---|
11 | from Models.code_lamellar import GpuLamellar |
---|
12 | from Models.code_triaxialellipse import GpuTriEllipse |
---|
13 | |
---|
14 | """ IMPORT THE DATA USED """ |
---|
15 | #data = load_data('December/Tangential/Sector0/DEC07133.ABS') |
---|
16 | data = load_data('December/DEC07098.DAT') |
---|
17 | |
---|
18 | """ SET INNER BEAM STOP, OUTER RING, AND MASK HALF OF THE DATA """ |
---|
19 | set_beam_stop(data, 0.004)#, outer=0.025) |
---|
20 | set_top(data, -.018) |
---|
21 | #set_half(data, 'right') |
---|
22 | |
---|
23 | |
---|
24 | if 0: |
---|
25 | model = SasModel(data, OneDGpuCylinder, |
---|
26 | scale=0.0013, radius=105, length=1000, |
---|
27 | background=21, sldCyl=.291e-6,sldSolv=7.105e-6, |
---|
28 | radius_pd=0.1,radius_pd_n=10,radius_pd_nsigma=0, |
---|
29 | length_pd=0.1,length_pd_n=5,length_pd_nsigma=0, |
---|
30 | bolim=0.0, uplim=90) #bottom limit, upper limit of angle integral |
---|
31 | |
---|
32 | |
---|
33 | if 0: |
---|
34 | model = SasModel(data, GpuEllipse, |
---|
35 | scale=0.08, |
---|
36 | radius_a=15, radius_b=800, |
---|
37 | sldEll=.291e-6, sldSolv=7.105e-6, |
---|
38 | background=0, |
---|
39 | axis_theta=90, axis_phi=0, |
---|
40 | axis_theta_pd=15, axis_theta_pd_n=40, axis_theta_pd_nsigma=3, |
---|
41 | radius_a_pd=0.222296, radius_a_pd_n=1, radius_a_pd_nsigma=0, |
---|
42 | radius_b_pd=.000128, radius_b_pd_n=1, radius_b_pd_nsigma=0, |
---|
43 | axis_phi_pd=2.63698e-05, axis_phi_pd_n=20, axis_phi_pd_nsigma=3, |
---|
44 | dtype='float32') |
---|
45 | |
---|
46 | |
---|
47 | # SET THE FITTING PARAMETERS |
---|
48 | #model.radius_a.range(15, 1000) |
---|
49 | #model.radius_b.range(15, 1000) |
---|
50 | #model.axis_theta_pd.range(0, 360) |
---|
51 | #model.background.range(0,1000) |
---|
52 | model.scale.range(0, 1) |
---|
53 | |
---|
54 | |
---|
55 | if 0: |
---|
56 | model = SasModel(data, GpuLamellar, |
---|
57 | scale=0.08, |
---|
58 | bi_thick=19.2946, |
---|
59 | sld_bi=5.38e-6,sld_sol=7.105e-6, |
---|
60 | background=0.003, |
---|
61 | bi_thick_pd= 0.37765, bi_thick_pd_n=10, bi_thick_pd_nsigma=3, |
---|
62 | dtype='float32') |
---|
63 | |
---|
64 | # SET THE FITTING PARAMETERS |
---|
65 | #model.bi_thick.range(0, 1000) |
---|
66 | #model.scale.range(0, 1) |
---|
67 | #model.bi_thick_pd.range(0, 1000) |
---|
68 | #model.background.range(0, 1000) |
---|
69 | model.sld_bi.range(0, 1) |
---|
70 | |
---|
71 | |
---|
72 | if 0: |
---|
73 | """ |
---|
74 | pars = dict(scale=0.0023, radius=92.5, length=798.3, |
---|
75 | sldCyl=.29e-6, sldSolv=7.105e-6, background=5, |
---|
76 | cyl_theta=0, cyl_phi=0, |
---|
77 | cyl_theta_pd=22.11, cyl_theta_pd_n=5, cyl_theta_pd_nsigma=3, |
---|
78 | radius_pd=.0084, radius_pd_n=10, radius_pd_nsigma=3, |
---|
79 | length_pd=0.493, length_pd_n=10, length_pd_nsigma=3, |
---|
80 | cyl_phi_pd=0, cyl_phi_pd_n=5, cyl_phi_pd_nsigma=3,) |
---|
81 | """ |
---|
82 | pars = dict( |
---|
83 | scale=.01, radius=64.1, length=66.96, sldCyl=.291e-6, sldSolv=5.77e-6, background=.1, |
---|
84 | cyl_theta=90, cyl_phi=0, |
---|
85 | radius_pd=0.1, radius_pd_n=10, radius_pd_nsigma=3, |
---|
86 | length_pd=0.1,length_pd_n=5, length_pd_nsigma=3, |
---|
87 | cyl_theta_pd=0.1, cyl_theta_pd_n=5, cyl_theta_pd_nsigma=3, |
---|
88 | cyl_phi_pd=0.1, cyl_phi_pd_n=10, cyl_phi_pd_nsigma=3) |
---|
89 | model = SasModel(data, GpuCylinder, dtype="float32", **pars) |
---|
90 | |
---|
91 | |
---|
92 | |
---|
93 | # SET THE FITTING PARAMETERS |
---|
94 | model.radius.range(1, 500) |
---|
95 | model.length.range(1, 5000) |
---|
96 | #model.cyl_theta.range(-90,100) |
---|
97 | #model.cyl_theta_pd.range(0, 90) |
---|
98 | #model.cyl_theta_pd_n = model.cyl_theta_pd + 5 |
---|
99 | #model.radius_pd.range(0, 90) |
---|
100 | #model.length_pd.range(0, 90) |
---|
101 | model.scale.range(0, 1) |
---|
102 | #model.background.range(0, 100) |
---|
103 | #model.sldCyl.range(0, 1) |
---|
104 | |
---|
105 | |
---|
106 | if 1: |
---|
107 | model = SasModel(data, GpuCoreShellCylinder, |
---|
108 | scale= .031, radius=19.5, thickness=30, length=22, |
---|
109 | core_sld=7.105e-6, shell_sld=.291e-6, solvent_sld=7.105e-6, |
---|
110 | background=0, axis_theta=0, axis_phi=0, |
---|
111 | |
---|
112 | radius_pd=0.26, radius_pd_n=10, radius_pd_nsigma=3, |
---|
113 | length_pd=0.26, length_pd_n=10, length_pd_nsigma=3, |
---|
114 | thickness_pd=1, thickness_pd_n=1, thickness_pd_nsigma=1, |
---|
115 | axis_theta_pd=1, axis_theta_pd_n=10, axis_theta_pd_nsigma=3, |
---|
116 | axis_phi_pd=0.1, axis_phi_pd_n=1, axis_phi_pd_nsigma=1, |
---|
117 | dtype='float32') |
---|
118 | |
---|
119 | # SET THE FITTING PARAMETERS |
---|
120 | #model.radius.range(115, 1000) |
---|
121 | #model.length.range(0, 2500) |
---|
122 | #model.thickness.range(18, 38) |
---|
123 | #model.thickness_pd.range(0, 1) |
---|
124 | #model.axis_phi.range(0, 90) |
---|
125 | #model.radius_pd.range(0, 1) |
---|
126 | #model.length_pd.range(0, 1) |
---|
127 | #model.axis_theta_pd.range(0, 360) |
---|
128 | #model.background.range(0,5) |
---|
129 | model.scale.range(0, 1) |
---|
130 | |
---|
131 | |
---|
132 | |
---|
133 | if 0: |
---|
134 | model = SasModel(data, GpuCapCylinder, |
---|
135 | scale=.08, rad_cyl=20, rad_cap=40, len_cyl=400, |
---|
136 | sld_capcyl=1e-6, sld_solv=6.3e-6, |
---|
137 | background=0, theta=0, phi=0, |
---|
138 | rad_cyl_pd=.1, rad_cyl_pd_n=5, rad_cyl_pd_nsigma=3, |
---|
139 | rad_cap_pd=.1, rad_cap_pd_n=5, rad_cap_pd_nsigma=3, |
---|
140 | len_cyl_pd=.1, len_cyl_pd_n=1, len_cyl_pd_nsigma=0, |
---|
141 | theta_pd=.1, theta_pd_n=1, theta_pd_nsigma=0, |
---|
142 | phi_pd=.1, phi_pd_n=1, phi_pd_nsigma=0, |
---|
143 | dtype='float32') |
---|
144 | |
---|
145 | model.scale.range(0, 1) |
---|
146 | |
---|
147 | |
---|
148 | if 0: |
---|
149 | model = SasModel(data, GpuTriEllipse, |
---|
150 | scale=0.08, axisA=15, axisB=20, axisC=500, |
---|
151 | sldEll=7.105e-6, sldSolv=.291e-6, |
---|
152 | background=5, theta=0, phi=0, psi=0, |
---|
153 | theta_pd=20, theta_pd_n=40, theta_pd_nsigma=3, |
---|
154 | phi_pd=.1, phi_pd_n=1, phi_pd_nsigma=0, |
---|
155 | psi_pd=30, psi_pd_n=1, psi_pd_nsigma=0, |
---|
156 | axisA_pd=.1, axisA_pd_n=1, axisA_pd_nsigma=0, |
---|
157 | axisB_pd=.1, axisB_pd_n=1, axisB_pd_nsigma=0, |
---|
158 | axisC_pd=.1, axisC_pd_n=1, axisC_pd_nsigma=0, dtype='float32') |
---|
159 | |
---|
160 | # SET THE FITTING PARAMETERS |
---|
161 | model.axisA.range(15, 1000) |
---|
162 | model.axisB.range(15, 1000) |
---|
163 | #model.axisC.range(15, 1000) |
---|
164 | #model.background.range(0,1000) |
---|
165 | #model.theta_pd.range(0, 360) |
---|
166 | #model.phi_pd.range(0, 360) |
---|
167 | #model.psi_pd.range(0, 360) |
---|
168 | |
---|
169 | |
---|
170 | |
---|
171 | |
---|
172 | problem = FitProblem(model) |
---|
173 | |
---|