Commit 70b5b7cd by Martin Reinecke

### first iteration

parent 0c5937f2
 from point_separation import build_problem, problem_iteration from point_separation import build_problem, problem_iteration from nifty2go import * import nifty4 as ift import numpy as np import numpy as np from matplotlib import rc from matplotlib import rc rc('font',**{'family':'serif','serif':['Palatino']}) rc('font',**{'family':'serif','serif':['Palatino']}) ... @@ -8,15 +8,15 @@ from matplotlib import pyplot as plt ... @@ -8,15 +8,15 @@ from matplotlib import pyplot as plt np.random.seed(42) np.random.seed(42) if __name__ == '__main__': if __name__ == '__main__': s_space = RGSpace([1024]) s_space = ift.RGSpace([1024]) FFT = FFTOperator(s_space) FFT = ift.FFTOperator(s_space) h_space = FFT.target[0] h_space = FFT.target[0] p_space = PowerSpace(h_space) p_spec = lambda k: (1./(1+k)**2.5) sp = Field(p_space, val=1./(1+p_space.k_lengths)**2.5 ) S = ift.create_power_operator(h_space, power_spectrum=p_spec) sh = power_synthesize(sp) sh = S.draw_sample() s = FFT.adjoint_times(sh) s = FFT.adjoint_times(sh) u = Field(s_space, val = -12) u = ift.Field(s_space, val = -12) u.val[200] = 1 u.val[200] = 1 u.val[300] = 3 u.val[300] = 3 u.val[500] = 4 u.val[500] = 4 ... @@ -27,7 +27,7 @@ if __name__ == '__main__': ... @@ -27,7 +27,7 @@ if __name__ == '__main__': u.val[652] = 1 u.val[652] = 1 u.val[1002] = 2.5 u.val[1002] = 2.5 d = exp(s) + exp(u) d = ift.exp(s) + ift.exp(u) data = d.val data = d.val energy1 = build_problem(data,1.25) energy1 = build_problem(data,1.25) ... @@ -45,17 +45,17 @@ if __name__ == '__main__': ... @@ -45,17 +45,17 @@ if __name__ == '__main__': f, (ax0, ax1,ax2) = plt.subplots(3, sharex=True, sharey=True) f, (ax0, ax1,ax2) = plt.subplots(3, sharex=True, sharey=True) plt.suptitle('diffuse components', size=size) plt.suptitle('diffuse components', size=size) ax0.plot(exp(energy1.s).val, 'k-') ax0.plot(ift.exp(energy1.s).val, 'k-') ax0.yaxis.set_label_position("right") ax0.yaxis.set_label_position("right") ax0.set_ylabel(r'$\alpha = 1.25$', size=size) ax0.set_ylabel(r'$\alpha = 1.25$', size=size) ax0.set_ylim(1e-1,1e3) ax0.set_ylim(1e-1,1e3) ax0.set_yscale("log") ax0.set_yscale("log") ax1.plot(exp(energy2.s).val, 'k-') ax1.plot(ift.exp(energy2.s).val, 'k-') ax1.yaxis.set_label_position("right") ax1.yaxis.set_label_position("right") ax1.set_ylabel(r'$\alpha = 1.5$', size=size) ax1.set_ylabel(r'$\alpha = 1.5$', size=size) ax2.plot(exp(energy3.s).val, 'k-') ax2.plot(ift.exp(energy3.s).val, 'k-') ax2.yaxis.set_label_position("right") ax2.yaxis.set_label_position("right") ax2.set_ylabel(r'$\alpha = 1.75$', size=size) ax2.set_ylabel(r'$\alpha = 1.75$', size=size) ... @@ -66,17 +66,17 @@ if __name__ == '__main__': ... @@ -66,17 +66,17 @@ if __name__ == '__main__': plt.suptitle('point-like components', size=size) plt.suptitle('point-like components', size=size) ax0.plot(exp(energy1.u).val, 'k-') ax0.plot(ift.exp(energy1.u).val, 'k-') ax0.yaxis.set_label_position("right") ax0.yaxis.set_label_position("right") ax0.set_ylabel(r'$\alpha = 1.25$', size=size) ax0.set_ylabel(r'$\alpha = 1.25$', size=size) ax0.set_ylim(1e-1,1e3) ax0.set_ylim(1e-1,1e3) ax0.set_yscale("log") ax0.set_yscale("log") ax1.plot(exp(energy2.u).val, 'k-') ax1.plot(ift.exp(energy2.u).val, 'k-') ax1.yaxis.set_label_position("right") ax1.yaxis.set_label_position("right") ax1.set_ylabel(r'$\alpha = 1.5$', size=size) ax1.set_ylabel(r'$\alpha = 1.5$', size=size) ax2.plot(exp(energy3.u).val, 'k-') ax2.plot(ift.exp(energy3.u).val, 'k-') ax2.yaxis.set_label_position("right") ax2.yaxis.set_label_position("right") ax2.set_ylabel(r'$\alpha = 1.75$', size=size) ax2.set_ylabel(r'$\alpha = 1.75$', size=size) ... @@ -97,10 +97,10 @@ if __name__ == '__main__': ... @@ -97,10 +97,10 @@ if __name__ == '__main__': ax0.set_ylabel(r'data', size=size) ax0.set_ylabel(r'data', size=size) ax1.plot(exp(s).val, 'k-') ax1.plot(ift.exp(s).val, 'k-') ax1.yaxis.set_label_position("right") ax1.yaxis.set_label_position("right") ax1.set_ylabel(r'diffuse', size=size) ax1.set_ylabel(r'diffuse', size=size) ax2.plot(exp(u).val, 'k-') ax2.plot(ift.exp(u).val, 'k-') ax2.yaxis.set_label_position("right") ax2.yaxis.set_label_position("right") ax2.set_ylabel(r'point-like', size=size) ax2.set_ylabel(r'point-like', size=size) ... ...
 from point_separation import build_problem, problem_iteration, load_data from point_separation import build_problem, problem_iteration, load_data from nifty2go import * from nifty4 import * import numpy as np import numpy as np from matplotlib import rc from matplotlib import rc rc('font',**{'family':'serif','serif':['Palatino']}) rc('font',**{'family':'serif','serif':['Palatino']}) ... ...