docs: def _get_texture(arr, default, n_items, from_bounds):
      """Prepare data to be uploaded as a texture.
  
      The from_bounds must be specified.
  
      """
      if not hasattr(default, '__len__'):  # pragma: no cover
          default = [default]
      n_cols = len(default)
      if arr is None:  # pragma: no cover
          arr = np.tile(default, (n_items, 1))
      assert arr.shape == (n_items, n_cols)
      # Convert to 3D texture.
      arr = arr[np.newaxis, ...].astype(np.float64)
      assert arr.shape == (1, n_items, n_cols)
      # NOTE: we need to cast the texture to [0., 1.] (float texture).
      # This is easy as soon as we assume that the signal bounds are in
      # [-1, 1].
      assert len(from_bounds) == 2
      m, M = map(float, from_bounds)
      assert np.all(arr >= m)
      assert np.all(arr <= M)
      arr = (arr - m) / (M - m)
      assert np.all(arr >= 0)
      assert np.all(arr <= 1.)
      return arr