code: def test_find_centroid():
      """Test that the centroid is correct."""
      montage = make_standard_montage("standard_1020")
      ch_names = [
          ch
          for ch in montage.ch_names
          if ch not in ["P7", "P8", "T3", "T4", "T5", "T4", "T6"]
      ]
      info = create_info(ch_names, sfreq=1024, ch_types="eeg")
      info.set_montage(montage)
      montage = info.get_montage()
      pos = montage.get_positions()
      assert pos["coord_frame"] == "head"
  
      # look for centroid between T7 and TP7, an average in spehrical coordinate
      # fails and places the average on the wrong side of the head between T8 and
      # TP8
      ch_names = ["T7", "TP7"]
      pos_centroid = _find_centroid_sphere(pos["ch_pos"], ch_names)
      _check_centroid_position(pos, ch_names, pos_centroid)
  
      # check other positions
      pairs = [
          ("CPz", "CP2"),
          ("CPz", "Cz"),
          ("Fpz", "AFz"),
          ("AF7", "F7"),
          ("O1", "O2"),
          ("M2", "A2"),
          ("P5", "P9"),
      ]
      for ch_names in pairs:
          pos_centroid = _find_centroid_sphere(pos["ch_pos"], ch_names)
          _check_centroid_position(pos, ch_names, pos_centroid)
      triplets = [
          ("CPz", "Cz", "FCz"),
          ("AF9", "Fpz", "AF10"),
          ("FT10", "FT8", "T10"),
      ]
      for ch_names in triplets:
          pos_centroid = _find_centroid_sphere(pos["ch_pos"], ch_names)
          _check_centroid_position(pos, ch_names, pos_centroid)
  
file_path: mne-python/mne/preprocessing/tests/test_interpolate.py
imports: import itertools
  from pathlib import Path
  import numpy
  import pytest
  from mne import Epochs, create_info, io, pick_types, read_events
  from mne.channels import make_standard_montage
  from mne.preprocessing import equalize_bads, interpolate_bridged_electrodes
  from mne.preprocessing.interpolate import _find_centroid_sphere
  from mne.transforms import _cart_to_sph
label_desc: Use image node_id 4 for calling a global function with example usage: test_find_centroid() without return types