docs: def replace_close(x, xhat, rtol=default_rtol, atol=default_atol, copy=True):
      '''
      replace_close(x, xhat) yields x if x is not close to xhat and xhat otherwise. Closeness is
        determined by numpy's isclose(), and the atol and rtol options are passed along.
  
      The x and xhat arguments may be lists/arrays.
  
      The optional argument copy may also be set to False to chop x in-place.
      '''
      if rtol is None: rtol = default_rtol
      if atol is None: atol = default_atol
      x = np.array(x) if copy else np.asarray(x)
      w = np.isclose(x, xhat, rtol=rtol, atol=atol)
      x[w] = np.asarray(xhat)[w]
      return x