Commit 2a6e9fa2 authored by alexander.dornheim's avatar alexander.dornheim
Browse files

Made two small corrections in RAAR (beta calculation)

Added another test
parent baea9872
......@@ -88,13 +88,15 @@ class RAAR(Algorithm):
tmp1 = 2*self.prox2.work(u) - u
shadow = self.prox1.work(u)
##### LOOP
while iter < maxiter and shadow_change[iter] >= tol:
tmp = exp((-iter/self.beta_switch)**3);
tmp = exp((-(iter+1)/self.beta_switch)**3);
beta = (tmp*self.beta_0) + ((1-tmp)*self.beta_max)
iter += 1;
tmp3 = self.prox1.work(tmp1)
......@@ -105,6 +107,8 @@ class RAAR(Algorithm):
tmp_change = 0; tmp_gap = 0; tmp_shadow=0;
#print(norm(tmp_u))
if p==1 and q==1:
tmp_change= (norm(u-tmp_u, 'fro')/normM)**2
tmp_shadow = (norm(tmp3-shadow,'fro')/normM)**2
......@@ -161,6 +165,9 @@ class RAAR(Algorithm):
elif self.Ny == 1:
u1 = tmp[0,:];
u2 = tmp2[0,:];
elif self.Nz == 1 and tmp.ndim > 2:
u1 = tmp[:,:,1]
u2 = tmp2[:,:,1]
else:
u1 = tmp;
u2 = tmp2;
......
......@@ -180,7 +180,7 @@ class Phase(Problem):
print(self.config['norm_rt_data'])
#print(nonzero(u_1))
print(u_1[51,55]);
print(size(self.config['support_idx'][1]))
#print(size(self.config['support_idx'][1]))
print(u_2[51,55])
print(proj2)
......@@ -325,4 +325,23 @@ class Phase(Problem):
print(norm(rt_data))
print("Frobenius norm of python rt_data:")
print(norm(self.config['rt_data']))
if self.config['data_filename'] == 'CDI_data_processor':
f = h5py.File('Phase_test_data/CDI_data_processor_S.mat')
S = f['S'].value.view(np.float)
S =np.array(S)
S = S.T
print("Compare S:")
print("Nonzero indices equal:")
print(np.array_equal(nonzero(S),nonzero(self.config['abs_illumination'])))
diff = S - self.config['abs_illumination']
print("Maximum norm of difference:")
print(np.amax(abs(diff)));
print("Frobenius norm of difference:")
print(norm(diff))
print("Frobenius norm of matlab S:")
print(norm(S))
print("Frobenius norm of python S:")
print(norm(self.config['abs_illumination']))
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