code: def test_fit_matched_points():
      """Test fit_matched_points: fitting two matching sets of points."""
      tgt_pts = np.random.RandomState(42).uniform(size=(6, 3))
  
      # rotation only
      trans = rotation(2, 6, 3)
      src_pts = apply_trans(trans, tgt_pts)
      trans_est = fit_matched_points(
          src_pts, tgt_pts, translate=False, out="trans"
      )
      est_pts = apply_trans(trans_est, src_pts)
      assert_array_almost_equal(
          tgt_pts, est_pts, 2, "fit_matched_points with " "rotation"
      )
  
      # rotation & translation
      trans = np.dot(translation(2, -6, 3), rotation(2, 6, 3))
      src_pts = apply_trans(trans, tgt_pts)
      trans_est = fit_matched_points(src_pts, tgt_pts, out="trans")
      est_pts = apply_trans(trans_est, src_pts)
      assert_array_almost_equal(
          tgt_pts,
          est_pts,
          2,
          "fit_matched_points with " "rotation and translation.",
      )
  
      # rotation & translation & scaling
      trans = reduce(
          np.dot,
          (
              translation(2, -6, 3),
              rotation(1.5, 0.3, 1.4),
              scaling(0.5, 0.5, 0.5),
          ),
      )
      src_pts = apply_trans(trans, tgt_pts)
      trans_est = fit_matched_points(
          src_pts, tgt_pts, scale=1, out="trans"
      )
      est_pts = apply_trans(trans_est, src_pts)
      assert_array_almost_equal(
          tgt_pts,
          est_pts,
          2,
          "fit_matched_points with "
          "rotation, translation and scaling.",
      )
  
      # test exceeding tolerance
      tgt_pts[0, :] += 20
      pytest.raises(
          RuntimeError, fit_matched_points, tgt_pts, src_pts, tol=10
      )
  
imports: import os
  from functools import reduce
  from glob import glob
  from shutil import copyfile
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal, assert_array_less
  import mne
  from mne._fiff.constants import FIFF
  from mne.channels import DigMontage
  from mne.coreg import Coregistration, _is_mri_subject, coregister_fiducials, create_default_subject, fit_matched_points, get_mni_fiducials, scale_labels, scale_mri, scale_source_space
  from mne.datasets import testing
  from mne.io import read_fiducials, read_info
  from mne.source_space import write_source_spaces
  from mne.transforms import Transform, _angle_between_quats, apply_trans, invert_transform, read_trans, rot_to_quat, rotation, scaling, translation
  from mne.utils import catch_logging
label_desc: Use image node_id 5 for calling a global function with example usage: test_fit_matched_points() without return types