Commit 64ea7dd9 authored by Martin Reinecke's avatar Martin Reinecke

Merge branch 'demos' of gitlab.mpcdf.mpg.de:ift/nifty-dev into demos

parents eb20869a 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)
......
......@@ -19,10 +19,10 @@ def get_2D_exposure():
if __name__ == '__main__':
# ABOUT THIS CODE
np.random.seed(42)
np.random.seed(41)
# 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
......@@ -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(1000)
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 = 10
N_samples = 20
for i in range(5):
H = H.at(position)
samples = [H.curvature.draw_sample(from_inverse=True) for _ in range(N_samples)]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment