docs: def position_half_h(pslit, cpix, backw=4):
      """Find the position where the value is half of the peak"""
  
      # Find the first peak to the right of cpix
      next_peak = simple_prot(pslit, cpix)
  
      if next_peak is None:
          raise ValueError
  
      dis_peak = next_peak - cpix
  
      wpos2 = cpix - dis_peak
      wpos1 = wpos2 - backw
  
      # Compute background in a window of width backw
      # in a position simetrical to the peak
      # around cpix
      left_background = pslit[wpos1:wpos2].min()
  
      # height of the peak
      height = pslit[next_peak] - left_background
  
      half_height = left_background + 0.5 * height
  
      # Position at halg peak, linear interpolation
      vv = pslit[wpos1:next_peak+1] - half_height
  
      res1, =  numpy.nonzero(numpy.diff(vv > 0))
      i1 = res1[0]
  
      xint = wpos1 + i1 + (0 - vv[i1]) / (vv[i1+1] - vv[i1])
  
      return xint, next_peak, wpos1, wpos2, left_background, half_height