code: def test_norm_epsilon():
      """Test computation of espilon norm on TF coefficients."""
      tstep = np.array([2])
      wsize = np.array([4])
      n_times = 10
      n_steps = np.ceil(n_times / tstep.astype(float)).astype(int)
      n_freqs = wsize // 2 + 1
      n_coefs = n_steps * n_freqs
      phi = _Phi(wsize, tstep, n_coefs, n_times)
  
      Y = np.zeros((n_steps * n_freqs).item())
      l1_ratio = 0.03
      assert_allclose(norm_epsilon(Y, l1_ratio, phi), 0.0)
  
      Y[0] = 2.0
      assert_allclose(norm_epsilon(Y, l1_ratio, phi), np.max(Y))
  
      l1_ratio = 1.0
      assert_allclose(norm_epsilon(Y, l1_ratio, phi), np.max(Y))
      # dummy value without random:
      Y = np.arange((n_steps * n_freqs).item())
      l1_ratio = 0.0
      assert_allclose(
          norm_epsilon(Y, l1_ratio, phi) ** 2,
          stft_norm2(Y.reshape(-1, n_freqs[0], n_steps[0])),
      )
  
      l1_ratio = 0.03
      # test that vanilla epsilon norm = weights equal to 1
      w_time = np.ones(n_coefs[0])
      Y = np.abs(np.random.randn(n_coefs[0]))
      assert_allclose(
          norm_epsilon(Y, l1_ratio, phi),
          norm_epsilon(Y, l1_ratio, phi, w_time=w_time),
      )
  
      # scaling w_time and w_space by the same amount should divide
      # epsilon norm by the same amount
      Y = np.arange(n_coefs.item()) + 1
      mult = 2.0
      assert_allclose(
          norm_epsilon(
              Y,
              l1_ratio,
              phi,
              w_space=1,
              w_time=np.ones(n_coefs.item()),
          )
          / mult,
          norm_epsilon(
              Y,
              l1_ratio,
              phi,
              w_space=mult,
              w_time=mult * np.ones(n_coefs.item()),
          ),
      )
  
file_path: mne-python/mne/inverse_sparse/tests/test_mxne_optim.py
imports: import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal, assert_array_less
  from mne.inverse_sparse.mxne_optim import _Phi, _PhiT, dgap_l21l1, iterative_mixed_norm_solver, iterative_tf_mixed_norm_solver, mixed_norm_solver, norm_epsilon, norm_epsilon_inf, tf_mixed_norm_solver
  from mne.time_frequency._stft import stft_norm2
  from mne.utils import _record_warnings, catch_logging
label_desc: Use image node_id 5 for calling a global function with example usage: test_norm_epsilon() without return types