code: def test_aamp_floss_inf_nan(substitute, substitution_locations):
      T = np.random.uniform(-1000, 1000, [64])
      m = 5
      n = 30
      data = T.copy()
      for substitution_location in substitution_locations:
          data[:] = T[:]
          data[substitution_location] = substitute
          old_data = data[:n]
  
          mp = naive_right_mp(old_data, m, normalize=False)
          comp_mp = aamp(old_data, m)
          k = mp.shape[0]
  
          rolling_Ts = core.rolling_window(data[1:], n)
          L = 5
          excl_factor = 1
          custom_iac = _iac(k, bidirectional=False)
          stream = floss(
              comp_mp,
              old_data,
              m,
              L,
              excl_factor,
              custom_iac=custom_iac,
              normalize=False,
          )
          last_idx = n - m + 1
          excl_zone = int(np.ceil(m / 4))
          zone_start = max(0, k - excl_zone)
          for i, ref_T in enumerate(rolling_Ts):
              mp[:, 1] = -1
              mp[:, 2] = -1
              mp[:] = np.roll(mp, -1, axis=0)
              mp[-1, 0] = np.inf
              mp[-1, 3] = last_idx + i
  
              D = naive.aamp_distance_profile(ref_T[-m:], ref_T, m)
              D[zone_start:] = np.inf
  
              ref_T_isfinite = np.isfinite(ref_T)
              ref_T_subseq_isfinite = np.all(
                  core.rolling_window(ref_T_isfinite, m), axis=1
              )
  
              D[~ref_T_subseq_isfinite] = np.inf
              update_idx = np.argwhere(D < mp[:, 0]).flatten()
              mp[update_idx, 0] = D[update_idx]
              mp[update_idx, 3] = last_idx + i
  
              ref_cac_1d = _cac(
                  mp[:, 3] - i - 1,
                  L,
                  bidirectional=False,
                  excl_factor=excl_factor,
                  custom_iac=custom_iac,
              )
  
              ref_mp = mp.copy()
              ref_P = ref_mp[:, 0]
              ref_I = ref_mp[:, 3]
              ref_I[ref_mp[:, 0] == np.inf] = -1
  
              stream.update(ref_T[-1])
              comp_cac_1d = stream.cac_1d_
              comp_P = stream.P_
              comp_I = stream.I_
              comp_T = stream.T_
  
              naive.replace_inf(ref_P)
              naive.replace_inf(comp_P)
  
              npt.assert_almost_equal(ref_cac_1d, comp_cac_1d)
              npt.assert_almost_equal(ref_P, comp_P)
              npt.assert_almost_equal(ref_I, comp_I)
              npt.assert_almost_equal(ref_T, comp_T)
  
imports: import functools
  import naive
  import numpy
  import numpy.testing
  import pytest
  from stumpy import aamp, core, floss, fluss, stump
  from stumpy.floss import _cac, _iac, _nnmark, _rea
label_desc: Use image node_id 14 for calling a global function with example usage: test_aamp_floss_inf_nan(substitute, substitution_locations) without return types