code: def _1d_overlap_filter(x, n_h, n_edge, phase, cuda_dict, pad, n_fft):
      """Do one-dimensional overlap-add FFT FIR filtering."""
      # pad to reduce ringing
      x_ext = _smart_pad(x, (n_edge, n_edge), pad)
      n_x = len(x_ext)
      x_filtered = np.zeros_like(x_ext)
  
      n_seg = n_fft - n_h + 1
      n_segments = int(np.ceil(n_x / float(n_seg)))
      shift = (
          (n_h - 1) // 2 if phase.startswith("zero") else 0
      ) + n_edge
  
      # Now the actual filtering step is identical for zero-phase (filtfilt-like)
      # or single-pass
      for seg_idx in range(n_segments):
          start = seg_idx * n_seg
          stop = (seg_idx + 1) * n_seg
          seg = x_ext[start:stop]
          seg = np.concatenate([seg, np.zeros(n_fft - len(seg))])
  
          prod = _fft_multiply_repeated(seg, cuda_dict)
  
          start_filt = max(0, start - shift)
          stop_filt = min(start - shift + n_fft, n_x)
          start_prod = max(0, shift - start)
          stop_prod = start_prod + stop_filt - start_filt
          x_filtered[start_filt:stop_filt] += prod[start_prod:stop_prod]
  
      # Remove mirrored edges that we added and cast (n_edge can be zero)
      x_filtered = x_filtered[: n_x - 2 * n_edge].astype(x.dtype)
      return x_filtered
  
imports: from collections import Counter
  from copy import deepcopy
  from functools import partial
  from math import gcd
  import numpy
  from scipy import fft, signal
  from scipy.stats import f
  from ._fiff.pick import _picks_to_idx
  from ._ola import _COLA
  from .cuda import _fft_multiply_repeated, _fft_resample, _setup_cuda_fft_multiply_repeated, _setup_cuda_fft_resample, _smart_pad
  from .parallel import parallel_func
  from .utils import _check_option, _check_preload, _ensure_int, _pl, _validate_type, logger, sum_squared, verbose, warn
label_desc: Use image node_id 4 for calling a global function with example usage: _1d_overlap_filter(x, n_h, n_edge, phase, cuda_dict, pad, n_fft) and returns: x_filtered