summaryrefslogtreecommitdiffstats
path: root/Wrappers/Python
diff options
context:
space:
mode:
authorepapoutsellis <epapoutsellis@gmail.com>2019-04-20 18:48:00 +0100
committerepapoutsellis <epapoutsellis@gmail.com>2019-04-20 18:48:00 +0100
commitcc774263646d61bbc224911903e4e2e8f5e323dc (patch)
treee80aab421f9a017382aeddc53efe9bdd89eba9f1 /Wrappers/Python
parent55691dadd3a8b3755e25f398236e9d9a46e5f8c3 (diff)
downloadframework-cc774263646d61bbc224911903e4e2e8f5e323dc.tar.gz
framework-cc774263646d61bbc224911903e4e2e8f5e323dc.tar.bz2
framework-cc774263646d61bbc224911903e4e2e8f5e323dc.tar.xz
framework-cc774263646d61bbc224911903e4e2e8f5e323dc.zip
change to ZeroOperator
Diffstat (limited to 'Wrappers/Python')
-rw-r--r--Wrappers/Python/ccpi/optimisation/operators/ZeroOperator.py26
1 files changed, 15 insertions, 11 deletions
diff --git a/Wrappers/Python/ccpi/optimisation/operators/ZeroOperator.py b/Wrappers/Python/ccpi/optimisation/operators/ZeroOperator.py
index a7c5f09..d5fd8ae 100644
--- a/Wrappers/Python/ccpi/optimisation/operators/ZeroOperator.py
+++ b/Wrappers/Python/ccpi/optimisation/operators/ZeroOperator.py
@@ -8,32 +8,36 @@ Created on Wed Mar 6 19:25:53 2019
import numpy as np
from ccpi.framework import ImageData
-from ccpi.optimisation.operators import Operator
+from ccpi.optimisation.operators import LinearOperator
-class ZeroOp(Operator):
+class ZeroOperator(LinearOperator):
- def __init__(self, gm_domain, gm_range):
+ def __init__(self, gm_domain, gm_range=None):
+
self.gm_domain = gm_domain
- self.gm_range = gm_range
- super(ZeroOp, self).__init__()
+ self.gm_range = gm_range
+ if self.gm_range is None:
+ self.gm_range = self.gm_domain
+
+ super(ZeroOperator, self).__init__()
def direct(self,x,out=None):
if out is None:
- return ImageData(np.zeros(self.gm_range))
+ return self.gm_range.allocate()
else:
- return ImageData(np.zeros(self.gm_range))
+ return self.gm_range.allocate()
def adjoint(self,x, out=None):
if out is None:
- return ImageData(np.zeros(self.gm_domain))
+ return self.gm_domain.allocate()
else:
- return ImageData(np.zeros(self.gm_domain))
+ return self.gm_domain.allocate()
def norm(self):
return 0
- def domain_dim(self):
+ def domain_geometry(self):
return self.gm_domain
- def range_dim(self):
+ def range_geometry(self):
return self.gm_range \ No newline at end of file