code: def _get_central_motif(
      Ts,
      bsf_radius,
      bsf_Ts_idx,
      bsf_subseq_idx,
      m,
      M_Ts,
      Σ_Ts,
      Ts_subseq_isconstant,
  ):
      """
      Compare subsequences with the same radius and return the most central motif (i.e.,
      having the smallest average nearest neighbor radii)
  
      Parameters
      ----------
      Ts : list
          A list of time series for which to find the most central motif
  
      bsf_radius : float
          Best-so-far sradius found by a consensus search algorithm
  
      bsf_Ts_idx : int
          The index of time series in `Ts` where the `bsf_radius` was first observed
  
      bsf_subseq_idx : int
          The subsequence index in `Ts[bsf_Ts_idx]` that has radius `bsf_radius`
  
      m : int
          Window size
  
      M_Ts : list
          A list of rolling window means for each time series in `Ts`
  
      Σ_Ts : list
          A list of rolling window standard deviations for each time series in `Ts`
  
      Ts_subseq_isconstant : list
          A list of rolling window isconstant for each time series in `Ts`
  
      Returns
      -------
      bsf_radius : float
          The updated best-so-far radius of the most central consensus motif
  
      bsf_Ts_idx : int
          The updated index of time series in `Ts` which contains the most central
          consensus motif
  
      bsf_subseq_idx : int
          The updated subsequence index in the time series `Ts[bsf_Ts_idx]` that contains
          the most central consensus motif
      """
      (
          bsf_nns_radii,
          bsf_nns_subseq_idx,
      ) = _across_series_nearest_neighbors(
          Ts,
          bsf_Ts_idx,
          bsf_subseq_idx,
          m,
          M_Ts,
          Σ_Ts,
          Ts_subseq_isconstant,
      )
      bsf_nns_mean_radii = bsf_nns_radii.mean()
  
      candidate_nns_Ts_idx = np.flatnonzero(
          np.isclose(bsf_nns_radii, bsf_radius)
      )
      candidate_nns_subseq_idx = bsf_nns_subseq_idx[
          candidate_nns_Ts_idx
      ]
  
      for Ts_idx, subseq_idx in zip(
          candidate_nns_Ts_idx, candidate_nns_subseq_idx
      ):
          candidate_nns_radii, _ = _across_series_nearest_neighbors(
              Ts,
              Ts_idx,
              subseq_idx,
              m,
              M_Ts,
              Σ_Ts,
              Ts_subseq_isconstant,
          )
          if (
              np.isclose(candidate_nns_radii.max(), bsf_radius)
              and candidate_nns_radii.mean() < bsf_nns_mean_radii
          ):
              bsf_Ts_idx = Ts_idx
              bsf_subseq_idx = subseq_idx
              bsf_nns_mean_radii = candidate_nns_radii.mean()
  
      return bsf_radius, bsf_Ts_idx, bsf_subseq_idx
  
file_path: stumpy/stumpy/ostinato.py
imports: import numpy
  from .None import core
  from .aamp_ostinato import aamp_ostinato, aamp_ostinatoed
  from .stump import stump
  from .stumped import stumped
label_desc: Use image node_id 2 for calling a global function with example usage: _get_central_motif(Ts, bsf_radius, bsf_Ts_idx, bsf_subseq_idx, m, M_Ts, Σ_Ts, Ts_subseq_isconstant) and returns: bsf_radius,  bsf_Ts_idx,  bsf_subseq_idx