code: def test_multivariate_gaussian():
      with warnings.catch_warnings():
          warnings.simplefilter("ignore")
  
          # test that we treat lists and arrays the same
          mean = (0, 0)
          cov = [[1, 0.5], [0.5, 1]]
          a = [
              [
                  multivariate_gaussian((i, j), mean, cov)
                  for i in (-1, 0, 1)
              ]
              for j in (-1, 0, 1)
          ]
  
          b = [
              [
                  multivariate_gaussian((i, j), mean, np.asarray(cov))
                  for i in (-1, 0, 1)
              ]
              for j in (-1, 0, 1)
          ]
  
          assert np.allclose(a, b)
  
          a = [
              [
                  multivariate_gaussian((i, j), np.asarray(mean), cov)
                  for i in (-1, 0, 1)
              ]
              for j in (-1, 0, 1)
          ]
          assert np.allclose(a, b)
  
          try:
              multivariate_gaussian(1, 1, -1)
          except:
              pass
          else:
              assert False, "negative variances are meaningless"
  
          # test that we get the same results as scipy.stats.multivariate_normal
          xs = np.random.randn(1000)
          mean = np.random.randn(1000)
          var = np.random.random(1000) * 5
  
          for x, m, v in zip(xs, mean, var):
              assert (
                  abs(
                      multivariate_gaussian(x, m, v)
                      - scipy.stats.multivariate_normal(m, v).pdf(x)
                  )
                  < 1.0e-12
              )
  
imports: from __future__ import division
  from math import exp
  import warnings
  import matplotlib.pyplot
  from mpl_toolkits.mplot3d import axes3d
  import numpy
  from numpy.linalg import inv
  import scipy
  from scipy.spatial.distance import mahalanobis
  from filterpy.stats import norm_cdf, multivariate_gaussian, logpdf, mahalanobis
  from scipy import linalg
label_desc: Use image node_id 3 for calling a global function with example usage: test_multivariate_gaussian() without return types