-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathdecTask.py
More file actions
65 lines (51 loc) · 1.81 KB
/
Copy pathdecTask.py
File metadata and controls
65 lines (51 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/python
##################
# block_dec.py
#
# Copyright David Baddeley, 2009
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##################
#f = f3
#import tcluster
#import dec
#from scipy import *
from PYME.misc import taskDef
queueID = None
decObj = None
class decResult:
def __init__(self, task, results, queueID):
self.taskID = task.taskID
self.blocknum = task.blocknum
self.results = results
self.queueID = queueID
class decTask(taskDef.Task):
def __init__(self, queueName, block, blocknum, lamb=1e-2, num_iters=10):
taskDef.Task.__init__(self)
self.queueName = queueName
self.block = block
self.blocknum = blocknum
self.lamb = lamb
self.num_iters = num_iters
def __call__(self, gui=False, taskQueue=None):
global queueID, decObj
if (not queueID == self.queueName) or (not decObj.shape == self.block.shape):
decObj = taskQueue.getQueueData(self.queueName, 'dec')
decObj.prep()
queueID = self.queueName
print((self.blocknum, self.lamb))
res = decObj.deconv(self.block, self.lamb, self.num_iters)
return decResult(self, res, queueID)