pyfftlog
pyfftlog copied to clipboard
Confusion about how to accurately perform inverse Fourier transform
I'm trying to implement FFTLog on a distribution I have that is smooth in log space. It's pictured in the plot below. I take the FT (in the left hand panel), then try to take the IFT to recover the original function but it is not working as anticipated. Can you help me understand how to properly perform the IFT?
Working example:
logtmin = -15
logtmax = 5
n = 4000
mu = 0.5
q = 0
ft = 0
ftopt = 2
tdir = 1
dlogt = (logtmax - logtmin)/n
dlnr = dlogt*np.log(10.0)
ft, xsave = pfl.fhti(n, mu, dlnr, q, kropt=ftopt)
# original signal
fluxes = np.logspace(logtmin, logtmax, num=n)
a_t = np.sin(np.log(fluxes))
# FT
a_f = pfl.fftl(a_t.copy(), xsave, ft, tdir)
# IFT
a_tt = pfl.fftl(a_f.copy(), xsave, ft, -1)