docstr: Test distance condition for peaks.
docstr_tok: ["Test","distance","condition","for","peaks","."]
code: def test_distance_condition(self):
      """
      Test distance condition for peaks.
      """
      # Peaks of different height with constant distance 3
      peaks_all = np.arange(1, 21, 3)
      x = np.zeros(21)
      x[peaks_all] += np.linspace(1, 2, peaks_all.size)
  
      # Test if peaks with "minimal" distance are still selected (distance = 3)
      assert_equal(find_peaks(x, distance=3)[0], peaks_all)
  
      # Select every second peak (distance > 3)
      peaks_subset = find_peaks(x, distance=3.0001)[0]
      # Test if peaks_subset is subset of peaks_all
      assert_(
          np.setdiff1d(peaks_subset, peaks_all, assume_unique=True).size
          == 0
      )
      # Test if every second peak was removed
      assert_equal(np.diff(peaks_subset), 6)
  
      # Test priority of peak removal
      x = [-2, 1, -1, 0, -3]
      peaks_subset = find_peaks(x, distance=10)[
          0
      ]  # use distance > x size
      assert_(peaks_subset.size == 1 and peaks_subset[0] == 1)
  
imports: from __future__ import division, print_function, absolute_import
  import copy
  import numpy
  from numpy.testing import assert_, assert_equal, assert_allclose, assert_array_equal
  import pytest
  from pytest import raises, warns
  from scipy._lib.six import xrange
  from scipy.signal._peak_finding import argrelmax, argrelmin, peak_prominences, peak_widths, _unpack_condition_args, find_peaks, find_peaks_cwt, _identify_ridge_lines
  from scipy.signal._peak_finding_utils import _local_maxima_1d, PeakPropertyWarning
label_desc: Use image node_id 5 for calling the TestFindPeaks obj's underlying member method code with example usage: obj.test_distance_condition() without return types