I'm the author of hankel. While I would not recommend to use my code in this case (since as you mention, it requires a callable input function, and its purpose is to accurately compute integrals, not to do a DHT), I will say that it is possible.
All you need to do is interpolate your input 1D array. How to do this is up to you, but typically something like the following works pretty well:
from scipy.interpolate import InterpolatedUnivariateSpline as Spline
import numpy as np
x, y = # Import/create data vectors
# Do this if y is both negative and positive
fnc = Spline(x,y, k=1) #I usually choose k=1 in case anything gets extrapolated.
# Otherwise do this
spl = Spline(np.log(x), np.log(y), k=1)
fnc = lambda x : np.exp(spl(np.log(x)))
# Continue as normal with hankel.transform(fnc, kvec)
The big issue with doing this is in choosing the parameters N
and h
such that the transform is well approximated for all values of k
in kvec
. If kvec
spans a wide dynamic range, then hankel
is very inefficient as it uses the same underlying arrays (of length N
) for each k
in a transform, meaning the most difficult k
sets the performance level.
So again, in short I wouldn't recommend hankel
, but if you can't find anything else, it will still work ;-)