code: def test_fft():
      f = 20.0
      x = np.linspace(0, 1, 1000)
      y = np.sin(2 * np.pi * f * x)
      pd = pg.PlotDataItem(x, y)
      pd.setFftMode(True)
      x, y = pd.getData()
      assert abs(x[np.argmax(y)] - f) < 0.03
  
      x = np.linspace(0, 1, 1001)
      y = np.sin(2 * np.pi * f * x)
      pd.setData(x, y)
      x, y = pd.getData()
      assert abs(x[np.argmax(y)] - f) < 0.03
  
      pd.setLogMode(True, False)
      x, y = pd.getData()
      assert abs(x[np.argmax(y)] - np.log10(f)) < 0.01
  
file_path: pyqtgraph/tests/graphicsItems/test_PlotDataItem.py
imports: import warnings
  import numpy
  import pyqtgraph
  from pyqtgraph.Qt import QtGui
label_desc: Use image node_id 3 for calling a global function with example usage: test_fft() without return types