code: def _get_all_aampdist_profiles(
      T,
      m,
      percentage=1.0,
      s=None,
      mpdist_percentage=0.05,
      mpdist_k=None,
      mpdist_custom_func=None,
      p=2.0,
  ):
      """
      For each non-overlapping subsequence, `S[i]`, in `T`, compute the matrix profile
      distance measure vector between the `i`th non-overlapping subsequence and each
      sliding window subsequence, `T[j : j + m]`, within `T` where `j < len(T) - m + 1`.
  
      Parameters
      ----------
      T : numpy.ndarray
          The time series or sequence for which to find the snippets
  
      m : int
          The window size for each non-overlapping subsequence, `S[i]`.
  
      percentage : float, default 1.0
          With the length of each non-overlapping subsequence, `S[i]`, set to `m`, this
          is the percentage of `S[i]` (i.e., `percentage * m`) to set the `s` to. When
          `percentage == 1.0`, then the full length of `S[i]` is used to compute the
          `mpdist_vect`. When `percentage < 1.0`, then shorter subsequences from `S[i]`
          is used to compute `mpdist_vect`.
  
      s : int, default None
          With the length of each non-overlapping subsequence, `S[i]`, set to `m`, this
          is essentially the sub-subsequence length (i.e., a shorter part of `S[i]`).
          When `s == m`, then the full length of `S[i]` is used to compute the
          `mpdist_vect`. When `s < m`, then shorter subsequences with length `s` from
          each `S[i]` is used to compute `mpdist_vect`. When `s` is not `None`, then
          the `percentage` parameter is ignored.
  
      mpdist_percentage : float, default 0.05
          The percentage of distances that will be used to report `mpdist`. The value
          is between 0.0 and 1.0.
  
      mpdist_k : int
          Specify the `k`th value in the concatenated matrix profiles to return. When
          `mpdist_k` is not `None`, then the `mpdist_percentage` parameter is ignored.
  
      mpdist_custom_func : function, default None
          A custom user defined function for selecting the desired value from the
          sorted `P_ABBA` array. This function may need to leverage `functools.partial`
          and should take `P_ABBA` as its only input parameter and return a single
          `MPdist` value. The `percentage` and `k` parameters are ignored when
          `mpdist_custom_func` is not None.
  
      p : float, default 2.0
          The p-norm to apply for computing the Minkowski distance.
  
      Returns
      -------
      D : numpy.ndarray
          MPdist profiles
  
      Notes
      -----
      `DOI: 10.1109/ICBK.2018.00058 \
      <https://www.cs.ucr.edu/~eamonn/Time_Series_Snippets_10pages.pdf>`__
  
      See Table II
      """
      if m > T.shape[0] // 2:  # pragma: no cover
          raise ValueError(
              f"The window size {m} for each non-overlapping subsequence is too large "
              f"for a time series with length {T.shape[0]}. "
              f"Please try `m <= len(T) // 2`."
          )
  
      right_pad = 0
      if T.shape[0] % m != 0:
          right_pad = int(m * np.ceil(T.shape[0] / m) - T.shape[0])
          pad_width = (0, right_pad)
          T = np.pad(
              T, pad_width, mode="constant", constant_values=np.nan
          )
  
      n_padded = T.shape[0]
      D = np.empty(
          ((n_padded // m) - 1, n_padded - m + 1), dtype=np.float64
      )
  
      if s is not None:
          s = min(int(s), m)
      else:
          percentage = np.clip(percentage, 0.0, 1.0)
          s = min(math.ceil(percentage * m), m)
  
      # Iterate over non-overlapping subsequences, see Definition 3
      for i in range((n_padded // m) - 1):
          start = i * m
          stop = (i + 1) * m
          S_i = T[start:stop]
          D[i, :] = _aampdist_vect(
              S_i,
              T,
              s,
              percentage=mpdist_percentage,
              k=mpdist_k,
              custom_func=mpdist_custom_func,
              p=p,
          )
  
      stop_idx = n_padded - m + 1 - right_pad
      D = D[:, :stop_idx]
  
      return D
  
imports: import math
  import numpy
  from .aampdist import _aampdist_vect
  from .core import _get_mask_slices, check_window_size
label_desc: Use image node_id 1 for calling a global function with example usage: _get_all_aampdist_profiles(T, m, percentage, s, mpdist_percentage, mpdist_k, mpdist_custom_func, p) and returns: D