code: def corr_cluster(trace_list, thresh=0.9):
      
      stack = stacking.linstack([Stream(tr) for tr in trace_list])[0]
      output = np.array([False] * len(trace_list))
      group1 = []
      array_xcorr = get_array_xcorr()
      for i, tr in enumerate(trace_list):
          if array_xcorr(
                  np.array([tr.data]), stack.data, [0])[0][0][0] > 0.6:
              output[i] = True
              group1.append(tr)
      if not group1:
          warnings.warn('Nothing made it past the first 0.6 threshold')
          return output
      stack = stacking.linstack([Stream(tr) for tr in group1])[0]
      group2 = []
      for i, tr in enumerate(trace_list):
          if array_xcorr(
                  np.array([tr.data]), stack.data, [0])[0][0][0] > thresh:
              group2.append(tr)
              output[i] = True
          else:
              output[i] = False
      return output
docs: Group traces based on correlations above threshold with the stack.
  
      Will run twice, once with a lower threshold to remove large outliers that
      would negatively affect the stack, then again with your threshold.
  
      :type trace_list: list
      :param trace_list:
          List of :class:`obspy.core.stream.Trace` to compute similarity between
      :type thresh: float
      :param thresh: Correlation threshold between -1-1
  
      :returns:
          :class:`numpy.ndarray` of bool of whether that trace correlates well
          enough (above your given threshold) with the stack.
  
      .. note::
          We recommend that you align the data before computing the clustering,
          e.g., the P-arrival on all templates for the same channel should
          appear at the same time in the trace.  See the
          :func:`eqcorrscan.utils.stacking.align_traces` function for a way to do
          this.