code: def test_head_translation():
      """Test Maxwell filter head translation."""
      raw = read_crop(raw_fname, (0.0, 1.0))
      # First try with an unchanged destination
      with use_coil_def(elekta_def_fname):
          raw_sss = maxwell_filter(
              raw,
              destination=raw_fname,
              origin=mf_head_origin,
              regularize=None,
              bad_condition="ignore",
          )
      assert_meg_snr(
          raw_sss, read_crop(sss_std_fname, (0.0, 1.0)), 200.0
      )
      # Now with default
      with use_coil_def(elekta_def_fname):
          with pytest.warns(RuntimeWarning, match="over 25 mm"):
              raw_sss = maxwell_filter(
                  raw,
                  destination=mf_head_origin,
                  origin=mf_head_origin,
                  regularize=None,
                  bad_condition="ignore",
                  verbose=True,
              )
      assert_meg_snr(raw_sss, read_crop(sss_trans_default_fname), 125.0)
      destination = np.eye(4)
      destination[2, 3] = 0.04
      assert_allclose(raw_sss.info["dev_head_t"]["trans"], destination)
      # Now to sample's head pos
      with pytest.warns(RuntimeWarning, match="= 25.6 mm"):
          raw_sss = maxwell_filter(
              raw,
              destination=str(sample_fname),
              origin=mf_head_origin,
              regularize=None,
              bad_condition="ignore",
              verbose=True,
          )
      assert_meg_snr(
          raw_sss, read_crop(sss_trans_sample_fname), 13.0, 100.0
      )
      assert_allclose(
          raw_sss.info["dev_head_t"]["trans"],
          read_info(sample_fname)["dev_head_t"]["trans"],
      )
      # Degenerate cases
      with pytest.raises(
          RuntimeError, match=".* can only be set .* head .*"
      ):
          maxwell_filter(
              raw, destination=mf_head_origin, coord_frame="meg"
          )
      with pytest.raises(ValueError, match="destination must be"):
          maxwell_filter(raw, destination=[0.0] * 4)
  
imports: import pathlib
  import re
  from contextlib import contextmanager
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal
  from scipy import sparse
  from scipy.special import sph_harm
  import mne
  from mne import compute_raw_covariance, concatenate_raws, pick_info, pick_types
  from mne._fiff.constants import FIFF
  from mne.annotations import _annotations_starts_stops
  from mne.chpi import filter_chpi, read_head_pos
  from mne.datasets import testing
  from mne.forward import _prep_meg_channels, use_coil_def
  from mne.io import BaseRaw, read_info, read_raw_bti, read_raw_ctf, read_raw_fif, read_raw_kit
  from mne.preprocessing import annotate_amplitude, annotate_movement, compute_maxwell_basis, find_bad_channels_maxwell, maxwell_filter, maxwell_filter_prepare_emptyroom
  from mne.preprocessing.maxwell import _bases_complex_to_real, _bases_real_to_complex, _get_n_moments, _prep_mf_coils, _sh_complex_to_real, _sh_negate, _sh_real_to_complex, _sss_basis_basic, _trans_sss_basis
  from mne.rank import _compute_rank_int, _get_rank_sss, compute_rank
  from mne.utils import _record_warnings, assert_meg_snr, buggy_mkl_svd, catch_logging, object_diff, use_log_level
label_desc: Use image node_id 17 for calling a global function with example usage: test_head_translation() without return types