diff --git a/1d_separation.py b/1d_separation.py index 012b542f6a6c6a3d68d120ec504dd43241a540e3..f90f0dd32fa631b3d424a87aee32c321d20fd03d 100644 --- a/1d_separation.py +++ b/1d_separation.py @@ -9,12 +9,12 @@ from matplotlib import pyplot as plt np.random.seed(42) if __name__ == '__main__': s_space = ift.RGSpace([1024]) - FFT = ift.FFTOperator(s_space) - h_space = FFT.target[0] + h_space = s_space.get_default_codomain() + FFT = ift.FFTOperator(h_space) p_spec = lambda k: (1./(1+k)**2.5) S = ift.create_power_operator(h_space, power_spectrum=p_spec) sh = S.draw_sample() - s = FFT.adjoint_times(sh) + s = FFT(sh) u = ift.Field(s_space, val = -12) u.val[200] = 1 diff --git a/point_separation.py b/point_separation.py index 3b68e9901ed6c815344b4977cd05594562d076e1..e5fa14b3aef6df434adbd048f3a4b768c128b0f9 100644 --- a/point_separation.py +++ b/point_separation.py @@ -18,12 +18,12 @@ def load_data(path): def build_problem(data, alpha): s_space = ift.RGSpace(data.shape, distances=len(data.shape) * [1]) + h_space = s_space.get_default_codomain() data = ift.Field(s_space,val=data) - FFT = ift.FFTOperator(s_space) - h_space = FFT.target[0] + FFT = ift.FFTOperator(h_space) binbounds = ift.PowerSpace.useful_binbounds(h_space, logarithmic = False) p_space = ift.PowerSpace(h_space, binbounds=binbounds) - initial_spectrum = ift.power_analyze(FFT(ift.log(data)), binbounds=p_space.binbounds) + initial_spectrum = ift.power_analyze(FFT.inverse_times(ift.log(data)), binbounds=p_space.binbounds) initial_correlation = ift.create_power_operator(h_space, initial_spectrum) initial_x = ift.Field(s_space, val=-1.) alpha = ift.Field(s_space, val=alpha) @@ -47,7 +47,7 @@ def problem_iteration(energy, iterations=3): h_space = energy.correlation.domain[0] FFT = energy.FFT binbounds = ift.PowerSpace.useful_binbounds(h_space, logarithmic=False) - new_power = ift.power_analyze(FFT(energy.s), binbounds=binbounds) + new_power = ift.power_analyze(FFT.inverse_times(energy.s), binbounds=binbounds) new_correlation = ift.create_power_operator(h_space, new_power) new_parameters = energy.parameters new_parameters['correlation'] = new_correlation diff --git a/separation_energy.py b/separation_energy.py index ca44a76402e8e154ef1d0fa252b6b990efeafb3e..76d7810d02eeff052e749ea7497bd381d095745c 100644 --- a/separation_energy.py +++ b/separation_energy.py @@ -19,7 +19,7 @@ class SeparationEnergy(Energy): self.q = parameters['q'] pos_tanh = parameters['pos_tanh'] - self.S = self.FFT.adjoint * self.correlation * self.FFT + self.S = self.FFT * self.correlation * self.FFT.adjoint self.a = pos_tanh(self.position) self.a_p = pos_tanh.derivative(self.position) @@ -52,7 +52,7 @@ class SeparationEnergy(Energy): @property def curvature(self): point = self.q * exp(-self.u) * self.u_p ** 2 - R = self.FFT * self.s_p + R = self.FFT.inverse * self.s_p N = self.correlation S = DiagonalOperator(1/(point + 1/self.var_x)) return WienerFilterCurvature(R=R, N=N, S=S, inverter=self.inverter)