numpy - Python: Fast Hankel Transform for 1d array -
i'm trying find existing implementation hankel transform in python (actually i'm more symmetric fourier transform of 2 2d radially symmetric functions can reduced hankel transform).
i know hankel python module, requires lambda function input whereas have 1d-array.
any thoughts?
i'm author of hankel. while not recommend use code in case (since mention, requires callable input function, , purpose accurately compute integrals, not dht), is possible.
all need interpolate input 1d array. how you, typically following works pretty well:
from scipy.interpolate import interpolatedunivariatespline spline import numpy np x, y = # import/create data vectors # if y both negative , positive fnc = spline(x,y, k=1) #i choose k=1 in case gets extrapolated. # otherwise spl = spline(np.log(x), np.log(y), k=1) fnc = lambda x : np.exp(spl(np.log(x))) # continue normal hankel.transform(fnc, kvec) the big issue doing in choosing parameters n , h such transform approximated values of k in kvec. if kvec spans wide dynamic range, hankel inefficient uses same underlying arrays (of length n) each k in transform, meaning difficult k sets performance level.
so again, in short wouldn't recommend hankel, if can't find else, still work ;-)
Comments
Post a Comment