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
7e893d25
Commit
7e893d25
authored
Jul 02, 2018
by
Jakob Knollmueller
Browse files
everything seems to work and looks nice
parent
df578915
Changes
3
Hide whitespace changes
Inline
Side-by-side
demos/getting_started_1.py
View file @
7e893d25
...
...
@@ -22,13 +22,13 @@ if __name__ == '__main__':
# Choose problem geometry and masking
#
#
One dimensional regular grid
#
position_space = ift.RGSpace([1024])
#
mask = np.ones(position_space.shape)
# One dimensional regular grid
position_space
=
ift
.
RGSpace
([
1024
])
mask
=
np
.
ones
(
position_space
.
shape
)
# Two dimensional regular grid with chess mask
position_space
=
ift
.
RGSpace
([
128
,
128
])
mask
=
make_chess_mask
()
#
#
Two dimensional regular grid with chess mask
#
position_space = ift.RGSpace([128,128])
#
mask = make_chess_mask()
# # Sphere with half of its locations randomly masked
# position_space = ift.HPSpace(128)
...
...
demos/getting_started_2.py
View file @
7e893d25
...
...
@@ -19,10 +19,10 @@ def get_2D_exposure():
if
__name__
==
'__main__'
:
# ABOUT THIS CODE
np
.
random
.
seed
(
4
2
)
np
.
random
.
seed
(
4
1
)
# Set up the position space of the signal
#
# # One dimensional regular grid with uniform exposure
# position_space = ift.RGSpace(1024)
# exposure = np.ones(position_space.shape)
...
...
@@ -84,5 +84,6 @@ if __name__ == '__main__':
# Plot results
result_sky
=
sky
.
at
(
H
.
position
).
value
##PLOTTING
demos/getting_started_3.py
View file @
7e893d25
...
...
@@ -3,6 +3,7 @@ from nifty5.library.los_response import LOSResponse
from
nifty5.library.amplitude_model
import
make_amplitude_model
from
nifty5.library.smooth_sky
import
make_correlated_field
import
numpy
as
np
from
scipy.io
import
loadmat
def
get_random_LOS
(
n_los
):
...
...
@@ -11,9 +12,9 @@ def get_random_LOS(n_los):
return
starts
,
ends
if
__name__
==
'__main__'
:
np
.
random
.
seed
(
41
)
### ABOUT THIS TUTORIAL
np
.
random
.
seed
(
42
)
position_space
=
ift
.
RGSpace
([
128
,
128
])
# Setting up an amplitude model
...
...
@@ -33,14 +34,13 @@ if __name__ == '__main__':
correlated_field_h
=
Amp
*
xi
correlated_field
=
ht
(
correlated_field_h
)
# # alternatively to the block above one can do:
# correlated_field, _ = make_correlated_field(position_space,A)
# correlated_field, _ = make_correlated_field(position_space,
A)
# apply some nonlinearity
signal
=
ift
.
PointwisePositiveTanh
(
correlated_field
)
# Building the Line of Sight response
LOS_starts
,
LOS_ends
=
get_random_LOS
(
100
0
)
LOS_starts
,
LOS_ends
=
get_random_LOS
(
100
)
R
=
LOSResponse
(
position_space
,
starts
=
LOS_starts
,
ends
=
LOS_ends
)
# build signal response model and model likelihood
signal_response
=
R
(
signal
)
# specify noise
...
...
@@ -73,7 +73,7 @@ if __name__ == '__main__':
ift
.
plot
([
A
.
at
(
MOCK_POSITION
).
value
],
name
=
'power.pdf'
)
# number of samples used to estimate the KL
N_samples
=
1
0
N_samples
=
2
0
for
i
in
range
(
5
):
H
=
H
.
at
(
position
)
samples
=
[
H
.
curvature
.
draw_sample
(
from_inverse
=
True
)
for
_
in
range
(
N_samples
)]
...
...
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