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 7c75ad53 was
44429d0,
checked in by Jae Cho <jhjcho@…>, 13 years ago
|
tread for rescal
|
-
Property mode set to
100644
|
File size:
1.5 KB
|
Rev | Line | |
---|
[44429d0] | 1 | """ |
---|
| 2 | Thread for Resolution computation |
---|
| 3 | """ |
---|
| 4 | import time |
---|
| 5 | from data_util.calcthread import CalcThread |
---|
| 6 | import sys |
---|
| 7 | |
---|
| 8 | class CalcRes(CalcThread): |
---|
| 9 | """ |
---|
| 10 | Compute Resolution |
---|
| 11 | """ |
---|
| 12 | def __init__(self, |
---|
| 13 | id=-1, |
---|
| 14 | func = None, |
---|
| 15 | qx = None, |
---|
| 16 | qy = None, |
---|
| 17 | qx_min = None, |
---|
| 18 | qx_max = None, |
---|
| 19 | qy_min = None, |
---|
| 20 | qy_max = None, |
---|
| 21 | image = None, |
---|
| 22 | completefn = None, |
---|
| 23 | updatefn = None, |
---|
| 24 | elapsed = 0, |
---|
| 25 | yieldtime = 0.01, |
---|
| 26 | worktime = 0.01 |
---|
| 27 | ): |
---|
| 28 | """ |
---|
| 29 | """ |
---|
| 30 | CalcThread.__init__(self,completefn, |
---|
| 31 | updatefn, |
---|
| 32 | yieldtime, |
---|
| 33 | worktime) |
---|
| 34 | self.starttime = 0 |
---|
| 35 | self.id = id |
---|
| 36 | self.func = func |
---|
| 37 | self.qx = qx |
---|
| 38 | self.qy = qy |
---|
| 39 | self.qx_min = qx_min |
---|
| 40 | self.qx_max = qx_max |
---|
| 41 | self.qy_min = qy_min |
---|
| 42 | self.qy_max = qy_max |
---|
| 43 | self.image = image |
---|
| 44 | |
---|
| 45 | |
---|
| 46 | def compute(self): |
---|
| 47 | """ |
---|
| 48 | excuting computation |
---|
| 49 | """ |
---|
| 50 | self.image = map(self.func, self.qx, self.qy, |
---|
| 51 | self.qx_min, self.qx_max, |
---|
| 52 | self.qy_min, self.qy_max)[0] |
---|
| 53 | elapsed = time.time() - self.starttime |
---|
| 54 | |
---|
| 55 | self.complete(image = self.image, |
---|
| 56 | elapsed = elapsed) |
---|
| 57 | |
---|
| 58 | |
---|
| 59 | |
---|
| 60 | |
---|
Note: See
TracBrowser
for help on using the repository browser.