code: def get_default_clim_from_data(data):
      """Compute a reasonable clim from the min and max, taking nans into account.
  
      If there are no non-finite values (nan, inf, -inf) this is as fast as it can be.
      Otherwise, this functions is about 3x slower.
      """
      # Fast
      min_value = data.min()
      max_value = data.max()
  
      # Need more work? The nan-functions are slower
      min_finite = np.isfinite(min_value)
      max_finite = np.isfinite(max_value)
      if not (min_finite and max_finite):
          finite_data = data[np.isfinite(data)]
          if finite_data.size:
              min_value = finite_data.min()
              max_value = finite_data.max()
          else:
              min_value = max_value = 0  # no finite values in the data
  
      return min_value, max_value
  
imports: import warnings
  import numpy
  from vispy.gloo.texture import Texture2D, Texture3D, convert_dtype_and_clip
label_desc: Use image node_id 2 for calling a global function with example usage: get_default_clim_from_data(data) and returns: min_value,  max_value