parameters: (a,tol=100)
return_statement: return a
docstring: If complex input returns a real array if complex parts are close to zero.
  
      "Close to zero" is defined as `tol` * (machine epsilon of the type for
      `a`).
  
      Parameters
      ----------
      a : array_like
          Input array.
      tol : float
          Tolerance in machine epsilons for the complex part of the elements
          in the array.
  
      Returns
      -------
      out : ndarray
          If `a` is real, the type of `a` is used for the output.  If `a`
          has complex elements, the returned type is float.
  
      See Also
      --------
      real, imag, angle
  
      Notes
      -----
      Machine epsilon varies from machine to machine and between data types
      but Python floats on most platforms have a machine epsilon equal to
      2.2204460492503131e-16.  You can use 'np.finfo(np.float).eps' to print
      out the machine epsilon for floats.
  
      Examples
      --------
      >>> np.finfo(np.float).eps
      2.2204460492503131e-16
  
      >>> np.real_if_close([2.1 + 4e-14j], tol=1000)
      array([ 2.1])
      >>> np.real_if_close([2.1 + 4e-13j], tol=1000)
      array([ 2.1 +4.00000000e-13j])
docstring_summary: If complex input returns a real array if complex parts are close to zero.
docstring_tokens: If complex input returns a real array if complex parts are close to zero .
function: def real_if_close(a,tol=100):
      """
      If complex input returns a real array if complex parts are close to zero.
  
      "Close to zero" is defined as `tol` * (machine epsilon of the type for
      `a`).
  
      Parameters
      ----------
      a : array_like
          Input array.
      tol : float
          Tolerance in machine epsilons for the complex part of the elements
          in the array.
  
      Returns
      -------
      out : ndarray
          If `a` is real, the type of `a` is used for the output.  If `a`
          has complex elements, the returned type is float.
  
      See Also
      --------
      real, imag, angle
  
      Notes
      -----
      Machine epsilon varies from machine to machine and between data types
      but Python floats on most platforms have a machine epsilon equal to
      2.2204460492503131e-16.  You can use 'np.finfo(np.float).eps' to print
      out the machine epsilon for floats.
  
      Examples
      --------
      >>> np.finfo(np.float).eps
      2.2204460492503131e-16
  
      >>> np.real_if_close([2.1 + 4e-14j], tol=1000)
      array([ 2.1])
      >>> np.real_if_close([2.1 + 4e-13j], tol=1000)
      array([ 2.1 +4.00000000e-13j])
  
      """
      a = asanyarray(a)
      if not issubclass(a.dtype.type, _nx.complexfloating):
          return a
      if tol > 1:
          from numpy.core import getlimits
          f = getlimits.finfo(a.dtype.type)
          tol = f.eps * tol
      if _nx.allclose(a.imag, 0, atol=tol):
          a = a.real
      return a
function_tokens: def real_if_close ( a , tol = 100 ) : a = asanyarray ( a ) if not issubclass ( a . dtype . type , _nx . complexfloating ) : return a if tol > 1 : from numpy . core import getlimits f = getlimits . finfo ( a . dtype . type ) tol = f . eps * tol if _nx . allclose ( a . imag , 0 , atol = tol ) : a = a . real return a