code: def test_freq_mask():
      """Test safe frequency masking."""
      N = 10
      x = np.arange(N).astype(float)
      assert _freq_mask(x, 1000.0, fmin=0, fmax=N - 1).sum() == N
      assert (
          _freq_mask(x - 1e-10, 1000.0, fmin=0, fmax=N - 1).sum() == N
      )
      assert (
          _freq_mask(x - 1e-10, 1000.0, fmin=None, fmax=N - 1).sum()
          == N
      )
      assert (
          _freq_mask(x - 1e-10, 1000.0, fmin=None, fmax=None).sum() == N
      )
      assert (
          _freq_mask(x - 1e-10, 1000.0, fmin=-np.inf, fmax=None).sum()
          == N
      )
      assert (
          _freq_mask(x - 1e-10, 1000.0, fmin=None, fmax=np.inf).sum()
          == N
      )
      # non-uniformly spaced inputs
      x = np.array([4, 10])
      assert _freq_mask(x[:1], 1, fmin=10, raise_error=False).sum() == 0
      assert (
          _freq_mask(
              x[:1], 1, fmin=11, fmax=12, raise_error=False
          ).sum()
          == 0
      )
      assert _freq_mask(x, sfreq=1, fmin=10).sum() == 1
      assert _freq_mask(x, sfreq=1, fmin=6).sum() == 1
      assert _freq_mask(x, sfreq=1, fmin=5).sum() == 1
      assert _freq_mask(x, sfreq=1, fmin=4.5001).sum() == 1
      assert _freq_mask(x, sfreq=1, fmin=4.4999).sum() == 2
      assert _freq_mask(x, sfreq=1, fmin=4).sum() == 2
      # degenerate cases
      with pytest.raises(ValueError, match="sfreq can not be None"):
          _freq_mask(x[:1], sfreq=None, fmin=3, fmax=5)
      with pytest.raises(ValueError, match="No frequencies remain"):
          _freq_mask(x[:1], sfreq=1, fmin=11, fmax=12)
      with pytest.raises(
          ValueError, match="must be less than or equal to fmax"
      ):
          _freq_mask(x[:1], sfreq=1, fmin=10)
  
imports: from copy import deepcopy
  from datetime import datetime, timezone
  from io import StringIO
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal
  from scipy import sparse
  from mne import pick_types, read_cov, read_evokeds
  from mne._fiff.pick import _picks_by_type
  from mne.epochs import make_fixed_length_epochs
  from mne.io import read_raw_fif
  from mne.time_frequency import tfr_morlet
  from mne.utils import _PCA, _apply_scaling_array, _apply_scaling_cov, _array_equal_nan, _cal_to_julian, _custom_lru_cache, _dt_to_julian, _freq_mask, _get_inst_data, _julian_to_cal, _julian_to_dt, _reg_pinv, _ReuseCycle, _time_mask, _undo_scaling_array, _undo_scaling_cov, compute_corr, create_slices, grand_average, hashfunc, numerics, object_diff, object_hash, object_size, random_permutation, sum_squared
  from mne.utils.numerics import _LRU_CACHE_MAXSIZES, _LRU_CACHES
label_desc: Use image node_id 7 for calling a global function with example usage: test_freq_mask() without return types