diff options
author | Daniel M. Pelt <D.M.Pelt@cwi.nl> | 2015-07-30 15:34:10 +0200 |
---|---|---|
committer | Daniel M. Pelt <D.M.Pelt@cwi.nl> | 2015-07-30 15:34:10 +0200 |
commit | b4bd441549ea71dd6c34a9f2158bbebc39ba4e9e (patch) | |
tree | 4ede74cb0354c158c4f06450e6da751d18cf3707 /python/astra/optomo.py | |
parent | 43155c03488ca98c24f8f369e5c8699efa20cca3 (diff) | |
download | astra-b4bd441549ea71dd6c34a9f2158bbebc39ba4e9e.tar.gz astra-b4bd441549ea71dd6c34a9f2158bbebc39ba4e9e.tar.bz2 astra-b4bd441549ea71dd6c34a9f2158bbebc39ba4e9e.tar.xz astra-b4bd441549ea71dd6c34a9f2158bbebc39ba4e9e.zip |
Define a transpose for the OpTomo transpose as well
Allows for chaining .T calls.
Diffstat (limited to 'python/astra/optomo.py')
-rw-r--r-- | python/astra/optomo.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/python/astra/optomo.py b/python/astra/optomo.py index 19b07e3..4a64150 100644 --- a/python/astra/optomo.py +++ b/python/astra/optomo.py @@ -197,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) @@ -204,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: |