summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <wjp@usecode.org>2015-08-03 12:01:57 +0200
committerWillem Jan Palenstijn <wjp@usecode.org>2015-08-03 12:01:57 +0200
commit48531b4a4de3020e4c8e84eacbe9db6696adbfbd (patch)
tree4ede74cb0354c158c4f06450e6da751d18cf3707
parent004e25a7afe080bdaddb19e48e426672e6e73479 (diff)
parentb4bd441549ea71dd6c34a9f2158bbebc39ba4e9e (diff)
downloadastra-48531b4a4de3020e4c8e84eacbe9db6696adbfbd.tar.gz
astra-48531b4a4de3020e4c8e84eacbe9db6696adbfbd.tar.bz2
astra-48531b4a4de3020e4c8e84eacbe9db6696adbfbd.tar.xz
astra-48531b4a4de3020e4c8e84eacbe9db6696adbfbd.zip
Merge pull request #86 from dmpelt/scipy-0.16-optomo-fix
Small OpTomo fixes
-rw-r--r--python/astra/optomo.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/python/astra/optomo.py b/python/astra/optomo.py
index 0108674..4a64150 100644
--- a/python/astra/optomo.py
+++ b/python/astra/optomo.py
@@ -86,7 +86,15 @@ class OpTomo(scipy.sparse.linalg.LinearOperator):
self.proj_id = proj_id
- self.T = OpTomoTranspose(self)
+ self.transposeOpTomo = OpTomoTranspose(self)
+ try:
+ self.T = self.transposeOpTomo
+ except AttributeError:
+ # Scipy >= 0.16 defines self.T using self._transpose()
+ pass
+
+ def _transpose(self):
+ return self.transposeOpTomo
def __checkArray(self, arr, shp):
if len(arr.shape)==1:
@@ -189,6 +197,11 @@ class OpTomoTranspose(scipy.sparse.linalg.LinearOperator):
self.parent = parent
self.dtype = np.float32
self.shape = (parent.shape[1], parent.shape[0])
+ try:
+ self.T = self.parent
+ except AttributeError:
+ # Scipy >= 0.16 defines self.T using self._transpose()
+ pass
def _matvec(self, s):
return self.parent.rmatvec(s)
@@ -196,6 +209,9 @@ class OpTomoTranspose(scipy.sparse.linalg.LinearOperator):
def rmatvec(self, v):
return self.parent.matvec(v)
+ def _transpose(self):
+ return self.parent
+
def __mul__(self,s):
# Catch the case of a backprojection of 2D/3D data
if isinstance(s, np.ndarray) and s.shape==self.parent.sshape: