code: def test_label_sign_flip():
      """Test label sign flip computation."""
      src = read_source_spaces(src_fname)
      label = Label(vertices=src[0]["vertno"][:5], hemi="lh")
      src[0]["nn"][label.vertices] = np.array(
          [
              [1.0, 0.0, 0.0],
              [0.0, 1.0, 0.0],
              [0, 0, 1.0],
              [1.0 / np.sqrt(2), 1.0 / np.sqrt(2), 0.0],
              [1.0 / np.sqrt(2), 1.0 / np.sqrt(2), 0.0],
          ]
      )
      known_flips = np.array([1, 1, np.nan, 1, 1])
      idx = [
          0,
          1,
          3,
          4,
      ]  # indices that are usable (third row is orthognoal)
      flip = label_sign_flip(label, src)
      assert_array_almost_equal(
          np.dot(flip[idx], known_flips[idx]), len(idx)
      )
      bi_label = label + Label(vertices=src[1]["vertno"][:5], hemi="rh")
      src[1]["nn"][src[1]["vertno"][:5]] = -src[0]["nn"][label.vertices]
      flip = label_sign_flip(bi_label, src)
      known_flips = np.array([1, 1, np.nan, 1, 1, 1, 1, np.nan, 1, 1])
      idx = [0, 1, 3, 4, 5, 6, 8, 9]
      assert_array_almost_equal(
          np.dot(flip[idx], known_flips[idx]), 0.0
      )
      src[1]["nn"][src[1]["vertno"][:5]] *= -1
      flip = label_sign_flip(bi_label, src)
      assert_array_almost_equal(
          np.dot(flip[idx], known_flips[idx]), len(idx)
      )
  
imports: import glob
  import os
  import pickle
  import shutil
  from itertools import product
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal, assert_array_less, assert_equal
  from scipy import sparse
  from mne import grow_labels, labels_to_stc, morph_labels, random_parcellation, read_label, read_labels_from_annot, read_source_estimate, read_source_spaces, read_surface, spatial_tris_adjacency, split_label, stc_to_label, write_labels_to_annot
  from mne.datasets import testing
  from mne.label import Label, _blend_colors, _load_vert_pos, _n_colors, _read_annot, _read_annot_cands, label_sign_flip, select_sources
  from mne.source_estimate import mesh_edges
  from mne.source_space import SourceSpaces
  from mne.surface import _mesh_borders
  from mne.utils import _record_warnings, get_subjects_dir
label_desc: Use image node_id 21 for calling a global function with example usage: test_label_sign_flip() without return types