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