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 1dbff4c was
7df1a50,
checked in by Jae Cho <jhjcho@…>, 13 years ago
|
moving a file
|
-
Property mode set to
100644
|
File size:
1.6 KB
|
Line | |
---|
1 | #!/usr/bin/env python |
---|
2 | """ Provide functionality for a C extension model |
---|
3 | |
---|
4 | |
---|
5 | @author: Mathieu Doucet / UTK |
---|
6 | @contact: mathieu.doucet@nist.gov |
---|
7 | """ |
---|
8 | |
---|
9 | from sans.models.CylinderModel import CylinderModel |
---|
10 | from sans_extension.c_models import Disperser |
---|
11 | from sans.models.DisperseModel import DisperseModel |
---|
12 | import copy |
---|
13 | |
---|
14 | class DisperseCylinderModel(CylinderModel): |
---|
15 | """ Class that evaluates a SmearCylinderModel model. |
---|
16 | """ |
---|
17 | |
---|
18 | def __init__(self): |
---|
19 | """ Initialization """ |
---|
20 | |
---|
21 | # Initialize BaseComponent first, then sphere |
---|
22 | CylinderModel.__init__(self) |
---|
23 | self.params['sigma_phi'] = 0.0 |
---|
24 | self.params['sigma_theta'] = 0.0 |
---|
25 | self.params['n_pts'] = 20 |
---|
26 | |
---|
27 | |
---|
28 | ## Name of the model |
---|
29 | self.name = "DisperseCylinderModel" |
---|
30 | |
---|
31 | def clone(self): |
---|
32 | """ Return a identical copy of self """ |
---|
33 | obj = DisperseCylinderModel() |
---|
34 | obj.params = copy.deepcopy(self.params) |
---|
35 | return obj |
---|
36 | |
---|
37 | def run(self, x = 0.0): |
---|
38 | """ Evaluate the model |
---|
39 | @param x: input q, or [q,phi] |
---|
40 | @return: scattering function P(q) |
---|
41 | """ |
---|
42 | model = CylinderModel() |
---|
43 | model.params = copy.deepcopy(self.params) |
---|
44 | #d = Disperser(model, ["cyl_phi", "cyl_theta"], |
---|
45 | # [self.params['sigma_phi'], self.params['sigma_theta']]) |
---|
46 | d = DisperseModel(model, ["cyl_phi", "cyl_theta"], |
---|
47 | [self.params['sigma_phi'], self.params['sigma_theta']]) |
---|
48 | d.params['n_pts'] = self.params['n_pts'] |
---|
49 | return d.run(x) |
---|
50 | |
---|
51 | # End of file |
---|
Note: See
TracBrowser
for help on using the repository browser.