code: def update(likelihood, prior):
      """Computes the posterior of a discrete random variable given a
      discrete likelihood and prior. In a typical application the likelihood
      will be the likelihood of a measurement matching your current environment,
      and the prior comes from discrete_bayes.predict().
  
      Parameters
      ----------
  
      likelihood : ndarray, dtype=flaot
           array of likelihood values
  
      prior : ndarray, dtype=flaot
          prior pdf.
  
      Returns
      -------
  
      posterior : ndarray, dtype=float
          Returns array representing the posterior.
  
  
      Examples
      --------
      .. code-block:: Python
  
          # self driving car. Sensor returns values that can be equated to positions
          # on the road. A real likelihood compuation would be much more complicated
          # than this example.
  
          likelihood = np.ones(len(road))
          likelihood[road==z] *= scale_factor
  
          prior = predict(posterior, velocity, kernel)
          posterior = update(likelihood, prior)
      """
  
      posterior = prior * likelihood
      return normalize(posterior)
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import numpy
  from scipy.ndimage.filters import convolve
  from scipy.ndimage.interpolation import shift
label_desc: Use image node_id 2 for calling a global function with example usage: update(likelihood, prior) and returns: normalize