code: def test_simulation_cascade():
      """Test that cascading operations do not overwrite data."""
      # Create 10 second raw dataset with zeros in the data matrix
      raw_null = read_raw_fif(raw_chpi_fname, allow_maxshield="yes")
      raw_null.crop(0, 1).pick("meg").load_data()
      raw_null.apply_function(lambda x: np.zeros_like(x))
      assert_array_equal(raw_null.get_data(), 0.0)
  
      # Calculate independent signal additions
      raw_eog = raw_null.copy()
      add_eog(raw_eog, random_state=0)
  
      raw_ecg = raw_null.copy()
      add_ecg(raw_ecg, random_state=0)
  
      raw_noise = raw_null.copy()
      cov = make_ad_hoc_cov(raw_null.info)
      add_noise(raw_noise, cov, random_state=0)
  
      raw_chpi = raw_null.copy()
      add_chpi(raw_chpi)
  
      # Calculate Cascading signal additions
      raw_cascade = raw_null.copy()
      add_eog(raw_cascade, random_state=0)
      add_ecg(raw_cascade, random_state=0)
      add_chpi(raw_cascade)
      add_noise(raw_cascade, cov, random_state=0)
  
      cascade_data = raw_cascade.get_data()
      serial_data = 0.0
      for raw_other in (raw_eog, raw_ecg, raw_noise, raw_chpi):
          serial_data += raw_other.get_data()
  
      assert_allclose(cascade_data, serial_data, atol=1e-20)
  
imports: from copy import deepcopy
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal
  from mne import Epochs, SourceEstimate, VolSourceEstimate, convert_forward_solution, create_info, find_events, fit_dipole, make_ad_hoc_cov, make_bem_solution, make_forward_solution, make_sphere_model, pick_types, read_bem_solution, read_cov, read_source_spaces, read_trans, setup_source_space, setup_volume_source_space, transform_surface_to
  from mne._fiff.constants import FIFF
  from mne.bem import _surfaces_to_bem
  from mne.chpi import compute_chpi_amplitudes, compute_chpi_locs, compute_head_pos, get_chpi_info, read_head_pos
  from mne.datasets import testing
  from mne.io import RawArray, read_raw_fif
  from mne.label import Label
  from mne.simulation import add_chpi, add_ecg, add_eog, add_noise, simulate_raw, simulate_sparse_stc
  from mne.simulation.source import SourceSimulator
  from mne.source_space._source_space import _compare_source_spaces
  from mne.surface import _get_ico_surface
  from mne.tests.test_chpi import _assert_quats
  from mne.utils import catch_logging
label_desc: Use image node_id 11 for calling a global function with example usage: test_simulation_cascade() without return types