code: def test_aamp_motifs_two_motifs():
      # Fix seed, because in some case motifs can be off by an index resulting in test
      # fails, which is caused since one of the motifs is not repeated perfectly in T.
      np.random.seed(1234)
  
      # The time series is random noise with two motifs for m=10:
      # * (almost) identical step functions at indices 10, 110 and 210
      # * identical linear slopes at indices 70 and 170
      T = np.random.normal(size=300)
      m = 20
  
      T[10:30] = 1
      T[12:28] = 2
  
      # This is not part of the motif in the aamp case
      T[110:130] = 3
      T[112:128] = 6
      T[120] = 6.6
  
      T[210:230] = 1
      T[212:228] = 2
      T[220] = 1.9
      # naive.distance(naive.z_norm(T[10:30]), naive.z_norm(T[110:130])) = 0.47
      # naive.distance(naive.z_norm(T[10:30]), naive.z_norm(T[210:230])) = 0.24
      # naive.distance(naive.z_norm(T[110:130]), naive.z_norm(T[210:230])) = 0.72
      # Hence T[10:30] is the motif representative for this motif
  
      T[70:90] = np.arange(m) * 0.1
      T[170:190] = np.arange(m) * 0.1
      # naive.distance(naive.z_norm(T[70:90]), naive.z_norm(T[170:190])) = 0.0
  
      max_motifs = 2
  
      mp = naive.aamp(T, m)
  
      # left_indices = [[70, 170], [10, 210]]
      left_profile_values = [
          [0.0, 0.0],
          [
              0.0,
              naive.distance(T[10:30], T[210:230]),
          ],
      ]
  
      right_distance_values, right_indices = aamp_motifs(
          T,
          mp[:, 0],
          max_motifs=max_motifs,
          max_distance=0.5,
          cutoff=np.inf,
      )
  
      # We ignore indices because of sorting ambiguities for equal distances.
      # As long as the distances are correct, the indices will be too.
      npt.assert_almost_equal(
          left_profile_values, right_distance_values, decimal=6
      )
  
      # Reset seed
      np.random.seed(None)
  
file_path: stumpy/tests/test_aamp_motifs.py
imports: import naive
  import numpy
  import numpy.testing
  import pytest
  from stumpy import aamp_match, aamp_motifs, core
label_desc: Use image node_id 3 for calling a global function with example usage: test_aamp_motifs_two_motifs() without return types