docs: def apply_stat(f, arraylist, *extra, **kw):
      """
      :param f: a callable arraylist -> array (of the same shape and dtype)
      :param arraylist: a list of arrays of the same shape and dtype
      :param extra: additional positional arguments
      :param kw: keyword arguments
      :returns: an array of the same shape and dtype
  
      Broadcast statistical functions to composite arrays. Here is an example:
  
      >>> dt = numpy.dtype([('a', (float, 2)), ('b', float)])
      >>> a1 = numpy.array([([1, 2], 3)], dt)
      >>> a2 = numpy.array([([4, 5], 6)], dt)
      >>> apply_stat(mean_curve, [a1, a2])
      array([([2.5, 3.5], 4.5)], dtype=[('a', '<f8', (2,)), ('b', '<f8')])
      """
      dtype = arraylist[0].dtype
      shape = arraylist[0].shape
      if dtype.names:  # composite array
          new = numpy.zeros(shape, dtype)
          for name in dtype.names:
              new[name] = f([arr[name] for arr in arraylist], *extra, **kw)
          return new
      else:  # simple array
          return f(arraylist, *extra, **kw)