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 4c718654 was
4c718654,
checked in by Mathieu Doucet <doucetm@…>, 16 years ago
|
Introduced abstract engine
|
-
Property mode set to
100644
|
File size:
1.9 KB
|
Line | |
---|
1 | |
---|
2 | class FitEngine: |
---|
3 | |
---|
4 | def _concatenateData(self, listdata=[]): |
---|
5 | """ |
---|
6 | _concatenateData method concatenates each fields of all data contains ins listdata. |
---|
7 | @param listdata: list of data |
---|
8 | |
---|
9 | @return xtemp, ytemp,dytemp: x,y,dy respectively of data all combined |
---|
10 | if xi,yi,dyi of two or more data are the same the second appearance of xi,yi, |
---|
11 | dyi is ignored in the concatenation. |
---|
12 | |
---|
13 | @raise: if listdata is empty will return None |
---|
14 | @raise: if data in listdata don't contain dy field ,will create an error |
---|
15 | during fitting |
---|
16 | """ |
---|
17 | if listdata==[]: |
---|
18 | raise ValueError, " data list missing" |
---|
19 | else: |
---|
20 | xtemp=[] |
---|
21 | ytemp=[] |
---|
22 | dytemp=[] |
---|
23 | |
---|
24 | for data in listdata: |
---|
25 | for i in range(len(data.x)): |
---|
26 | xtemp.append(data.x[i]) |
---|
27 | ytemp.append(data.y[i]) |
---|
28 | if data.dy is not None and len(data.dy)==len(data.y): |
---|
29 | dytemp.append(data.dy[i]) |
---|
30 | else: |
---|
31 | raise RuntimeError, "Fit._concatenateData: y-errors missinge" |
---|
32 | return xtemp, ytemp,dytemp |
---|
33 | |
---|
34 | |
---|
35 | class Parameter: |
---|
36 | """ |
---|
37 | Class to handle model parameters |
---|
38 | """ |
---|
39 | def __init__(self, model, name, value=None): |
---|
40 | self.model = model |
---|
41 | self.name = name |
---|
42 | if not value==None: |
---|
43 | self.model.setParam(self.name, value) |
---|
44 | |
---|
45 | def set(self, value): |
---|
46 | """ |
---|
47 | Set the value of the parameter |
---|
48 | """ |
---|
49 | self.model.setParam(self.name, value) |
---|
50 | |
---|
51 | def __call__(self): |
---|
52 | """ |
---|
53 | Return the current value of the parameter |
---|
54 | """ |
---|
55 | return self.model.getParam(self.name) |
---|
56 | |
---|
57 | |
---|
58 | |
---|
59 | |
---|
Note: See
TracBrowser
for help on using the repository browser.