code: def DKL(arrays):
      
      samples, prior_samples = arrays
      samples = samples[~numpy.isnan(samples)]
      prior_samples = prior_samples[~numpy.isnan(prior_samples)]
      return (
              gaussian_kde(samples).logpdf(samples)
              - gaussian_kde(prior_samples).logpdf(samples)
              ).mean()
docs: Compute the Kullback-Leibler divergence from one distribution Q to another
      P, where Q and P are represented by a set of samples.
  
      Parameters
      ----------
      arrays: tuple(1D numpy.array,1D numpy.array)
          samples defining distributions P & Q respectively
  
      Returns
      -------
      float:
          Kullback Leibler divergence.