Commit 6be97691 authored by Martin Reinecke's avatar Martin Reinecke

adjust demos

parent 5b68568b
Pipeline #16630 passed with stage
in 17 minutes and 42 seconds
......@@ -7,8 +7,9 @@ from nifty import plotting
from keepers import Repository
if __name__ == "__main__":
ift.nifty_configuration['default_distribution_strategy'] = 'fftw'
signal_to_noise = 1.5 # The signal to noise ratioa
signal_to_noise = 1.5 # The signal to noise ratio
# Setting up parameters |\label{code:wf_parameters}|
......@@ -29,7 +30,7 @@ if __name__ == "__main__":
harmonic_space_1 = ift.FFTOperator.get_default_codomain(signal_space_1)
fft_1 = ift.FFTOperator(harmonic_space_1, target=signal_space_1,
domain_dtype=np.complex, target_dtype=np.complex)
power_space_1 = ift.PowerSpace(harmonic_space_1, distribution_strategy='fftw')
power_space_1 = ift.PowerSpace(harmonic_space_1)
mock_power_1 = ift.Field(power_space_1, val=power_spectrum_1,
distribution_strategy='not')
......@@ -67,20 +68,18 @@ if __name__ == "__main__":
distribution_strategy='not')
diagonal = mock_power.power_synthesize(spaces=(0, 1), mean=1, std=0,
real_signal=False,
distribution_strategy='fftw')**2
real_signal=False)**2
S = ift.DiagonalOperator(domain=(harmonic_space_1, harmonic_space_2),
diagonal=diagonal)
np.random.seed(10)
mock_signal = fft(mock_power.power_synthesize(real_signal=True,
distribution_strategy='fftw'))
mock_signal = fft(mock_power.power_synthesize(real_signal=True))
# Setting up a exemplary response
N1_10 = int(N_pixels_1/10)
mask_1 = ift.Field(signal_space_1, val=1., distribution_strategy='fftw')
mask_1 = ift.Field(signal_space_1, val=1.)
mask_1.val[N1_10*7:N1_10*9] = 0.
N2_10 = int(N_pixels_2/10)
......@@ -95,12 +94,10 @@ if __name__ == "__main__":
# Setting up the noise covariance and drawing a random noise realization
N = ift.DiagonalOperator(data_domain, diagonal=mock_signal.var()/signal_to_noise,
bare=True,
distribution_strategy='fftw')
bare=True)
noise = ift.Field.from_random(domain=data_domain, random_type='normal',
std=mock_signal.std()/np.sqrt(signal_to_noise),
mean=0,
distribution_strategy='fftw')
mean=0)
data = R(mock_signal) + noise #|\label{code:wf_mock_data}|
# Wiener filter
......@@ -133,7 +130,7 @@ if __name__ == "__main__":
plotter.plot.zmin = 0.
plotter.plot.zmax = 3.
sm = ift.SmoothingOperator(plot_space, sigma=0.03)
sm = ift.SmoothingOperator.make(plot_space, sigma=0.03)
plotter(ift.log(ift.sqrt(sm(ift.Field(plot_space, val=variance.val.real)))), path='uncertainty.html')
plotter.plot.zmin = np.real(mock_signal.min());
......
......@@ -57,7 +57,7 @@ if __name__ == "__main__":
proby = Proby(signal_space, probe_count=800)
proby(lambda z: fft(wiener_curvature.inverse_times(fft.inverse_times(z)))) #|\label{code:wf_variance_fft_wrap}|
sm = ift.SmoothingOperator(signal_space, sigma=0.03)
sm = ift.SmoothingOperator.make(signal_space, sigma=0.03)
variance = ift.sqrt(sm(proby.diagonal.weight(-1))) #|\label{code:wf_variance_weighting}|
repo = Repository('repo_800.h5')
......
......@@ -26,6 +26,3 @@ multiProber = MultiProber(domain=x)
multiProber(diagOp)
print((f - multiProber.diagonal).norm())
print(f.sum() - multiProber.trace)
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