ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change
on this file since fca6936 was
fca6936,
checked in by Mathieu Doucet <doucetm@…>, 16 years ago
|
First cut at better polydisp and averaging implementation for sans models.
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | import sys, os, math |
---|
2 | from sans.models.CylinderModel import CylinderModel |
---|
3 | from sans.models.DisperseModel import DisperseModel |
---|
4 | |
---|
5 | def old_cyl(q=0.001): |
---|
6 | |
---|
7 | cyl = CylinderModel() |
---|
8 | cyl.setParam('cyl_phi', 0.0) |
---|
9 | cyl.setParam('cyl_theta', 0.0) |
---|
10 | |
---|
11 | disp = DisperseModel(cyl, ['radius'], [5]) |
---|
12 | disp.setParam('n_pts', 100) |
---|
13 | print "" |
---|
14 | print "Old Cyl : ", cyl.run(q) |
---|
15 | print "Old Disp: ", disp.run(q) |
---|
16 | |
---|
17 | |
---|
18 | |
---|
19 | #---------------------------------------------------------------------- |
---|
20 | |
---|
21 | cyl = CylinderModel() |
---|
22 | print cyl.run(0.001) |
---|
23 | print cyl.run([0.001, .7854]) |
---|
24 | print cyl.runXY([0.001,0.001]) |
---|
25 | |
---|
26 | print "" |
---|
27 | print cyl.dispersion['disp_radius'] |
---|
28 | |
---|
29 | cyl.dispersion['disp_radius']['width'] = 9.345 |
---|
30 | |
---|
31 | q=0.001 |
---|
32 | print "\n q=", q |
---|
33 | print "New Cyl : ", cyl.run(q) |
---|
34 | |
---|
35 | cyl.dispersion['disp_radius']['width']=5 |
---|
36 | cyl.dispersion['disp_radius']['npts']=100 |
---|
37 | print "New Disp: ", cyl.run(q) |
---|
38 | |
---|
39 | # Angular averaging |
---|
40 | values_ph = [] |
---|
41 | values_th = [] |
---|
42 | weights = [] |
---|
43 | for i in range(100): |
---|
44 | values_ph.append(2.0*math.pi/99.0*i) |
---|
45 | values_th.append(math.pi/99.0*i) |
---|
46 | weights.append(1.0) |
---|
47 | |
---|
48 | |
---|
49 | |
---|
50 | old_cyl() |
---|
Note: See
TracBrowser
for help on using the repository browser.