code: def est_meanfn(self, fn):
          
  
          return np.einsum('i...,i...',
              self.particle_weights, fn(self.particle_locations)
          )
docs: Returns an the expectation value of a given function
          :math:`f` over the current particle distribution.
  
          Here, :math:`f` is represented by a function ``fn`` that is vectorized
          over particles, such that ``f(modelparams)`` has shape
          ``(n_particles, k)``, where ``n_particles = modelparams.shape[0]``, and
          where ``k`` is a positive integer.
  
          :param callable fn: Function implementing :math:`f` in a vectorized
              manner. (See above.)
  
          :rtype: :class:`numpy.ndarray`, shape ``(k, )``.
          :returns: An array containing the an estimate of the mean of :math:`f`.