Skip to content
Snippets Groups Projects
Commit 9b3d6274 authored by Philipp Arras's avatar Philipp Arras
Browse files

nifty5 -> nifty7 (5/n)

parent 8c9884c9
No related branches found
No related tags found
1 merge request!2Draft: Nifty5 to nifty7
Pipeline #107684 failed
......@@ -28,21 +28,24 @@ for mode in [0, 1]:
power_space = ift.PowerSpace(harmonic_space)
HT = ift.HarmonicTransformOperator(harmonic_space, target=position_space)
# Set up an amplitude operator for the field
dct = {
'target': power_space,
'n_pix': 64, # 64 spectral bins
# Spectral smoothness (affects Gaussian process part)
'a': 10, # relatively high variance of spectral curvature
'k0': .2, # quefrency mode below which cepstrum flattens
# Power-law part of spectrum:
'sm': -4, # preferred power-law slope
'sv': .6, # low variance of power-law slope
'im': -3, # y-intercept mean, in-/decrease for more/less contrast
'iv': 2. # y-intercept variance
args = {
'offset_mean': 0,
'offset_std': (1e-3, 1e-6),
# Amplitude of field fluctuations
'fluctuations': (1., 0.8), # 1.0, 1e-2
# Exponent of power law power spectrum component
'loglogavgslope': (-3., 1), # -6.0, 1
# Amplitude of integrated Wiener process power spectrum component
'flexibility': (2, 1.), # 1.0, 0.5
# How ragged the integrated Wiener process component is
'asperity': (0.5, 0.4) # 0.1, 0.5
}
A = ift.SLAmplitude(**dct)
correlated_field = ift.CorrelatedField(position_space, A)
correlated_field = ift.SimpleCorrelatedField(position_space, **args)
A = correlated_field.amplitude
dct = {}
if mode == 0:
......@@ -64,8 +67,8 @@ for mode in [0, 1]:
# Solve inference problem
ic_sampling = ift.GradientNormController(iteration_limit=100)
ic_newton = ift.GradInfNormController(
name='Newton', tol=1e-6, iteration_limit=50)
ic_newton = ift.GradInfNormController(name='Newton', tol=1e-6,
iteration_limit=10)
minimizer = ift.NewtonCG(ic_newton)
H = ift.StandardHamiltonian(likelihood, ic_sampling)
initial_mean = ift.MultiField.full(H.domain, 0.)
......@@ -73,9 +76,9 @@ for mode in [0, 1]:
N_samples = 5
for _ in range(5):
# Draw new samples and minimize KL
KL = ift.MetricGaussianKL(mean, H, N_samples)
KL = ift.MetricGaussianKL(mean, H, N_samples, True)
KL, convergence = minimizer(KL)
mean = KL.position
N_posterior_samples = 30
KL = ift.MetricGaussianKL(mean, H, N_posterior_samples)
KL = ift.MetricGaussianKL(mean, H, N_posterior_samples, True)
h.plot_reconstruction_2d(data, ground_truth, KL, signal, R, A, name[mode])
......@@ -44,7 +44,7 @@ def exposure_response(position_space):
exposure[:, x_shape*4//5:x_shape] *= .1
exposure[:, x_shape//2:x_shape*3//2] *= 3.
exposure = ift.Field.makeField(position_space, exposure)
exposure = ift.makeField(position_space, exposure)
E = ift.makeOp(exposure)
G = ift.GeometryRemover(E.target)
return G @ E
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment