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
ift
NIFTy
Commits
aa0b1292
Commit
aa0b1292
authored
Jul 10, 2018
by
Philipp Arras
Browse files
Cosmetics
parent
69da894e
Changes
1
Hide whitespace changes
Inline
Side-by-side
demos/getting_started_1.py
View file @
aa0b1292
...
...
@@ -18,9 +18,9 @@ def make_random_mask():
if
__name__
==
'__main__'
:
# # description of the tutorial ###
np
.
random
.
seed
(
42
)
# FIXME description of the tutorial
# Choose problem geometry and masking
# One dimensional regular grid
...
...
@@ -28,7 +28,7 @@ if __name__ == '__main__':
mask
=
np
.
ones
(
position_space
.
shape
)
# # Two dimensional regular grid with chess mask
# position_space = ift.RGSpace([128,128])
# position_space = ift.RGSpace([128,
128])
# mask = make_chess_mask(position_space)
# # Sphere with half of its locations randomly masked
...
...
@@ -38,7 +38,7 @@ if __name__ == '__main__':
harmonic_space
=
position_space
.
get_default_codomain
()
HT
=
ift
.
HarmonicTransformOperator
(
harmonic_space
,
target
=
position_space
)
#
s
et correlation structure with a power spectrum and build
#
S
et correlation structure with a power spectrum and build
# prior correlation covariance
def
power_spectrum
(
k
):
return
100.
/
(
20.
+
k
**
3
)
...
...
@@ -48,7 +48,7 @@ if __name__ == '__main__':
S
=
ift
.
DiagonalOperator
(
prior_correlation_structure
)
#
b
uild instrument response consisting of a discretization, mask
#
B
uild instrument response consisting of a discretization, mask
# and harmonic transformaion
GR
=
ift
.
GeometryRemover
(
position_space
)
mask
=
ift
.
Field
.
from_global_data
(
position_space
,
mask
)
...
...
@@ -57,19 +57,19 @@ if __name__ == '__main__':
data_space
=
GR
.
target
#
s
et
ting
the noise covariance
#
S
et the noise covariance
noise
=
5.
N
=
ift
.
ScalingOperator
(
noise
,
data_space
)
#
c
reat
ing
mock data
#
C
reat
e
mock data
MOCK_SIGNAL
=
S
.
draw_sample
()
MOCK_NOISE
=
N
.
draw_sample
()
data
=
R
(
MOCK_SIGNAL
)
+
MOCK_NOISE
#
b
uild
ing
propagator D and information source j
#
B
uild propagator D and information source j
j
=
R
.
adjoint_times
(
N
.
inverse_times
(
data
))
D_inv
=
R
.
adjoint
*
N
.
inverse
*
R
+
S
.
inverse
#
m
ake it invertible
#
M
ake it invertible
IC
=
ift
.
GradientNormController
(
iteration_limit
=
500
,
tol_abs_gradnorm
=
1e-3
)
D
=
ift
.
InversionEnabler
(
D_inv
,
IC
,
approximation
=
S
.
inverse
).
inverse
...
...
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