docstr: Test if flat maxima are detected correctly.
docstr_tok: ["Test","if","flat","maxima","are","detected","correctly","."]
code: def test_flat_maxima(self):
      """Test if flat maxima are detected correctly."""
      x = np.array(
          [
              -1.3,
              0,
              1,
              0,
              2,
              2,
              0,
              3,
              3,
              3,
              2.99,
              4,
              4,
              4,
              4,
              -10,
              -5,
              -5,
              -5,
              -5,
              -5,
              -10,
          ]
      )
      midpoints, left_edges, right_edges = _local_maxima_1d(x)
      assert_equal(midpoints, np.array([2, 4, 8, 12, 18]))
      assert_equal(left_edges, np.array([2, 4, 7, 11, 16]))
      assert_equal(right_edges, np.array([2, 5, 9, 14, 20]))
  
imports: 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.signal._peak_finding import argrelmax, argrelmin, peak_prominences, peak_widths, _unpack_condition_args, find_peaks, find_peaks_cwt, _identify_ridge_lines
  from scipy.signal.windows import gaussian
  from scipy.signal._peak_finding_utils import _local_maxima_1d, PeakPropertyWarning
label_desc: Use image node_id 4 for calling the TestLocalMaxima1d obj's underlying member method code with example usage: obj.test_flat_maxima() without return types