code: def _rea(cac, n_regimes, L, excl_factor=5):
      """
      Find the location of the regimes using the regime extracting
      algorithm (REA)
  
      Parameters
      ----------
      cac : numpy.ndarray
          The corrected arc curve
  
      n_regimes : int
          The number of regimes to search for. This is one more than the
          number of regime changes as denoted in the original paper.
  
      L : int
          The subsequence length that is set roughly to be one period length.
          This is likely to be the same value as the window size, `m`, used
          to compute the matrix profile and matrix profile index but it can
          be different since this is only used to manage edge effects
          and has no bearing on any of the IAC or CAC core calculations.
  
      excl_factor : int, default 5
          The multiplying factor for the regime exclusion zone
  
      Returns
      -------
      regime_locs : numpy.ndarray
          The locations of the regimes
  
      Notes
      -----
      DOI: 10.1109/ICDM.2017.21 <https://www.cs.ucr.edu/~eamonn/Segmentation_ICDM.pdf>`__
  
      See Table II
  
      This is the implementation for the regime extracting algorithm (REA).
      """
      regime_locs = np.empty(n_regimes - 1, dtype=np.int64)
      tmp_cac = copy.deepcopy(cac)
      for i in range(n_regimes - 1):
          regime_locs[i] = np.argmin(tmp_cac)
          excl_start = max(regime_locs[i] - excl_factor * L, 0)
          excl_stop = min(
              regime_locs[i] + excl_factor * L, cac.shape[0]
          )
          tmp_cac[excl_start:excl_stop] = 1.0
  
      return regime_locs
  
file_path: stumpy/stumpy/floss.py
imports: import copy
  import numpy
  import scipy.stats
  from .None import config, core
label_desc: Use image node_id 4 for calling a global function with example usage: _rea(cac, n_regimes, L, excl_factor) and returns: regime_locs