code: def posterior_mesh(self, idx_param1=0, idx_param2=1, res1=100, res2=100, smoothing=0.01):
          
  
          # WARNING: fancy indexing is used here, which means that a copy is
          #          made.
          locs = self.particle_locations[:, [idx_param1, idx_param2]]
  
          p1s, p2s = np.meshgrid(
              np.linspace(np.min(locs[:, 0]), np.max(locs[:, 0]), res1),
              np.linspace(np.min(locs[:, 1]), np.max(locs[:, 1]), res2)
          )
          plot_locs = np.array([p1s, p2s]).T.reshape((np.prod(p1s.shape), 2))
  
          pr = np.sum( # <- sum over the particles in the SMC approximation.
              np.prod( # <- product over model parameters to get a multinormal
                  # Evaluate the PDF at the plotting locations, with a normal
                  # located at the particle locations.
                  scipy.stats.norm.pdf(
                      plot_locs[:, np.newaxis, :],
                      scale=smoothing,
                      loc=locs
                  ),
                  axis=-1
              ) * self.particle_weights,
              axis=1
          ).reshape(p1s.shape) # Finally, reshape back into the same shape as the mesh.
  
          return p1s, p2s, pr
docs: Returns a mesh, useful for plotting, of kernel density estimation
          of a 2D projection of the current posterior distribution.
  
          :param int idx_param1: Parameter to be treated as :math:`x` when
              plotting.
          :param int idx_param2: Parameter to be treated as :math:`y` when
              plotting.
          :param int res1: Resolution along the :math:`x` direction.
          :param int res2: Resolution along the :math:`y` direction.
          :param float smoothing: Standard deviation of the Gaussian kernel
              used to smooth the particle approximation to the current posterior.
  
          .. seealso::
  
              :meth:`SMCUpdater.plot_posterior_contour`