Transforms
Collections of classes that allow to compute the Fourier transform of a radially symmetric function and Hankel transforms.
RadiallySymmetricFourierTransform
: Compute the Fourier transform of a radially symmetric function using the correspondence with the Hankel transformHankelTransformBaddourChouinard
: Compute the Hankel transform using Baddour and Chouinard discrete Hankel transformHankelTransformOgata
: Compute the Hankel transform using Ogata quadrature
For more details, we refer to [HGBLachiezeR22].
- class structure_factor.transforms.RadiallySymmetricFourierTransform(dimension)[source]
Bases:
object
Compute the Fourier transform of a radially symmetric function using the correspondence with the Hankel transform.
- __init__(dimension)[source]
Initialize the \(d\)-dimensional Fourier transform.
- Parameters
dimension (int) – Dimension of the ambient space.
- transform(f, k, method, **params)[source]
Evaluate the Fourier transform of the radially symmetric function \(f\) at \(k\) using the correspondence with the Hankel transform.
- Parameters
f (callable) – Function to transform.
k (scalar or numpy.ndarray) – Point or vector of points where the Fourier transform is to be evaluated.
method (str) –
Name of the method used to compute the underlying Hankel transform.
"Ogata"
transform()
"BaddourChouinard"
transform()
- Keyword Arguments
params (dict) –
If
method="BaddourChouinard"
(see [BC15]):r_max (float): Threshold radius characterizing the space-limited feature of the function
f
, i.e., \(f(r)=0\) for r > r_max.nb_points (int, optional): Number of quadrature nodes. Defaults to 300.
see also
transform()
If
method="Ogata"
(see [Oga05]):r_max (float, optional): Maximum radius on which the input function \(f\) to be Hankel transformed was evaluated before the interpolation. Parameter used to conclude a lower bound on \(k\) on which \(f\) to be Hankel transformed. Defaults to None.
step_size (float, optional): Step size of the discretization scheme. Defaults to 0.01.
nb_points (int, optional): Number of quadrature nodes. Defaults to 300.
see also
transform()
- Returns
k: Point(s) where the Fourier transform is to be evaluated.
F_k: Fourier transform of
f
atk
.
- Return type
tuple (numpy.ndarray, numpy.ndarray)
DefinitionThe Hankel transform \(\mathcal{H}_{\nu}\) of order \(\nu\) of \(f\) is defined by
\[\mathcal{H}_{\nu -1}(f)(k) = \int_0^\infty f(r) J_{\nu}(kr)r \mathrm{d}k,\]where \(J_{\nu}\) is the Bessel function of first kind.
The \(d\)-dimensional Fourier transform \(\mathcal{F}\) of the radially symmetric function \(f\) at \(k\) could be defined using the Hankel transform of \(x \rightarrow x^{d/2 -1}f(x)\) of order \(d/2 -1\) as follows,
\[k^{d/2-1} \mathcal{F}[f](k) = (2 \pi)^{d/2} \int_{0}^{+\infty} r^{d/2-1} f(r) J_{d/2-1}(kr) r \mathrm{d}r = (2 \pi)^{d/2} \mathcal{H}_{d/2-1}[\cdot^{d/2-1} f(\cdot)](k).\]
- class structure_factor.transforms.HankelTransform(order)[source]
Bases:
object
Compute the Hankel transform of order \(\nu\).
- class structure_factor.transforms.HankelTransformBaddourChouinard(order=0)[source]
Bases:
structure_factor.transforms.HankelTransform
Compute the Hankel transform, using the method of [BC15] considering that the input function is space-limited, i.e., \(f(r)=0\) for \(r>r_{max}\).
- __init__(order=0)[source]
Initialize the Hankel transform with prescribed
order
.- Parameters
order (int, optional) – Order of the Hankel transform.
- compute_transformation_parameters(r_max, nb_points)[source]
Compute the parameters involved in the evaluation of the corresponding Hankel-type transform using the discretization scheme of [BC15].
The following object’s attributes are defined
bessel_zeros
r_max
transformation_matrix
- Parameters
r_max (float) – Threshold radius. Considering that the input function \(f\) to be Hankel transformed is space-limited, then
r_max
satisfies \(f(r)=0\) for r > r_max.nb_points (int) – Number of quadrature nodes.
- transform(f, k=None, **interpolation_params)[source]
Compute the Hankel transform of
f
atk
.- Parameters
f (callable) – Function to be Hankel transformed.
k (numpy.ndarray, optional) –
Points of evaluation of the Hankel transform. Defaults to None.
If
k
is None (default), thenk = self.bessel_zeros[:-1] / self.r_max
derived fromcompute_transformation_parameters()
.If
k
is provided, the Hankel transform is first computed at the above k values (case k is None), then interpolated usingscipy.interpolate.interp1d()
withinterpolation_params
and finally evaluated at the providedk
values.
- Keyword Arguments
interpolation_params (dict) – Keyword arguments of
scipy.interpolate.interp1d()
.- Returns
k
and the evaluations of the Hankel transform off
atk
.- Return type
tuple (scalar or numpy.ndarray, scalar or numpy.ndarray)
- class structure_factor.transforms.HankelTransformOgata(order=0)[source]
Bases:
structure_factor.transforms.HankelTransform
Compute the Hankel transform using Ogata quadrature [Oga05], (Section 5).
See also
- __init__(order=0)[source]
Initialize the Hankel transform with prescribed
order
.- Parameters
order (int, optional) – Order of the Hankel transform. Defaults to 0.
- compute_transformation_parameters(r_max=None, nb_points=300, step_size=0.01)[source]
Compute the quadrature nodes and weights used by [Oga05] (Equation (5.2)), to evaluate the corresponding Hankel-type transform.
- Parameters
r_max (float, optional) – Maximum radius on which the input function \(f\), to be Hankel transformed, was evaluated before the interpolation. Parameter used to conclude a lower bound on \(k\) on which \(f\) to be Hankel transformed. Defaults to None.
step_size (float, optional) – Step size of the discretization scheme. Defaults to 0.01.
nb_points (int, optional) – Number of quadrature nodes. Defaults to 300.
- Returns
Quadrature nodes and weights.
- Return type
tuple (numpy.ndarray, np.ndarray)
- transform(f, k)[source]
Compute the Hankel transform of
f
evaluated atk
, following the work of [Oga05] (Section 5).- Parameters
f (callable) – Function to be Hankel transformed.
k (numpy.ndarray, optional) – Points of evaluation of the Hankel transform (1d array). Defaults to None.
- Returns
k: Points of evaluation of the Hankel transform.
H_k: Evaluations of the Hankel transform of
f
onk
.
- Return type
tuple(numpy.ndarray, np.ndarray)
Important
Please call
HankelTransformOgata.compute_transformation_parameters()
to define quadrature attributesnodes
andweights
, before applyingHankelTransformOgata.compute_transform()
.