Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
NIFTy
Commits
8301906c
Commit
8301906c
authored
Oct 17, 2017
by
Martin Reinecke
Browse files
cosmetics
parent
011fe3fa
Pipeline
#20052
passed with stage
in 4 minutes and 53 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
demos/wiener_filter_via_hamiltonian.py
View file @
8301906c
...
...
@@ -55,7 +55,7 @@ if __name__ == "__main__":
ss
=
fft
.
adjoint_times
(
sh
)
# Choosing the measurement instrument
#Instrument = ift.FFTSmoothingOperator(s_space, sigma=0.05)
#
Instrument = ift.FFTSmoothingOperator(s_space, sigma=0.05)
diag
=
ift
.
Field
.
ones
(
s_space
)
diag
.
val
[
20
:
80
,
20
:
80
]
=
0
Instrument
=
ift
.
DiagonalOperator
(
diag
.
weight
(
-
1
))
...
...
@@ -66,9 +66,9 @@ if __name__ == "__main__":
ndiag
=
ift
.
Field
.
full
(
s_space
,
ss
.
var
()
/
signal_to_noise
)
N
=
ift
.
DiagonalOperator
(
ndiag
)
n
=
ift
.
Field
.
from_random
(
domain
=
s_space
,
random_type
=
'normal'
,
std
=
ss
.
std
()
/
np
.
sqrt
(
signal_to_noise
),
mean
=
0
)
random_type
=
'normal'
,
std
=
ss
.
std
()
/
np
.
sqrt
(
signal_to_noise
),
mean
=
0
)
# Creating the mock data
d
=
R
(
sh
)
+
n
...
...
@@ -76,20 +76,21 @@ if __name__ == "__main__":
# Choosing the minimization strategy
ctrl
=
ift
.
GradientNormController
(
verbose
=
True
,
tol_abs_gradnorm
=
0.1
)
ctrl
=
ift
.
GradientNormController
(
verbose
=
True
,
tol_abs_gradnorm
=
0.1
)
inverter
=
ift
.
ConjugateGradient
(
controller
=
ctrl
)
controller
=
ift
.
GradientNormController
(
verbose
=
True
,
tol_abs_gradnorm
=
0.1
)
controller
=
ift
.
GradientNormController
(
verbose
=
True
,
tol_abs_gradnorm
=
0.1
)
minimizer
=
ift
.
RelaxedNewton
(
controller
=
controller
)
m0
=
ift
.
Field
.
zeros
(
h_space
)
# Initializing the Wiener Filter energy
energy
=
ift
.
library
.
WienerFilterEnergy
(
position
=
m0
,
d
=
d
,
R
=
R
,
N
=
N
,
S
=
S
,
inverter
=
inverter
)
inverter
=
inverter
)
energy
,
convergence
=
minimizer
(
energy
)
m
=
energy
.
position
D
=
energy
.
curvature
ift
.
plotting
.
plot
(
ss
,
name
=
"signal.pdf"
,
colormap
=
"Planck-like"
)
ift
.
plotting
.
plot
(
fft
.
inverse_times
(
m
),
name
=
"m.pdf"
,
colormap
=
"Planck-like"
)
ift
.
plotting
.
plot
(
fft
.
inverse_times
(
m
),
name
=
"m.pdf"
,
colormap
=
"Planck-like"
)
# sampling the uncertainty map
sample_variance
=
ift
.
Field
.
zeros
(
s_space
)
...
...
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