code: def test_hpi_info(tmp_path):
      """Test getting HPI info."""
      temp_name = tmp_path / "temp_raw.fif"
      for fname in (chpi_fif_fname, sss_fif_fname):
          raw = read_raw_fif(fname, allow_maxshield="yes").crop(0, 0.1)
          assert len(raw.info["hpi_subsystem"]) > 0
          raw.save(temp_name, overwrite=True)
          info = read_info(temp_name)
          assert len(info["hpi_subsystem"]) == len(
              raw.info["hpi_subsystem"]
          )
  
      # test get_chpi_info()
      info = read_info(chpi_fif_fname)
      hpi_freqs, stim_ch_idx, hpi_on_codes = get_chpi_info(info)
  
      assert_allclose(
          hpi_freqs, np.array([83.0, 143.0, 203.0, 263.0, 323.0])
      )
      assert stim_ch_idx == 378
      assert_allclose(
          hpi_on_codes, np.array([256, 512, 1024, 2048, 4096])
      )
  
      # test get_chpi_info() if no proper cHPI info is available
      with info._unlock():
          info["hpi_subsystem"] = None
          info["hpi_meas"] = []
          info["hpi_results"] = []
  
      with pytest.raises(
          ValueError, match="No appropriate cHPI information"
      ):
          get_chpi_info(info)
  
      with pytest.warns(
          RuntimeWarning, match="No appropriate cHPI information"
      ):
          get_chpi_info(info, on_missing="warn")
  
      hpi_freqs, stim_ch_idx, hpi_on_codes = get_chpi_info(
          info, on_missing="ignore"
      )
      assert_array_equal([], hpi_freqs)
      assert stim_ch_idx is None
      assert_array_equal([], hpi_on_codes)
  
imports: from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal, assert_array_less
  from scipy.interpolate import interp1d
  from scipy.spatial.distance import cdist
  from mne import pick_info, pick_types
  from mne._fiff.constants import FIFF
  from mne.chpi import _chpi_locs_to_times_dig, _compute_good_distances, _get_hpi_initial_fit, _setup_ext_proj, compute_chpi_amplitudes, compute_chpi_locs, compute_chpi_snr, compute_head_pos, extract_chpi_locs_ctf, extract_chpi_locs_kit, filter_chpi, get_active_chpi, get_chpi_info, head_pos_to_trans_rot_t, read_head_pos, write_head_pos
  from mne.datasets import testing
  from mne.forward._compute_forward import _MAG_FACTOR
  from mne.io import RawArray, read_info, read_raw_artemis123, read_raw_ctf, read_raw_fif, read_raw_kit
  from mne.simulation import add_chpi
  from mne.transforms import _angle_between_quats, rot_to_quat
  from mne.utils import assert_meg_snr, catch_logging, object_diff, verbose
  from mne.viz import plot_head_positions
label_desc: Use image node_id 3 for calling a global function with example usage: test_hpi_info(tmp_path) without return types