code: def test_find_hdi_contours(mean, cov, contour_sigma):
      """Test `_find_hdi_contours()` against SciPy's multivariate normal distribution."""
      # Set up scipy distribution
      prob_dist = st.multivariate_normal(mean, cov)
  
      # Find standard deviations and eigenvectors
      eigenvals, eigenvecs = np.linalg.eig(cov)
      eigenvecs = eigenvecs.T
      stdevs = np.sqrt(eigenvals)
  
      # Find min and max for grid at 7-sigma contour
      extremes = np.empty((4, 2))
      for i in range(4):
          extremes[i] = (
              mean + (-1) ** i * 7 * stdevs[i // 2] * eigenvecs[i // 2]
          )
      x_min, y_min = np.amin(extremes, axis=0)
      x_max, y_max = np.amax(extremes, axis=0)
  
      # Create 256x256 grid
      x = np.linspace(x_min, x_max, 256)
      y = np.linspace(y_min, y_max, 256)
      grid = np.dstack(np.meshgrid(x, y))
  
      density = prob_dist.pdf(grid)
  
      contour_sp = np.empty(contour_sigma.shape)
      for idx, sigma in enumerate(contour_sigma):
          contour_sp[idx] = prob_dist.pdf(
              mean + sigma * stdevs[0] * eigenvecs[0]
          )
  
      hdi_probs = 1 - np.exp(-0.5 * contour_sigma**2)
      contour_az = _find_hdi_contours(density, hdi_probs)
  
      np.testing.assert_allclose(
          contour_sp, contour_az, rtol=1e-2, atol=1e-4
      )
  
imports: from unittest.mock import Mock
  import numpy
  import pytest
  import scipy.stats
  from ...data import dict_to_dataset, from_dict, load_arviz_data
  from ...stats.density_utils import _circular_mean, _normalize_angle, _find_hdi_contours
  from ...utils import _stack, _subset_list, _var_names, expand_dims, flatten_inference_data_to_dict, one_de, two_de
  from ..helpers import TestRandomVariable
label_desc: Use image node_id 24 for calling a global function with example usage: test_find_hdi_contours(mean, cov, contour_sigma) without return types