code: def getFFT(data, rate, chunk_size, log_scale=False):
      data = data * np.hamming(len(data))
      try:
          FFT = np.abs(np.fft.rfft(data)[1:])
      except:
          FFT = np.fft.fft(data)
          left, right = np.split(np.abs(FFT), 2)
          FFT = np.add(left, right[::-1])
  
      # fftx = np.fft.fftfreq(chunk_size, d=1.0/rate)
      # fftx = np.split(np.abs(fftx), 2)[0]
  
      if log_scale:
          try:
              FFT = np.multiply(20, np.log10(FFT))
          except Exception as e:
              print("Log(FFT) failed: %s" % str(e))
  
      return FFT
  
label_desc: Use image node_id 1 for calling a global function with example usage: getFFT(data, rate, chunk_size, log_scale) and returns: FFT