unwrap
: Unwrap phase#
- hypercoil.functional.fourier.unwrap(phase: Tensor, axis: int = -1, discont: float | None = None, period: float = 6.283185307179586) Tensor [source]#
Unwrap tensor values, replacing large deltas with their complement.
Warning
This function is retained for backwards compatibility. In all new code, use
jax.numpy.unwrap()
instead.The unwrapping procedure first computes the difference between each pair of contiguous values along the specified tensor axis. For each difference that is greater than the maximum specified discontinuity (and half the period), the corresponding array value is replaced by its complement with respect to the period.
The default case (period of \(2\pi\), maximum discontinuity \(\pi\)) corresponds to unwrapping a radian phase such that adjacent differences in the phase tensor obtain a maximum value of \(\pi\). This is achieved by adding \(2 k \pi\) for an appropriate value of k.
This mostly follows the implementation in
numpy
.- Parameters:
- phasetensor
Tensor containing phases, or other values to be unwrapped. Currently, tensors should be cast to some floating-point type before this operation.
- axisint (default -1)
Axis along which the maximum discontinuity is not be be exceeded after unwrapping.
- discontfloat (default
period / 2
) Maximum discontinuity between continuous tensor entries along the specified
axis
. Note that this value can in effect be no smaller thanperiod / 2
.- periodfloat (default
(2 * pi)
) Size of the range over which the input tensor wraps.
- Returns:
- tensor
Tensor containing unwrapped values.