Last change
on this file since 1b061a31 was
d85c194,
checked in by Piotr Rozyczko <piotr.rozyczko@…>, 9 years ago
|
Remaining modules refactored
|
-
Property mode set to
100644
|
File size:
1.4 KB
|
Rev | Line | |
---|
[44429d0] | 1 | """ |
---|
| 2 | Thread for Resolution computation |
---|
[49ab5d7] | 3 | """ |
---|
[44429d0] | 4 | import time |
---|
[b699768] | 5 | from sas.sascalc.data_util.calcthread import CalcThread |
---|
[44429d0] | 6 | |
---|
| 7 | class CalcRes(CalcThread): |
---|
| 8 | """ |
---|
| 9 | Compute Resolution |
---|
| 10 | """ |
---|
| 11 | def __init__(self, |
---|
[49ab5d7] | 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 |
---|
[44429d0] | 26 | ): |
---|
| 27 | """ |
---|
| 28 | """ |
---|
[49ab5d7] | 29 | CalcThread.__init__(self, completefn, |
---|
[44429d0] | 30 | updatefn, |
---|
| 31 | yieldtime, |
---|
| 32 | worktime) |
---|
| 33 | self.starttime = 0 |
---|
[49ab5d7] | 34 | self.id = id |
---|
[44429d0] | 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 |
---|
[49ab5d7] | 43 | |
---|
[44429d0] | 44 | def compute(self): |
---|
| 45 | """ |
---|
| 46 | excuting computation |
---|
| 47 | """ |
---|
[49ab5d7] | 48 | self.image = map(self.func, self.qx, self.qy, |
---|
| 49 | self.qx_min, self.qx_max, |
---|
[44429d0] | 50 | self.qy_min, self.qy_max)[0] |
---|
| 51 | elapsed = time.time() - self.starttime |
---|
[49ab5d7] | 52 | |
---|
| 53 | self.complete(image=self.image, |
---|
| 54 | elapsed=elapsed) |
---|
Note: See
TracBrowser
for help on using the repository browser.