parameters: (x: Array, atol: float = 1e-08)
docstring: Prunes nearly zero real and imaginary parts
docstring_summary: Prunes nearly zero real and imaginary parts
docstring_tokens: Prunes nearly zero real and imaginary parts
function: def prune_zeros(x: Array, atol: float = 1e-08) -> Array:
      """Prunes nearly zero real and imaginary parts"""
      if np.iscomplexobj(x):
          # Check if complex part is nonzero at all
          if np.allclose(x.imag, 0.0, rtol=0.0, atol=atol):
              return _prune_zeros(x.real)
          else:
              return _prune_zeros(x.real) + 1j * _prune_zeros(x.imag)
      else:
          return _prune_zeros(x)
function_tokens: def prune_zeros ( x : Array , atol : float = 1e-08 ) -> Array : if np . iscomplexobj ( x ) : # Check if complex part is nonzero at all if np . allclose ( x . imag , 0.0 , rtol = 0.0 , atol = atol ) : return _prune_zeros ( x . real ) else : return _prune_zeros ( x . real ) + 1j * _prune_zeros ( x . imag ) else : return _prune_zeros ( x )