Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
nam
ProxPython
Commits
43e79d32
Commit
43e79d32
authored
Mar 29, 2017
by
alexander.dornheim
Browse files
Cleaned up some print commands for testing
parent
6b0228d2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Utilities/Utilities.py
View file @
43e79d32
...
...
@@ -123,7 +123,6 @@ def Resize(A, Mnew,Nnew):
Mstep
=
int
(
M
/
Mnew
);
countN
=
-
1
;
print
(
Nstep
);
for
j
in
range
(
0
,
N
,
Nstep
):
countN
=
countN
+
1
;
countM
=
-
1
;
...
...
proxtoolbox/Problems/Phase/JWST_data_processor.py
View file @
43e79d32
...
...
@@ -41,9 +41,6 @@ def JWST_data_processor(config):
Xi_A
=
np
.
fromfile
(
fid
,
dtype
=
'<f'
);
Xi_A
=
Xi_A
.
reshape
((
512
,
512
)).
T
;
print
(
nonzero
(
Xi_A
)[
1
].
size
);
print
(
nonzero
(
Xi_A
));
diversity
=
3
;
with
open
(
'InputData/phase_retrieval/phase_p37.pmod'
,
'r'
)
as
fid
:
...
...
@@ -64,8 +61,6 @@ def JWST_data_processor(config):
theta
=
Utilities
.
Resize
(
theta
,
newres
,
newres
);
Xi_A
=
Utilities
.
Resize
(
Xi_A
,
newres
,
newres
);
print
(
nonzero
(
Xi_A
)[
0
].
size
)
aberration
=
np
.
array
(
[
np
.
zeros
((
newres
,
newres
)),
defocus
,
-
defocus
]);
aberration
=
aberration
.
transpose
((
1
,
2
,
0
));
...
...
@@ -79,10 +74,7 @@ def JWST_data_processor(config):
for
j
in
range
(
diversity
):
Pj
=
np
.
multiply
(
Xi_A
,
exp
(
1j
*
(
aberration
[:,:,
j
]
+
theta
)));
print
(
Pj
[
87
,
97
]);
k
[:,:,
j
]
=
np
.
square
(
abs
(
Utilities
.
FFT
(
Pj
)));
print
(
k
[
87
,
97
,
j
]);
print
(
norm
(
k
[:,:,
j
]));
#clear Pj temp1 temp2 defocus Automatic garbage collection?
...
...
@@ -144,12 +136,5 @@ def JWST_data_processor(config):
config
[
'truth'
]
=
true_object
;
config
[
'truth_dim'
]
=
true_object
.
shape
;
config
[
'norm_truth'
]
=
norm
(
true_object
);
#print(config);
#clear I Y k rt_k Xi_A temp aberration theta
proxtoolbox/Problems/Phase/phase.py
View file @
43e79d32
...
...
@@ -158,7 +158,6 @@ class Phase(Problem):
proj2
=
self
.
config
[
'proxoperators'
][
1
](
self
.
config
)
u_2
=
proj2
.
work
(
u_1
);
print
(
norm
(
self
.
config
[
'u_0'
][:,:,
0
]));
# estimate the gap in the relevant metric
if
self
.
config
[
'Nx'
]
==
1
or
self
.
config
[
'Ny'
]
==
1
:
...
...
@@ -170,11 +169,6 @@ class Phase(Problem):
tmp_gap
=
tmp_gap
+
(
norm
(
u_1
[:,:,
j
]
-
u_2
[:,:,
j
])
/
square
(
self
.
config
[
'norm_rt_data'
]));
gap_0
=
sqrt
(
tmp_gap
);
print
(
gap_0
);
print
(
norm
(
u_1
[:,:,
0
]))
print
(
norm
(
u_2
[:,:,
0
]))
print
(
proj1
)
print
(
proj2
)
# sets the set fattening to be a percentage of the
# initial gap to the unfattened set with
...
...
@@ -209,7 +203,9 @@ class Phase(Problem):
#print(nonzero(self.u1))
#print(self.u1[self.u1.nonzero()]);
print
(
norm
(
self
.
u1
));
print
(
self
.
u1
[
64
,
16
]);
print
(
norm
(
self
.
u2
));
print
(
self
.
u1
[
71
,
46
]);
#print(self.gap);
#print(self.change);
...
...
proxtoolbox/ProxOperators/proxoperators.py
View file @
43e79d32
...
...
@@ -260,23 +260,16 @@ class Approx_P_JWST_Poisson(ProxOperator):
for
j
in
range
(
product_space_dimension
-
1
):
#print(u[:,:,j].nonzero());
#print(norm(data_sq[:,:,j]))
U
=
fft2
(
indicator_ampl
*
exp
(
1j
*
illumination_phase
[:,:,
j
])
*
u
[:,:,
j
]);
U_sq
=
U
*
conj
(
U
);
tmp
=
U_sq
/
data_sq
[:,:,
j
];
#print(tmp);
#tmp2= nonzero(data_zeros[:,j]);
#tmpI = data_zeros[data_zeros[:,j] != 0, j];
mask
=
ones
(
tmp
.
shape
,
np
.
bool
);
#print(mask.shape);
mask
[
data_zeros
[
j
]]
=
0
;
tmp
[
mask
]
=
1
;
U_sq
[
mask
]
=
0
;
IU
=
tmp
==
0
;
tmp
[
IU
]
=
1
;
tmp
=
log
(
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!!!
...
...
@@ -285,7 +278,6 @@ class Approx_P_JWST_Poisson(ProxOperator):
u_new
[:,:,
j
]
=
u
[:,:,
j
]
#else:
# no change
#print(norm(u[:,:,j]));
# now project onto the pupil constraint.
# this is a qualitative constraint, so no
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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