summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdoardo Pasca <edo.paskino@gmail.com>2019-04-26 11:17:32 +0100
committerEdoardo Pasca <edo.paskino@gmail.com>2019-04-26 11:17:32 +0100
commitc39df4e997039c61f8a3bb883bf135d88db2498e (patch)
treef4471ff1dd9ff6ba4d7ef6ba8540cb7e6f0f01a7
parenta0c532bc1e55574aa5262901614545bdfb006dc7 (diff)
downloadframework-c39df4e997039c61f8a3bb883bf135d88db2498e.tar.gz
framework-c39df4e997039c61f8a3bb883bf135d88db2498e.tar.bz2
framework-c39df4e997039c61f8a3bb883bf135d88db2498e.tar.xz
framework-c39df4e997039c61f8a3bb883bf135d88db2498e.zip
demo updated
-rw-r--r--Wrappers/Python/demos/pdhg_TV_tomography2Dccpi.py21
1 files changed, 12 insertions, 9 deletions
diff --git a/Wrappers/Python/demos/pdhg_TV_tomography2Dccpi.py b/Wrappers/Python/demos/pdhg_TV_tomography2Dccpi.py
index 70ca57a..9de48a5 100644
--- a/Wrappers/Python/demos/pdhg_TV_tomography2Dccpi.py
+++ b/Wrappers/Python/demos/pdhg_TV_tomography2Dccpi.py
@@ -21,7 +21,8 @@ from ccpi.optimisation.functions import ZeroFunction, L2NormSquared, \
MixedL21Norm, BlockFunction, ScaledFunction
#from ccpi.astra.ops import AstraProjectorSimple
-from ccpi.plugins.ops import CCPiProjectorSimple
+#from ccpi.plugins.ops import CCPiProjectorSimple
+from ccpi.plugins.operators import CCPiProjectorSimple
#from skimage.util import random_noise
from timeit import default_timer as timer
@@ -90,8 +91,8 @@ ag = AcquisitionGeometry('parallel',
det_w)
from ccpi.reconstruction.parallelbeam import alg as pbalg
-#from ccpi.plugins.processors import setupCCPiGeometries
-def setupCCPiGeometries(ig, ag, counter):
+from ccpi.plugins.processors import setupCCPiGeometries
+def ssetupCCPiGeometries(ig, ag, counter):
#vg = ImageGeometry(voxel_num_x=voxel_num_x,voxel_num_y=voxel_num_y, voxel_num_z=voxel_num_z)
#Phantom_ccpi = ImageData(geometry=vg,
@@ -221,16 +222,16 @@ normK = operator.norm()
# Primal & dual stepsizes
sigma = 1
tau = 1/(sigma*normK**2)
-niter = 3
+niter = 50
opt = {'niter':niter}
opt1 = {'niter':niter, 'memopt': True}
-pdhg1 = PDHG(f=f,g=g, operator=operator, tau=tau, sigma=sigma)
-pdhg1.max_iteration = 2000
-pdhg1.update_objective_interval = 10
-pdhg2 = PDHG(f=f,g=g, operator=operator, tau=tau, sigma=sigma, memopt=True)
+pdhg1 = PDHG(f=f,g=g, operator=operator, tau=tau, sigma=sigma, memopt=True, max_iteration=niter)
+#pdhg1.max_iteration = 2000
+pdhg1.update_objective_interval = 100
+pdhg2 = PDHG(f=f,g=g, operator=operator, tau=tau, sigma=sigma, memopt=False)
pdhg2.max_iteration = 2000
pdhg2.update_objective_interval = 100
@@ -238,12 +239,14 @@ t1_old = timer()
resold, time, primal, dual, pdgap = PDHG_old(f, g, operator, tau = tau, sigma = sigma, opt = opt)
t2_old = timer()
+print ("memopt = False, shouldn't matter")
pdhg1.run(niter)
print (sum(pdhg1.timing))
res = pdhg1.get_output().subset(vertical=0)
-
+print (pdhg1.objective)
t3 = timer()
#res1, time1, primal1, dual1, pdgap1 = PDHG_old(f, g, operator, tau = tau, sigma = sigma, opt = opt1)
+print ("memopt = True, shouldn't matter")
pdhg2.run(niter)
print (sum(pdhg2.timing))
res1 = pdhg2.get_output().subset(vertical=0)