docs: def check_photometry_categorize(x, y, levels, tags=None):
      '''Put every point in its category.
  
      levels must be sorted.'''
      x = numpy.asarray(x)
      y = numpy.asarray(y)
      ys = y.copy()
      ys.sort()
      # Mean of the upper half
      m = ys[len(ys) // 2:].mean()
      y /= m
      m = 1.0
      s = ys[len(ys) // 2:].std()
      result = []
  
      if tags is None:
          tags = list(six.moves.range(len(levels) + 1))
  
      for l, t in zip(levels, tags):
          indc = y < l
          if indc.any():
              x1 = x[indc]
              y1 = y[indc]
              result.append((x1, y1, t))
  
              x = x[~indc]
              y = y[~indc]
      else:
          result.append((x, y, tags[-1]))
  
      return result, (m, s)