Single-shot Hankel transforms

The functions below are more convenient version of the Hankel transform functions, designed for when you want to transform only a single function. They basically create a throw-away HankelTransform object, transform the input onto the appropriate grid using HankelTransform.to_transform_r() or to_transform_k() as appropriate, and the call HankelTransform.qdht() or HankelTransform.iqdht().

The single-shot functions described below are demonstrated in Example of single-shot transform. For a single use, these functions are simpler, but there is a significant overhead in creating the HankelTransform object, and so for repeated transforms on the same grid, it is recommended to create the class yourself and make repeated calls to HankelTransform.qdht() or iqdht(). See Typical usage for an example demonstrating this and Speed of single-shot vs reuse of a HankelTransform object for an example of the difference in speed.

pyhank.one_shot.iqdht(k: numpy.ndarray, f: numpy.ndarray, order: int = 0) → Tuple[numpy.ndarray, numpy.ndarray]

Perform a inverse quasi-discrete Hankel transform of the function f (sampled at points k) and return the transformed function and its sample points in radial space.

If you have the transform on a frequency axis (as opposed to a \(k\)-axis), the \(k\)-axis can be calculated using \(k = 2\pi{}f\).

Warning

This method is a convenience wrapper for HankelTransform.iqdht(), but incurs a significant overhead in calculating the HankelTransform object. If you are performing multiple transforms on the same grid, it will be much quicker to construct a single HankelTransform object and call HankelTransform.iqdht() multiple times.

Parameters:
  • k (numpy.ndarray) – The \(k\) coordinates at which the function is sampled
  • f (numpy.ndarray) – The value of the function to be transformed.
  • order – The order of the Hankel Transform to perform. Defaults to 0.
Returns:

A tuple containing the radial coordinates of the transformed function and its values

Return type:

(numpy.ndarray, numpy.ndarray)

pyhank.one_shot.qdht(r: numpy.ndarray, f: numpy.ndarray, order: int = 0) → Tuple[numpy.ndarray, numpy.ndarray]

Perform a quasi-discrete Hankel transform of the function f (sampled at points r) and return the transformed function and its sample points in \(k\)-space.

If you requires the transform on a frequency axis (as opposed to the \(k\)-axis), the frequency axis \(v\) can be calculated using \(v = \frac{k}{2\pi}\).

Warning

This method is a convenience wrapper for HankelTransform.qdht(), but incurs a significant overhead in calculating the HankelTransform object. If you are performing multiple transforms on the same grid, it will be much quicker to construct a single HankelTransform object and call HankelTransform.qdht() multiple times.

Parameters:
  • r (numpy.ndarray) – The radial coordinates at which the function is sampled
  • f (numpy.ndarray) – The value of the function to be transformed.
  • order – The order of the Hankel Transform to perform. Defaults to 0.
Returns:

A tuple containing the k coordinates of the transformed function and its values

Return type:

(numpy.ndarray, numpy.ndarray)