code: def test_stumpi_stream_nan_inf_self_join_egress(
      substitute, substitution_locations
  ):
      m = 3
  
      seed = np.random.randint(100000)
  
      for substitution_location in substitution_locations:
          np.random.seed(seed)
          T = np.random.rand(64)
          n = 30
  
          ref_mp = naive.stumpi_egress(T[:n], m)
          ref_P = ref_mp.P_.copy()
          ref_I = ref_mp.I_
          ref_left_P = ref_mp.left_P_.copy()
          ref_left_I = ref_mp.left_I_
  
          stream = stumpi(T[:n], m, egress=True)
  
          comp_P = stream.P_.copy()
          comp_I = stream.I_
          comp_left_P = stream.left_P_.copy()
          comp_left_I = stream.left_I_
  
          naive.replace_inf(ref_P)
          naive.replace_inf(ref_left_P)
          naive.replace_inf(comp_P)
          naive.replace_inf(comp_left_P)
  
          npt.assert_almost_equal(ref_P, comp_P)
          npt.assert_almost_equal(ref_I, comp_I)
          npt.assert_almost_equal(ref_left_P, comp_left_P)
          npt.assert_almost_equal(ref_left_I, comp_left_I)
  
          if substitution_location == -1:
              substitution_location = T[30:].shape[0] - 1
          T[n:][substitution_location] = substitute
          for t in T[n:]:
              ref_mp.update(t)
              stream.update(t)
  
              comp_P = stream.P_.copy()
              comp_I = stream.I_
              comp_left_P = stream.left_P_.copy()
              comp_left_I = stream.left_I_
  
              ref_P = ref_mp.P_.copy()
              ref_I = ref_mp.I_
              ref_left_P = ref_mp.left_P_.copy()
              ref_left_I = ref_mp.left_I_
  
              naive.replace_inf(ref_P)
              naive.replace_inf(ref_left_P)
              naive.replace_inf(comp_P)
              naive.replace_inf(comp_left_P)
  
              npt.assert_almost_equal(ref_P, comp_P)
              npt.assert_almost_equal(ref_I, comp_I)
              npt.assert_almost_equal(ref_left_P, comp_left_P)
              npt.assert_almost_equal(ref_left_I, comp_left_I)
  
          np.random.seed(seed)
          T = np.random.rand(64)
  
          ref_mp = naive.stumpi_egress(T[:n], m)
          ref_P = ref_mp.P_.copy()
          ref_I = ref_mp.I_
          ref_left_P = ref_mp.left_P_.copy()
          ref_left_I = ref_mp.left_I_
  
          stream = stumpi(T[:n], m, egress=True)
  
          comp_P = stream.P_.copy()
          comp_I = stream.I_
          comp_left_P = stream.left_P_.copy()
          comp_left_I = stream.left_I_
  
          naive.replace_inf(ref_P)
          naive.replace_inf(ref_left_P)
          naive.replace_inf(comp_P)
          naive.replace_inf(comp_left_P)
  
          npt.assert_almost_equal(ref_P, comp_P)
          npt.assert_almost_equal(ref_I, comp_I)
          npt.assert_almost_equal(ref_left_P, comp_left_P)
          npt.assert_almost_equal(ref_left_I, comp_left_I)
  
          if substitution_location == -1:  # pragma: no cover
              substitution_location = T[n:].shape[0] - 1
          T[n:][substitution_location] = substitute
          for t in T[n:]:
              ref_mp.update(t)
              stream.update(t)
  
              comp_P = stream.P_.copy()
              comp_I = stream.I_
              comp_left_P = stream.left_P_.copy()
              comp_left_I = stream.left_I_
  
              ref_P = ref_mp.P_.copy()
              ref_I = ref_mp.I_
              ref_left_P = ref_mp.left_P_.copy()
              ref_left_I = ref_mp.left_I_
  
              naive.replace_inf(ref_P)
              naive.replace_inf(ref_left_P)
              naive.replace_inf(comp_P)
              naive.replace_inf(comp_left_P)
  
              npt.assert_almost_equal(ref_P, comp_P)
              npt.assert_almost_equal(ref_I, comp_I)
              npt.assert_almost_equal(ref_left_P, comp_left_P)
              npt.assert_almost_equal(ref_left_I, comp_left_I)
  
imports: import functools
  import naive
  import numpy
  import numpy.testing
  import pandas
  import pytest
  from stumpy import config, core, stumpi
label_desc: Use image node_id 7 for calling a global function with example usage: test_stumpi_stream_nan_inf_self_join_egress(substitute, substitution_locations) without return types