parameters: (data: np.ndarray, percentile: float = 0.05)
return_statement: return field_res.clip(0, 1.0)
docstring: Normalize and clamp data for better color mapping.
  
      This is a utility function used ONLY for the purpose of 2D image
      visualization. The resulting values are not fully reversible because the
      final clipping step discards values outside of [0, 1].
  
      Args:
          data: array of data to be transformed for visualization
          percentile: values in the bottom/top percentile are clambed to 0 and 1
  
      Returns:
          An array of doubles with the same shape as ``image`` with values
          normalized to the range [0, 1].
docstring_summary: Normalize and clamp data for better color mapping.
docstring_tokens: Normalize and clamp data for better color mapping .
function: def normalize(data: np.ndarray, percentile: float = 0.05):
      """Normalize and clamp data for better color mapping.
  
      This is a utility function used ONLY for the purpose of 2D image
      visualization. The resulting values are not fully reversible because the
      final clipping step discards values outside of [0, 1].
  
      Args:
          data: array of data to be transformed for visualization
          percentile: values in the bottom/top percentile are clambed to 0 and 1
  
      Returns:
          An array of doubles with the same shape as ``image`` with values
          normalized to the range [0, 1].
      """
      min_val = np.percentile(data, 100 * percentile)
      max_val = np.percentile(data, 100 * (1 - percentile))
      # to protect from division by zero
      spread = max(max_val - min_val, 1)
      field_res = (data.astype(np.float64) - min_val) / spread
      return field_res.clip(0, 1.0)
function_tokens: def normalize ( data : np . ndarray , percentile : float = 0.05 ) : min_val = np . percentile ( data , 100 * percentile ) max_val = np . percentile ( data , 100 * ( 1 - percentile ) ) # to protect from division by zero spread = max ( max_val - min_val , 1 ) field_res = ( data . astype ( np . float64 ) - min_val ) / spread return field_res . clip ( 0 , 1.0 )