From fdc6c564722d6b93f62310d5ba57f03173028b7e Mon Sep 17 00:00:00 2001
From: "Jakob Jorgensen, WS at HMXIF" <jakob.jorgensen@manchester.ac.uk>
Date: Tue, 16 Apr 2019 16:19:39 +0100
Subject: Copied SIRT manually

---
 .../Python/ccpi/optimisation/algorithms/SIRT.py    | 58 +++++++++++-----------
 1 file changed, 30 insertions(+), 28 deletions(-)

(limited to 'Wrappers')

diff --git a/Wrappers/Python/ccpi/optimisation/algorithms/SIRT.py b/Wrappers/Python/ccpi/optimisation/algorithms/SIRT.py
index 9fc3b8e..cb8b731 100644
--- a/Wrappers/Python/ccpi/optimisation/algorithms/SIRT.py
+++ b/Wrappers/Python/ccpi/optimisation/algorithms/SIRT.py
@@ -2,41 +2,44 @@
 # -*- coding: utf-8 -*-
 """
 Created on Wed Apr 10 13:39:35 2019
- @author: jakob
+
+@author: jakob
 """
 
- # -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
 #   This work is part of the Core Imaging Library developed by
 #   Visual Analytics and Imaging System Group of the Science Technology
 #   Facilities Council, STFC
 
- #   Copyright 2018 Edoardo Pasca
+#   Copyright 2018 Edoardo Pasca
 
- #   Licensed under the Apache License, Version 2.0 (the "License");
+#   Licensed under the Apache License, Version 2.0 (the "License");
 #   you may not use this file except in compliance with the License.
 #   You may obtain a copy of the License at
 
- #       http://www.apache.org/licenses/LICENSE-2.0
+#       http://www.apache.org/licenses/LICENSE-2.0
 
- #   Unless required by applicable law or agreed to in writing, software
+#   Unless required by applicable law or agreed to in writing, software
 #   distributed under the License is distributed on an "AS IS" BASIS,
 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 #   See the License for the specific language governing permissions and
 #   limitations under the License.
 """
 Created on Thu Feb 21 11:11:23 2019
- @author: ofn77899
+
+@author: ofn77899
 """
 
 from ccpi.optimisation.algorithms import Algorithm
 from ccpi.framework import ImageData, AcquisitionData
 
- #from collections.abc import Iterable
+#from collections.abc import Iterable
 class SIRT(Algorithm):
 
     '''Simultaneous Iterative Reconstruction Technique
+
     Parameters:
-     x_init: initial guess
+      x_init: initial guess
       operator: operator for forward/backward projections
       data: data to operate on
       constraint: Function with prox-method, for example IndicatorBox to 
@@ -55,18 +58,18 @@ class SIRT(Algorithm):
                                operator=kwargs['operator'],
                                data    =kwargs['data'])
 
-     def set_up(self, x_init, operator , data, constraint=None ):
-
-         self.x = x_init.copy()
+    def set_up(self, x_init, operator , data, constraint=None ):
+        
+        self.x = x_init.copy()
         self.operator = operator
         self.data = data
         self.constraint = constraint
-
-         self.r = data.copy()
-
-         self.relax_par = 1.0
-
-         # Set up scaling matrices D and M.
+        
+        self.r = data.copy()
+        
+        self.relax_par = 1.0
+        
+        # Set up scaling matrices D and M.
         im1 = ImageData(geometry=self.x.geometry)
         im1.array[:] = 1.0
         self.M = 1/operator.direct(im1)
@@ -75,15 +78,14 @@ class SIRT(Algorithm):
         self.D = 1/operator.adjoint(aq1)
 
 
-     def update(self):
-
-         self.r = self.data - self.operator.direct(self.x)
-
-         self.x += self.relax_par * (self.D*self.operator.adjoint(self.M*self.r))
-
-         if self.constraint != None:
+    def update(self):
+        
+        self.r = self.data - self.operator.direct(self.x)
+        
+        self.x += self.relax_par * (self.D*self.operator.adjoint(self.M*self.r))
+        
+        if self.constraint != None:
             self.x = self.constraint.prox(self.x,None)
 
-     def update_objective(self):
-        self.loss.append(self.r.squared_norm()) 
-        
\ No newline at end of file
+    def update_objective(self):
+        self.loss.append(self.r.squared_norm())
\ No newline at end of file
-- 
cgit v1.2.3