(p, discont=np.pi, axis=-1)
return unwrapped
Unwrap a cyclical phase tensor.

  Args:
    p: Phase tensor.
    discont: Float, size of the cyclic discontinuity.
    axis: Axis of which to unwrap.

  Returns:
    unwrapped: Unwrapped tensor of same size as input.
Unwrap a cyclical phase tensor.
Unwrap a cyclical phase tensor .
def unwrap(p, discont=np.pi, axis=-1):
  """Unwrap a cyclical phase tensor.

  Args:
    p: Phase tensor.
    discont: Float, size of the cyclic discontinuity.
    axis: Axis of which to unwrap.

  Returns:
    unwrapped: Unwrapped tensor of same size as input.
  """
  dd = diff(p, axis=axis)
  ddmod = tf.mod(dd + np.pi, 2.0 * np.pi) - np.pi
  idx = tf.logical_and(tf.equal(ddmod, -np.pi), tf.greater(dd, 0))
  ddmod = tf.where(idx, tf.ones_like(ddmod) * np.pi, ddmod)
  ph_correct = ddmod - dd
  idx = tf.less(tf.abs(dd), discont)
  ddmod = tf.where(idx, tf.zeros_like(ddmod), dd)
  ph_cumsum = tf.cumsum(ph_correct, axis=axis)

  shape = p.get_shape().as_list()
  shape[axis] = 1
  ph_cumsum = tf.concat([tf.zeros(shape, dtype=p.dtype), ph_cumsum], axis=axis)
  unwrapped = p + ph_cumsum
  return unwrapped
def unwrap ( p , discont = np . pi , axis = - 1 ) : dd = diff ( p , axis = axis ) ddmod = tf . mod ( dd + np . pi , 2.0 * np . pi ) - np . pi idx = tf . logical_and ( tf . equal ( ddmod , - np . pi ) , tf . greater ( dd , 0 ) ) ddmod = tf . where ( idx , tf . ones_like ( ddmod ) * np . pi , ddmod ) ph_correct = ddmod - dd idx = tf . less ( tf . abs ( dd ) , discont ) ddmod = tf . where ( idx , tf . zeros_like ( ddmod ) , dd ) ph_cumsum = tf . cumsum ( ph_correct , axis = axis ) shape = p . get_shape ( ) . as_list ( ) shape [ axis ] = 1 ph_cumsum = tf . concat ( [ tf . zeros ( shape , dtype = p . dtype ) , ph_cumsum ] , axis = axis ) unwrapped = p + ph_cumsum return unwrapped