def fourier_features_pandas_udf(data, frequency: float=16.0):
    Fs = frequency
    results = []
    X = abs(np.fft.fft(data))
    nFFT = (int((len(X) / 2)) + 1)
    X = X[0:nFFT]
    X = (X / len(X))
    if ('fft_centroid' or ('fft_spread' in feature_names)):
        (C, S) = stSpectralCentroidAndSpread(X, Fs)
        if ('fft_centroid' in feature_names):
            results.append(C)
        if ('fft_spread' in feature_names):
            results.append(S)
    if ('spectral_entropy' in feature_names):
        se = stSpectralEntropy(X)
        results.append(se)
    if ('spectral_entropy_old' in feature_names):
        se_old = spectral_entropy(X, frequency)
        results.append(se_old)
    if ('fft_flux' in feature_names):
        flx = stSpectralFlux(X, X.copy())
        results.append(flx)
    if ('spectral_folloff' in feature_names):
        roff = stSpectralRollOff(X, 0.9, frequency)
        results.append(roff)
    return pd.Series(results)
def fourier_features_pandas_udf(data, frequency: float=16.0):
    Fs = frequency
    results = []
    X = abs(np.fft.fft(data))
    nFFT = (int((len(X) / 2)) + 1)
    X = X[0:nFFT]
    X = (X / len(X))
    if ('fft_centroid' or ('fft_spread' in feature_names)):
        (C, S) = stSpectralCentroidAndSpread(X, Fs)
        if ('fft_centroid' in feature_names):
            results.append(C)
        if ('fft_spread' in feature_names):
            results.append(S)
    if ('spectral_entropy' in feature_names):
        se = stSpectralEntropy(X)
        results.append(se)
    if ('spectral_entropy_old' in feature_names):
        se_old = spectral_entropy(X, frequency)
        results.append(se_old)
    if ('fft_flux' in feature_names):
        flx = stSpectralFlux(X, X.copy())
        results.append(flx)
    if ('spectral_folloff' in feature_names):
        roff = stSpectralRollOff(X, 0.9, frequency)
        results.append(roff)
    return pd.Series(results)