Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nam
ProxPython
Commits
5341fa48
Commit
5341fa48
authored
Mar 29, 2017
by
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
Changes
3
Hide whitespace changes
Inline
Side-by-side
proxtoolbox/Problems/Phase/JWST_in.py
View file @
5341fa48
...
...
@@ -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'],
...
...
proxtoolbox/Problems/Phase/phase.py
View file @
5341fa48
...
...
@@ -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
);
...
...
proxtoolbox/ProxOperators/proxoperators.py
View file @
5341fa48
...
...
@@ -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!!!
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment