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
829ca38b
Commit
829ca38b
authored
May 12, 2017
by
alexander.dornheim
Browse files
Added test for tasse AP
parent
6931c211
Changes
3
Hide whitespace changes
Inline
Side-by-side
proxtoolbox/Algorithms/AP.py
View file @
829ca38b
...
...
@@ -78,6 +78,9 @@ class AP(Algorithm):
change
=
zeros
(
maxiter
+
1
);
change
[
0
]
=
999
;
gap
=
change
.
copy
();
if
hasattr
(
self
,
'truth'
):
Relerrs
=
change
.
copy
()
tmp1
=
prox2
.
work
(
u
);
...
...
@@ -93,12 +96,13 @@ class AP(Algorithm):
tmp_change
=
(
norm
(
u
-
tmp_u
,
'fro'
)
/
normM
)
**
2
tmp_gap
=
(
norm
(
tmp1
-
tmp_u
,
'fro'
)
/
normM
)
**
2
if
hasattr
(
self
,
'truth'
):
if
self
.
truth_dim
[
0
]
==
1
:
if
self
.
truth_dim
[
0
]
==
1
:
z
=
tmp_u
[
0
,:]
elif
self
.
truth_dim
[
1
]
==
1
:
elif
self
.
truth_dim
[
1
]
==
1
:
z
=
tmp_u
[:,
0
]
else
:
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'
:
iter
s
,
'change'
:
change
,
'gap'
:
gap
}
proxtoolbox/Problems/Phase/phase.py
View file @
829ca38b
...
...
@@ -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
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
)
...
...
proxtoolbox/Problems/Phase/tasse_raar_in.py
View file @
829ca38b
...
...
@@ -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.
9
5
,
#0.95 # starting relaxation prameter (only used with
'beta_0'
:
0.5
0
,
#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)
...
...
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