Commit 5341fa48 authored by alexander.dornheim's avatar alexander.dornheim
Browse files

Corrected dimension in JWST_in, but still duplicate definition of product_space-dimension and dim

Fixed bugs in phase.py
parent ccea0572
......@@ -48,7 +48,7 @@ new_config = {
'Ny' : 128,
'Nz' : 1, # do not formulate in the product space
'dim' : 3, #size of the product space
'dim' : 4, #size of the product space
#if 'distance' =='near field':
# 'fresnel_nr' : 1*2*pi*config['Nx'],
......
......@@ -4,6 +4,8 @@ from proxtoolbox.Problems.problems import Problem
from proxtoolbox import Algorithms
from proxtoolbox import ProxOperators
from proxtoolbox.ProxOperators.proxoperators import ProxOperator
from numpy.linalg import norm
from numpy import square, sqrt
class Phase(Problem):
......@@ -152,18 +154,19 @@ class Phase(Problem):
end;
else: #i.e. formulation=='product space'
proj1 = self.config['proxoperators'][0](self.config)
print(proj1);
u_1 = proj1.work(self.config['u_0']);
proj2 = self.config['proxoperators'][1](self.config)
u_2 = proj2.work(self.config['u_0']);
u_2 = proj2.work(u_1);
# estimate the gap in the relevant metric
if self.config['Nx'] ==1 or self.config['Ny']==1 :
tmp_gap = (norm(u_1-u_2)/input.norm_rt_data)^2;
tmp_gap = square(norm(u_1-u_2)/self.config['norm_rt_data']);
else:
tmp_gap=0;
for j in range(self.config['product_space_dimension']):
# compute (||P_Sx-P_Mx||/normM)^2:
tmp_gap = tmp_gap+(norm(u_1[:,:,j]-u_2[:,:,j])/config['norm_rt_data'])^2;
tmp_gap = tmp_gap+(norm(u_1[:,:,j]-u_2[:,:,j])/square(self.config['norm_rt_data']));
gap_0=sqrt(tmp_gap);
......
......@@ -272,7 +272,7 @@ class Approx_P_JWST_Poisson(ProxOperator):
IU= tmp==0;
tmp[IU]=1;
tmp=log(tmp);
print(tmp);
#print(tmp);
hU = sum(sum(U_sq *tmp + data_sq[:,:,j] - U_sq));
if hU>=epsilon+TOL2:
U0 = magproj(U,data[:,:,j]); #argument order changed compared to matlab implementation!!!
......@@ -313,5 +313,6 @@ class P_amp(ProxOperator):
self.amplitude = config['amplitude'];
def work(self,u):
print("1");
return magproj(u,self.amplitude); #argument order changed compared to matlab implementation!!!
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