source: sasview/src/sas/sasgui/perspectives/calculator/resolcal_thread.py @ b64b87c

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 b64b87c was d85c194, checked in by Piotr Rozyczko <piotr.rozyczko@…>, 8 years ago

Remaining modules refactored

  • Property mode set to 100644
File size: 1.4 KB
Line 
1"""
2Thread for Resolution computation
3"""
4import time
5from sas.sascalc.data_util.calcthread import CalcThread
6
7class 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,
54                      elapsed=elapsed)
Note: See TracBrowser for help on using the repository browser.