Last change
on this file since 6d96bf9 was
959eb01,
checked in by ajj, 8 years ago
|
normalising line endings
|
-
Property mode set to
100644
|
File size:
1.4 KB
|
Rev | Line | |
---|
[959eb01] | 1 | """ |
---|
| 2 | Thread for Resolution computation |
---|
| 3 | """ |
---|
| 4 | import time |
---|
| 5 | from sas.sascalc.data_util.calcthread import CalcThread |
---|
| 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 | def compute(self): |
---|
| 45 | """ |
---|
| 46 | excuting computation |
---|
| 47 | """ |
---|
| 48 | self.image = map(self.func, self.qx, self.qy, |
---|
| 49 | self.qx_min, self.qx_max, |
---|
| 50 | self.qy_min, self.qy_max)[0] |
---|
| 51 | elapsed = time.time() - self.starttime |
---|
| 52 | |
---|
| 53 | self.complete(image=self.image, |
---|
[49ab5d7] | 54 | elapsed=elapsed) |
---|
Note: See
TracBrowser
for help on using the repository browser.