Commit 829ca38b authored by alexander.dornheim's avatar alexander.dornheim
Browse files

Added test for tasse AP

parent 6931c211
......@@ -79,6 +79,9 @@ class AP(Algorithm):
change[0] = 999;
gap = change.copy();
if hasattr(self, 'truth'):
Relerrs = change.copy()
tmp1 = prox2.work(u);
while iters < maxiter and change[iters] >= tol:
......@@ -99,6 +102,7 @@ class AP(Algorithm):
z=tmp_u[:,0]
else:
z=tmp_u
Relerrs[iter] = norm(self.truth - exp(-1j*angle(trace(self.truth.T*z))) * z, 'fro')/self.norm_truth
elif q==1:
for j in range(self.product_space_dimension):
......@@ -136,4 +140,4 @@ class AP(Algorithm):
change = change[1:iters+1];
gap = gap[1:iters+1];
return {'u1': u1, 'u2': u2, 'iter': iter, 'change': change, 'gap': gap}
return {'u1': u1, 'u2': u2, 'iter': iters, 'change': change, 'gap': gap}
......@@ -235,9 +235,11 @@ class Phase(Problem):
"""
Routine to test and verify results by comparing to matlab
Note that this is only for development and should not be used by a normal user
For result to match u_0 should be chosen as np.multiply(config['abs_illumination'],exp(1j*2*pi*0.5*np.ones(newres)))'] =
For result to match u_0 should be chosen as np.multiply(config['abs_illumination'],exp(1j*2*pi*0.5*np.ones(newres)))']
"""
print(self.config['proxoperators'])
if self.config['experiment'] == 'JWST':
if self.config['MAXIT'] == 1:
f = h5py.File('Phase_test_data/u1_1.mat')
......@@ -260,17 +262,12 @@ class Phase(Problem):
print("No file available to compare to.")
return
elif self.config['beta_0'] == 0.50:
if self.config['MAXIT'] == 20:
f = h5py.File('Phase_test_data/tasse_u1_20_beta_0_5.mat')
else:
print("No file available to compare to.")
return
f = h5py.File('Phase_test_data/tasse_u1_'+ str(self.config['MAXIT']) + '_beta_0_5.mat')
else:
print("No file available to compare to.")
return
elif self.config['algorithm'] == 'AP':
if self.config['MAXIT'] == 20:
f = h5py.File('Phase_test_data/tasse_u1_ap_20.mat')
f = h5py.File('Phase_test_data/tasse_u1_ap_' + str(self.config['MAXIT']) + '.mat')
u1 = f['u1'].value.view(np.float)
......
......@@ -85,11 +85,11 @@ new_config = {
#if(strcmp('problem_family,'Phase'))
## maximum number of iterations and tolerances
'MAXIT' : 20,
'MAXIT' : 5,
'TOL' : 1e-12,
## relaxaton parameters in RAAR, HPR and HAAR
'beta_0' : 0.95, #0.95 # starting relaxation prameter (only used with
'beta_0' : 0.50, #0.95 # starting relaxation prameter (only used with
# HAAR, HPR and RAAR)
'beta_max' :0.50, # maximum relaxation prameter (only used with
# HAAR, RAAR, and HPR)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment