code: def test_cov_scaling():
      """Test rescaling covs."""
      evoked = read_evokeds(
          ave_fname, condition=0, baseline=(None, 0), proj=True
      )
      cov = read_cov(cov_fname)["data"]
      cov2 = read_cov(cov_fname)["data"]
  
      assert_array_equal(cov, cov2)
      evoked.pick(
          [
              evoked.ch_names[k]
              for k in pick_types(evoked.info, meg=True, eeg=True)
          ]
      )
      picks_list = _picks_by_type(evoked.info)
      scalings = dict(mag=1e15, grad=1e13, eeg=1e6)
  
      _apply_scaling_cov(cov2, picks_list, scalings=scalings)
      _apply_scaling_cov(cov, picks_list, scalings=scalings)
      assert_array_equal(cov, cov2)
      assert cov.max() > 1
  
      _undo_scaling_cov(cov2, picks_list, scalings=scalings)
      _undo_scaling_cov(cov, picks_list, scalings=scalings)
      assert_array_equal(cov, cov2)
      assert cov.max() < 1
  
      data = evoked.data.copy()
      _apply_scaling_array(data, picks_list, scalings=scalings)
      _undo_scaling_array(data, picks_list, scalings=scalings)
      assert_allclose(data, evoked.data, atol=1e-20)
  
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 9 for calling a global function with example usage: test_cov_scaling() without return types