code: def test_array_epochs(tmp_path):
      """Test creating evoked from array."""
      # creating
      rng = np.random.RandomState(42)
      data1 = rng.randn(20, 60)
      sfreq = 1e3
      ch_names = ["EEG %03d" % (i + 1) for i in range(20)]
      types = ["eeg"] * 20
      info = create_info(ch_names, sfreq, types)
      evoked1 = EvokedArray(data1, info, tmin=-0.01)
  
      # save, read, and compare evokeds
      tmp_fname = tmp_path / "evkdary-ave.fif"
      evoked1.save(tmp_fname)
      evoked2 = read_evokeds(tmp_fname)[0]
      data2 = evoked2.data
      assert_allclose(data1, data2)
      assert_array_almost_equal(evoked1.times, evoked2.times, 8)
      assert_equal(evoked1.first, evoked2.first)
      assert_equal(evoked1.last, evoked2.last)
      assert_equal(evoked1.kind, evoked2.kind)
      assert_equal(evoked1.nave, evoked2.nave)
  
      # now compare with EpochsArray (with single epoch)
      data3 = data1[np.newaxis, :, :]
      events = np.c_[10, 0, 1]
      evoked3 = EpochsArray(
          data3, info, events=events, tmin=-0.01
      ).average()
      assert_allclose(evoked1.data, evoked3.data)
      assert_allclose(evoked1.times, evoked3.times)
      assert_equal(evoked1.first, evoked3.first)
      assert_equal(evoked1.last, evoked3.last)
      assert_equal(evoked1.kind, evoked3.kind)
      assert_equal(evoked1.nave, evoked3.nave)
  
      # test kind check
      with pytest.raises(ValueError, match="Invalid value"):
          EvokedArray(data1, info, tmin=0, kind=1)
      with pytest.raises(ValueError, match="Invalid value"):
          EvokedArray(data1, info, kind="mean")
  
      # test match between channels info and data
      ch_names = ["EEG %03d" % (i + 1) for i in range(19)]
      types = ["eeg"] * 19
      info = create_info(ch_names, sfreq, types)
      pytest.raises(ValueError, EvokedArray, data1, info, tmin=-0.01)
  
imports: import pickle
  from copy import deepcopy
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal, assert_equal
  from scipy import fftpack
  from mne import Epochs, EpochsArray, combine_evoked, create_info, equalize_channels, pick_types, read_events, read_evokeds, write_evokeds
  from mne._fiff.constants import FIFF
  from mne.evoked import Evoked, EvokedArray, _get_peak
  from mne.io import read_raw_fif
  from mne.utils import grand_average
label_desc: Use image node_id 22 for calling a global function with example usage: test_array_epochs(tmp_path) without return types