code: def test_array_geometry(
      self, mic_spacing: float, num_mics: int, axis: int
  ):
      max_abs_tol = 1e-8
      random = default_rng()
  
      # assume linear arrray along axis
      mic_positions = np.zeros((num_mics, 3))
      mic_positions[:, axis] = mic_spacing * np.arange(num_mics)
  
      center = np.mean(mic_positions, axis=0)
      mic_positions_centered = mic_positions - center
  
      uut = ArrayGeometry(mic_positions)
  
      # test initialization
      assert np.max(np.abs(uut.center - center)) < max_abs_tol
      assert (
          np.max(
              np.abs(uut.centered_positions - mic_positions_centered)
          )
          < max_abs_tol
      )
      assert np.max(np.abs(uut.positions - mic_positions)) < max_abs_tol
  
      # test translation
      center = random.uniform(low=-10, high=-10, size=3)
      mic_positions = mic_positions_centered + center
      uut.translate(to=center)
  
      assert np.max(np.abs(uut.center - center)) < max_abs_tol
      assert (
          np.max(
              np.abs(uut.centered_positions - mic_positions_centered)
          )
          < max_abs_tol
      )
      assert np.max(np.abs(uut.positions - mic_positions)) < max_abs_tol
  
      # test rotation
      center = uut.center
      centered_positions = uut.centered_positions
      test_cases = []
      test_cases.append(
          {
              "orientation": {"yaw": 90},
              "new_positions": np.vstack(
                  (
                      -centered_positions[:, 1],
                      centered_positions[:, 0],
                      centered_positions[:, 2],
                  )
              ).T,
          }
      )
  
      test_cases.append(
          {
              "orientation": {"pitch": 90},
              "new_positions": np.vstack(
                  (
                      centered_positions[:, 2],
                      centered_positions[:, 1],
                      -centered_positions[:, 0],
                  )
              ).T,
          }
      )
  
      test_cases.append(
          {
              "orientation": {"roll": 90},
              "new_positions": np.vstack(
                  (
                      centered_positions[:, 0],
                      -centered_positions[:, 2],
                      centered_positions[:, 1],
                  )
              ).T,
          }
      )
  
      for test_case in test_cases:
          new_array = uut.new_rotated_array(**test_case["orientation"])
          assert np.max(np.abs(new_array.center - center)) < max_abs_tol
          assert (
              np.max(
                  np.abs(
                      new_array.centered_positions
                      - test_case["new_positions"]
                  )
              )
              < max_abs_tol
          )
  
      # test radius
      assert (
          np.max(np.abs(uut.radius - (num_mics - 1) / 2 * mic_spacing))
          < max_abs_tol
      )
  
      # test conversion to spherical
      # point on x axis
      point = np.array([1, 0, 0])
  
      test_cases = []
      test_cases.append(
          {
              "center": 0,
              "dist": np.linalg.norm(point - 0),
              "azim": 0,
              "elev": 0,
          }
      )
  
      test_cases.append(
          {
              "center": np.array([2, 0, 0]),
              "dist": np.linalg.norm(point - np.array([2, 0, 0])),
              "azim": -180,
              "elev": 0,
          }
      )
  
      test_cases.append(
          {
              "center": np.array([1, 1, 1]),
              "dist": np.linalg.norm(point - np.array([1, 1, 1])),
              "azim": -90,
              "elev": -45,
          }
      )
  
      test_cases.append(
          {
              "center": np.array([1, 2, -2]),
              "dist": np.linalg.norm(point - np.array([1, 2, -2])),
              "azim": -90,
              "elev": 45,
          }
      )
  
      for test_case in test_cases:
          uut.translate(to=test_case["center"])
          dist, azim, elev = uut.spherical_relative_to_array(point)
          assert abs(dist - test_case["dist"]) < max_abs_tol
          assert (
              abs(wrap_to_180(azim - test_case["azim"])) < max_abs_tol
          )
          assert abs(elev - test_case["elev"]) < max_abs_tol
  
file_path: NeMo/tests/collections/asr/test_asr_data_simulation.py
imports: import os
  import tempfile
  from typing import List, Type, Union
  import numpy
  import pytest
  from numpy.random import default_rng
  from nemo.collections.asr.data.data_simulation import ArrayGeometry, check_angle, convert_placement_to_range, convert_rir_to_multichannel, simulate_room_mix, wrap_to_180
  from nemo.collections.asr.parts.preprocessing.segment import AudioSegment
label_desc: Use image node_id 1 for calling the TestArrayGeometry obj's underlying member method code with example usage: obj.test_array_geometry(mic_spacing, num_mics, axis) without return types