docstr: Apply FFT algorithm to an input xarray.
docstr_tok: ["Apply","FFT","algorithm","to","an","input","xarray","."]
code: def fft_algorithm(
      data: np.ndarray, algorithm_params: dict
  ) -> np.ndarray:
      """
      Apply FFT algorithm to an input xarray.
      """
      from scipy import signal
  
      hop_length = algorithm_params["hop_length"]
      n_fft = algorithm_params["n_fft"]
  
      noverlap = n_fft - hop_length
  
      _, _, spectrogram = signal.stft(
          data,
          nfft=n_fft,
          nperseg=n_fft,
          noverlap=noverlap,
          return_onesided=False,
          boundary=None,
      )
  
      spectrogram = np.abs(spectrogram)
      spectrogram = 10 * np.log10(spectrogram**2)
      return spectrogram
  
imports: import argparse
  import json
  import logging
  import math
  import os
  import random
  import time
  from copy import copy, deepcopy
  from typing import List, Tuple
  import dask.array
  import numpy
  import xarray
  import ray
  from ray._private.test_utils import monitor_memory_usage
  from ray.util.dask import ray_dask_get
label_desc: Use image node_id 4 for calling the TransformRoutines obj's underlying member method code with example usage: obj.fft_algorithm(data, algorithm_params) and returns: spectrogram