# 5.4.1.7. eqcorrscan.utils.clustering.distance_matrix

`eqcorrscan.utils.clustering.``distance_matrix`(stream_list, allow_shift=False, shift_len=0, cores=1)

  Compute distance matrix for waveforms based on cross-correlations.

  Function to compute the distance matrix for all templates - will give distance as 1-abs(cccoh), e.g. a well correlated pair of templates will have small distances, and an equally well correlated reverse image will have the same distance as a positively correlated image - this is an issue.

  Parameters: | stream_list (list) List of the `obspy.core.stream.Stream` to compute the distance matrix for allow_shift (bool) To allow templates to shift or not? shift_len (int) How many samples for templates to shift in time cores (int) Number of cores to parallel process using, defaults to 1.
  Returns: | distance matrix
  Return type: | `numpy.ndarray`

  Warning

  Because distance is given as \(1-abs(coherence)\), negatively correlated and positively correlated objects are given the same distance.