"""
Function of this code: one method of feature extraciton from the numerical values.
Contact for help: gch_liu@163.com 
"""
import numpy as np
#from numpy import fft
import math
def seq_fft(seq):
    if type(seq)!=list and type(seq)!=np.ndarray:
        return [seq];
    NK=len(seq);
    m=math.floor((NK-1)/2);
    power_sp=[];
    
    fft_seq=np.fft.fft(seq);
    

    for j in range(0,m):
        power_sp.append(abs(fft_seq[j])*abs(fft_seq[j]));
        
    return power_sp;

if __name__=='__main__':
    print(seq_fft([1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]))