def set_svd_entropy(self):
   for e in xrange(self.data.shape[0]):
     if np.all(self.data[e][:1000] == 0):
       continue
     name = 'svd_entropy_e' + str(e)
     value = pyeeg.svd_entropy(W = self.svd_embed_seq['svd_embed_seq_e' + str(e)])
     self.features[name] = value
def svd_entropy(samples, **kwargs):
    try:
        embedding_dimension = kwargs[EMBEDDING_DIMENSION]  # 4
        embedding_lag = kwargs[EMBEDDING_LAG]  # 1
        singular_values_of_matrix = kwargs[SINGULAR_VALUES]
    except KeyError:
        embedding_dimension = EMBEDDING_DIMENSION_DEFAULT
        embedding_lag = EMBEDDING_LAG_DEFAULT
        singular_values_of_matrix = SINGULAR_VALUES_DEFAULT
    return pyeeg.svd_entropy(samples,
                             Tau=embedding_lag,
                             DE=embedding_dimension,
                             W=singular_values_of_matrix)
Exemplo n.º 3
0
def features(mat):
    Kmax = 5
    Tau = 4
    DE = 10
    M = 10
    R = 0.3
    Band = np.arange(1, 86)
    Fs = 173
    DFA = pyeeg.dfa(mat)
    HFD = pyeeg.hfd(mat, Kmax)
    SVD_Entropy = pyeeg.svd_entropy(mat, Tau, DE)
    Fisher_Information = pyeeg.fisher_info(mat, Tau, DE)
    PFD = pyeeg.pfd(mat)
    sleep(0.01)

    return (DFA, HFD, SVD_Entropy, Fisher_Information, PFD)
Exemplo n.º 4
0
def features(mat):
    Kmax = 5
    Tau = 4
    DE = 10
    M = 10
    R = 0.3
    Band = np.arange(1, 86)
    Fs = 173
    DFA = pyeeg.dfa(mat)
    HFD = pyeeg.hfd(mat, Kmax)
    SVD_Entropy = pyeeg.svd_entropy(mat, Tau, DE)
    Fisher_Information = pyeeg.fisher_info(mat, Tau, DE)
    #ApEn               = pyeeg.ap_entropy(mat, M, R)      # very slow
    PFD = pyeeg.pfd(mat)
    Spectral_Entropy = pyeeg.spectral_entropy(mat, Band, Fs, Power_Ratio=None)
    sleep(0.01)

    return (DFA, HFD, SVD_Entropy, Fisher_Information, PFD, Spectral_Entropy)
Exemplo n.º 5
0
 def extract_features(couple_data):
     pca1 =  pca_project_data(couple_data, 1) #take 1st pca dimension
     pca1_mean =  np.mean(pca1, axis=0) #
     pca1_std   = np.std(pca1, axis=0)  # 
     pca1_med = np.median(pca1,  axis=0) #
     features = []
     def sinuosity_deviation_features(seq, mean, std):
         sinuosity_dict = {"A":0, "B":0, "C":0}
         deviation_dict = {"I":0, "II":0, "III":0}
         sinuosity_deviation_dict = {"A-I":0,"A-II":0,"A-III":0,"B-I":0,"B-II":0,"B-III":0,"C-I":0,"C-II":0,"C-III":0}
         n = len(seq)
         for i in range(1,n-1):
             current_af = seq[i]
             prev_af = seq[i-1]
             next_af = seq[i+1]
             sinu = abs((next_af - current_af) + (current_af - prev_af))
             if sinu == 0:      label1 = "A"
             elif 0< sinu <= 1: label1 = "B"
             else:              label1 = 'C'
             sinuosity_dict[label1] += 1
             devi = abs(current_af - mean)
             close =  std / 2
             if devi <= close: label2 = "I"
             elif devi <= std: label2 = "II" 
             elif devi > std:  label2 = "III" 
             deviation_dict[label2] += 1
             sinuosity_deviation_dict["%s-%s"%(label1,label2)] += 1
         return sinuosity_deviation_dict.values()    
     n = len(pca1)
     pca1_sinuosity_deviation = sinuosity_deviation_features( pca1, pca1_mean,  pca1_std )
     features += list(np.array(pca1_sinuosity_deviation)/float(n-2))
     seq =  pca1
     dfa = eg.dfa(seq); pfd = eg.pfd(seq)
     apen = eg.ap_entropy(seq,1,np.std(seq)*.2)
     svden = eg.svd_entropy(seq, 2, 2)
     features += [pca1_mean, pca1_med, pca1_std, dfa, pfd, apen, svden]
     return features
Exemplo n.º 6
0
N_REPLICATES = 5

SPECT_ENT_BANDS = 2 ** np.arange(0,8)/2

fun_to_test = [
                  {"times":100,"name":"hfd", "is_original":True,"fun": lambda x: pyeeg.hfd(x,2**3)},
                  {"times":100,"name":"hfd", "is_original":False,"fun": lambda x: univ.hfd(x,2**3)},
                  {"times":100,"name":"hjorth", "is_original":True,"fun": lambda x: pyeeg.hjorth(x)},
                  {"times":100,"name":"hjorth", "is_original":False,"fun": lambda x: univ.hjorth(x)},
                  {"times":100,"name":"pfd", "is_original":True, "fun":lambda x: pyeeg.pfd(x)},
                  {"times":100,"name":"pfd", "is_original":False, "fun":lambda x: pyeeg.pfd(x)},
                  {"times":2,"name":"samp_ent", "is_original":True, "fun":lambda x: pyeeg.samp_entropy(x,2,1.5)},
                  {"times":10,"name":"samp_ent", "is_original":False, "fun":lambda x: univ.samp_entropy(x,2,1.5,relative_r=False)},
                  {"times":2,"name":"ap_ent", "is_original":True, "fun":lambda x: pyeeg.ap_entropy(x,2,1.5)},
                  {"times":10,"name":"ap_ent", "is_original":False, "fun":lambda x: univ.ap_entropy(x,2,1.5)},
                  {"times":10,"name":"svd_ent", "is_original":True, "fun":lambda x: pyeeg.svd_entropy(x,2,3)},
                  {"times":100,"name":"svd_ent", "is_original":False, "fun":lambda x: univ.svd_entropy(x,2,3)},
                  {"times":10,"name":"fisher_info", "is_original":True, "fun":lambda x: pyeeg.fisher_info(x,2,3)},
                  {"times":100, "name":"fisher_info", "is_original":False, "fun":lambda x: univ.fisher_info(x,2,3)},
                  {"times":100,"name":"spectral_entropy", "is_original":True, "fun":lambda x: pyeeg.spectral_entropy(x,SPECT_ENT_BANDS,256)},
                  {"times":100, "name":"spectral_entropy", "is_original":False, "fun":lambda x: univ.spectral_entropy(x,256, SPECT_ENT_BANDS)},

    ]


def make_one_rep():
    ldfs = []
    for n in range(MIN_EPOCH_N, MAX_EPOCH_N + 1, EPOCH_STEP):
        a = numpy.random.normal(size=n)
        for fun in fun_to_test:
            f = lambda : fun["fun"](a)
Exemplo n.º 7
0
# Single Value Decomposition entropy (measures feature-richness in the sense that the higher the 
# entropy of the set of SVD weights, the more orthogonal vectors are required to 
# adequately explain it )
from pyeeg import svd_entropy, embed_seq
SVD_2, SVD_3 = [], []
SVD_5, SVD_10, SVD_15 = [], [], []
SVD_20, SVD_25, SVD_30 = [], [], []
for ii in np.arange(len(DF)):
    xx_ii = np.arange(len(DF.ix[ii].HB))
    selSleep_ii = np.where((xx_ii>DF.ix[ii].Sleep+60) & 
                      (xx_ii<=DF.ix[ii].Awake-60))
    HB_ii = DF.ix[ii]['HB'] 

    Tau = 1
    
    SVD_2.append(svd_entropy(HB_ii[selSleep_ii], Tau, 2))
    SVD_3.append(svd_entropy(HB_ii[selSleep_ii], Tau, 3))
    SVD_5.append(svd_entropy(HB_ii[selSleep_ii], Tau, 5))
    SVD_10.append(svd_entropy(HB_ii[selSleep_ii], Tau, 10))
    SVD_15.append(svd_entropy(HB_ii[selSleep_ii], Tau, 15))
    SVD_20.append(svd_entropy(HB_ii[selSleep_ii], Tau, 20))
    SVD_25.append(svd_entropy(HB_ii[selSleep_ii], Tau, 25))
    SVD_30.append(svd_entropy(HB_ii[selSleep_ii], Tau, 30))


# In[15]:

SVD_2, SVD_3 = np.array(SVD_2), np.array(SVD_3)
SVD_5, SVD_10, SVD_15 = np.array(SVD_2), np.array(SVD_10), np.array(SVD_15)
SVD_20, SVD_25, SVD_30 = np.array(SVD_20), np.array(SVD_25), np.array(SVD_30),
selModerate = np.where(DF.Stress == 'moderate')
    def feature_wave(self, toolName=None, Fs=256):
        if (toolName == None):
            print('please select a tool')
            return

        if toolName in self.FeatureSet.dict[0]:
            index = self.FeatureSet.dict[0][toolName]
        else:
            index = -1
        print(toolName)
        if toolName == 'DWT':
            answer_train = DWT(self.DataSet.trainSet_data[0], 'db4')
            answer_test = DWT(self.DataSet.testSet_data[0], 'db4')
            print('DWT feature extraction succeed db4')
        elif toolName == 'hurst':
            answer_train = [
                pyeeg.hurst(i) for i in self.DataSet.trainSet_data[0]
            ]
            answer_test = [
                pyeeg.hurst(i) for i in self.DataSet.testSet_data[0]
            ]
            print('hurst feature extraction succeed')
        elif toolName == 'dfa':
            answer_train = [
                pyeeg.dfa(i, L=[4, 8, 16, 32, 64])
                for i in self.DataSet.trainSet_data[0]
            ]
            answer_test = [
                pyeeg.dfa(i, L=[4, 8, 16, 32, 64])
                for i in self.DataSet.testSet_data[0]
            ]
            print('dfa feature extraction succeed')
        elif toolName == 'fisher_info':
            answer_train = [
                pyeeg.fisher_info(i, 2, 20)
                for i in self.DataSet.trainSet_data[0]
            ]
            answer_test = [
                pyeeg.fisher_info(i, 2, 20)
                for i in self.DataSet.testSet_data[0]
            ]
            print('fisher_info feature extraction succeed')
        elif toolName == 'svd_entropy':
            answer_train = [
                pyeeg.svd_entropy(i, 2, 20)
                for i in self.DataSet.trainSet_data[0]
            ]
            answer_test = [
                pyeeg.svd_entropy(i, 2, 20)
                for i in self.DataSet.testSet_data[0]
            ]
            print('svd_entropy feature extraction succeed')
        elif toolName == 'spectral_entropy':
            bandlist = [0.5, 4, 7, 12, 30, 100]
            answer_train = [
                pyeeg.spectral_entropy(i, bandlist, Fs)
                for i in self.DataSet.trainSet_data[0]
            ]
            answer_test = [
                pyeeg.spectral_entropy(i, bandlist, Fs)
                for i in self.DataSet.testSet_data[0]
            ]
            print('spectral_entropy feature extraction succeed')
        elif toolName == 'hjorth':
            # 得到两个量 第一个是 mobility 第二个是 complexity
            answer_train = [
                pyeeg.hjorth(i) for i in self.DataSet.trainSet_data[0]
            ]
            answer_test = [
                pyeeg.hjorth(i) for i in self.DataSet.testSet_data[0]
            ]
            answer_train = np.array(answer_train)
            answer_test = np.array(answer_test)

            for i in answer_train:
                i[1] = i[1] / 100
            for i in answer_test:
                i[1] = i[1] / 100

            #只取Mobility
            answer_train = np.array(answer_train[:, 0])
            answer_test = np.array(answer_test[:, 0])
            print('hjorth feature extraction succeed')
        elif toolName == 'hfd':
            answer_train = [
                pyeeg.hfd(i, 8) for i in self.DataSet.trainSet_data[0]
            ]
            answer_test = [
                pyeeg.hfd(i, 8) for i in self.DataSet.testSet_data[0]
            ]
            print('hfd feature extraction succeed')
        elif toolName == 'pfd':
            answer_train = [
                pyeeg.pfd(i) for i in self.DataSet.trainSet_data[0]
            ]
            answer_test = [pyeeg.pfd(i) for i in self.DataSet.testSet_data[0]]
            print('pfd feature extraction succeed')
        elif toolName == 'bin_power':
            bandlist = [0.5, 4, 7, 12]  #,30,100]
            answer_train = [
                pyeeg.bin_power(i, bandlist, Fs)
                for i in self.DataSet.trainSet_data[0]
            ]
            answer_test = [
                pyeeg.bin_power(i, bandlist, Fs)
                for i in self.DataSet.testSet_data[0]
            ]
            print('bin_power feature extraction succeed')

        else:
            print('does not have this kind of mode')

        answer_train = np.array(answer_train)
        answer_train = answer_train.reshape(len(answer_train), -1)
        answer_test = np.array(answer_test)
        answer_test = answer_test.reshape(len(answer_test), -1)
        if index == -1:
            #print(len(self.FeatureSet.feature.trainSet_feat[0]),len(answer_train))
            self.FeatureSet.feature.trainSet_feat[0] = np.column_stack(
                (self.FeatureSet.feature.trainSet_feat[0], answer_train))
            self.FeatureSet.feature.testSet_feat[0] = np.column_stack(
                (self.FeatureSet.feature.testSet_feat[0], answer_test))
            self.FeatureSet.dict[0][toolName] = [
                self.FeatureSet.size[0],
                self.FeatureSet.size[0] + len(answer_train[0])
            ]
            self.FeatureSet.size[0] += len(answer_train[0])
        else:
            self.FeatureSet.feature.trainSet_feat[0][:, index[0]:index[1]] = [
                i for i in answer_train
            ]
            self.FeatureSet.feature.testSet_feat[0][:, index[0]:index[1]] = [
                i for i in answer_test
            ]
                         173,
                         Power_Ratio=None)
    spectral_entropy_features_train.append(h)

spectral_entropy_features_test = []
for i in range(X_test.shape[0]):
    ##print i
    h = spectral_entropy(X_test[i, ], [0.54, 5, 7, 12, 50],
                         173,
                         Power_Ratio=None)
    spectral_entropy_features_test.append(h)
'''SVD Entropy  '''  ## Okay
svd_entropy_features_train = []
for i in range(X_train.shape[0]):
    ##print i
    h = svd_entropy(X_train[i, ], 4, 10, W=None)
    svd_entropy_features_train.append(h)

svd_entropy_features_test = []
for i in range(X_test.shape[0]):
    ##print i
    h = svd_entropy(X_test[i, ], 4, 10, W=None)
    svd_entropy_features_test.append(h)
'''Fisher Information  '''  ##Okay
fisher_info_features_train = []
for i in range(X_train.shape[0]):
    ##print i
    h = fisher_info(X_train[i, ], 4, 10, W=None)
    fisher_info_features_train.append(h)

fisher_info_features_test = []
    ##print i
    h = spectral_entropy(X_train[i,], [0.54, 5, 7, 12, 50], 173, Power_Ratio=None)
    spectral_entropy_features_train.append(h)


spectral_entropy_features_test = []
for i in range(X_test.shape[0]):
    ##print i
    h = spectral_entropy(X_test[i,], [0.54, 5, 7, 12, 50], 173, Power_Ratio=None)
    spectral_entropy_features_test.append(h)

"""SVD Entropy  """  ## Okay
svd_entropy_features_train = []
for i in range(X_train.shape[0]):
    ##print i
    h = svd_entropy(X_train[i,], 4, 10, W=None)
    svd_entropy_features_train.append(h)


svd_entropy_features_test = []
for i in range(X_test.shape[0]):
    ##print i
    h = svd_entropy(X_test[i,], 4, 10, W=None)
    svd_entropy_features_test.append(h)


"""Fisher Information  """  ##Okay
fisher_info_features_train = []
for i in range(X_train.shape[0]):
    ##print i
    h = fisher_info(X_train[i,], 4, 10, W=None)
Exemplo n.º 11
0
def calculate_features(samples):
    data = samples
    if not samples:
        print("no samples")
        return []

    band = [0.5, 4, 7, 12, 30]
    a = randn(4097)
    # approx = pyeeg.ap_entropy(data, 5, 1)
    approx = 0
    DFA = pyeeg.dfa(data)
    first_order_diff = [data[i] - data[i - 1] for i in range(1, len(data))]
    fisher_info = pyeeg.fisher_info(data, 1, 1, W=None)
    embed_seq = pyeeg.embed_seq(data, 1, 1)
    hfd = pyeeg.hfd(data, 6)
    hjorth = pyeeg.hjorth(data, D=None)
    hurst = pyeeg.hurst(data)
    PFD = pyeeg.pfd(data)
    sam_ent = pyeeg.samp_entropy(data, 1, 2)
    spectral_entropy = pyeeg.spectral_entropy(data,
                                              band,
                                              256,
                                              Power_Ratio=None)
    svd = pyeeg.svd_entropy(data, 6, 4, W=None)
    PSI = pyeeg.bin_power(data, band, 256)

    # # Power Spectral Intensity (PSI) and Relative Intensity Ratio (RIR) Two 1- D v ec t o rs
    # # print("bin_power = ", PSI)
    # # Petrosian Fractal Dimension (PFD) Ascalar
    # print("PFD = ", PFD)
    # # Higuchi Fractal Dimension (HFD) Ascalar
    # print("hfd = ", hfd)
    # # Hjorth mobility and complexity Two s c a la rs
    # print("hjorth = ", hjorth)
    # # Spectral Entropy (Shannon’s entropy of RIRs) Ascalar
    # print("spectral_entropy = ", spectral_entropy)
    # # SVD Entropy Ascalar
    # print("svd = ", svd)
    # # Fisher Information Ascalar
    # print("fisher_info = ", fisher_info)
    # # Approximate Entropy (ApEn) Ascalar
    # print("approx entrophy = ", approx)
    # # Detrended Fluctuation Analysis (DFA) Ascalar
    # print("DFA = ", DFA)
    # # HurstExponent(Hurst) Ascalar
    # print("Hurst_Exponent = ", hurst)
    # # Build a set of embedding sequences from given time series X with lag Tau and embedding dimension
    # print("embed_seq = ", embed_seq)
    # # Compute the first order difference of a time series.
    # print("first_order_diff = ", first_order_diff)

    return {
        'approximate': approx,
        'DFA': DFA,
        'fisher_info': fisher_info,
        'embed_seq': embed_seq,
        'hfd': hfd,
        'hjorth': hjorth,
        'hurst': hurst,
        'PFD': PFD,
        'sam_ent': sam_ent,
        'spectral_entropy': spectral_entropy,
        'svd': svd,
        'PSI': PSI,
        'first_order_diff': first_order_diff
    }
Exemplo n.º 12
0
    def compute_pyeeg_feats(self, rec):
        # these values are taken from the tuh paper
        TAU, DE, Kmax = 4, 10, 5
        pwrs, pwrrs, pfds, hfds, mblts, cmplxts, ses, svds, fis, hrsts = [], [], [], [], [], [], [], [], [], []
        dfas, apes = [], []

        for window_id, window in enumerate(rec.signals):
            for window_electrode_id, window_electrode in enumerate(window):
                # taken from pyeeg code / paper
                electrode_diff = list(np.diff(window_electrode))
                M = pyeeg.embed_seq(window_electrode, TAU, DE)
                W = scipy.linalg.svd(M, compute_uv=False)
                W /= sum(W)

                power, power_ratio = self.bin_power(window_electrode,
                                                    self.bands,
                                                    rec.sampling_freq)
                pwrs.extend(list(power))
                # mean of power ratio is 1/(len(self.bands)-1)
                pwrrs.extend(list(power_ratio))

                pfd = pyeeg.pfd(window_electrode, electrode_diff)
                pfds.append(pfd)

                hfd = pyeeg.hfd(window_electrode, Kmax=Kmax)
                hfds.append(hfd)

                mobility, complexity = pyeeg.hjorth(window_electrode,
                                                    electrode_diff)
                mblts.append(mobility)
                cmplxts.append(complexity)

                se = self.spectral_entropy(window_electrode, self.bands,
                                           rec.sampling_freq, power_ratio)
                ses.append(se)

                svd = pyeeg.svd_entropy(window_electrode, TAU, DE, W=W)
                svds.append(svd)

                fi = pyeeg.fisher_info(window_electrode, TAU, DE, W=W)
                fis.append(fi)

                # this crashes...
                # ape = pyeeg.ap_entropy(electrode, M=10, R=0.3*np.std(electrode))
                # apes.append(ape)

                # takes very very long to compute
                # hurst = pyeeg.hurst(electrode)
                # hrsts.append(hurst)

                # takes very very long to compute
                # dfa = pyeeg.dfa(electrode)
                # dfas.append(dfa)

        pwrs = np.asarray(pwrs).reshape(rec.signals.shape[0],
                                        rec.signals.shape[1],
                                        len(self.bands) - 1)
        pwrs = np.mean(pwrs, axis=0)

        pwrrs = np.asarray(pwrrs).reshape(rec.signals.shape[0],
                                          rec.signals.shape[1],
                                          len(self.bands) - 1)
        pwrrs = np.mean(pwrrs, axis=0)

        pfds = np.asarray(pfds).reshape(rec.signals.shape[0],
                                        rec.signals.shape[1])
        pfds = np.mean(pfds, axis=0)

        hfds = np.asarray(hfds).reshape(rec.signals.shape[0],
                                        rec.signals.shape[1])
        hfds = np.mean(hfds, axis=0)

        mblts = np.asarray(mblts).reshape(rec.signals.shape[0],
                                          rec.signals.shape[1])
        mblts = np.mean(mblts, axis=0)

        cmplxts = np.asarray(cmplxts).reshape(rec.signals.shape[0],
                                              rec.signals.shape[1])
        cmplxts = np.mean(cmplxts, axis=0)

        ses = np.asarray(ses).reshape(rec.signals.shape[0],
                                      rec.signals.shape[1])
        ses = np.mean(ses, axis=0)

        svds = np.asarray(svds).reshape(rec.signals.shape[0],
                                        rec.signals.shape[1])
        svds = np.mean(svds, axis=0)

        fis = np.asarray(fis).reshape(rec.signals.shape[0],
                                      rec.signals.shape[1])
        fis = np.mean(fis, axis=0)

        return list(pwrs.ravel()), list(pwrrs.ravel(
        )), pfds, hfds, mblts, cmplxts, ses, svds, fis, apes, hrsts, dfas
Exemplo n.º 13
0
     "times": 2,
     "name": "ap_ent",
     "is_original": True,
     "fun": lambda x: pyeeg.ap_entropy(x, 2, 1.5)
 },
 {
     "times": 10,
     "name": "ap_ent",
     "is_original": False,
     "fun": lambda x: univ.ap_entropy(x, 2, 1.5)
 },
 {
     "times": 10,
     "name": "svd_ent",
     "is_original": True,
     "fun": lambda x: pyeeg.svd_entropy(x, 2, 3)
 },
 {
     "times": 100,
     "name": "svd_ent",
     "is_original": False,
     "fun": lambda x: univ.svd_entropy(x, 2, 3)
 },
 {
     "times": 10,
     "name": "fisher_info",
     "is_original": True,
     "fun": lambda x: pyeeg.fisher_info(x, 2, 3)
 },
 {
     "times": 100,
def myFeaturesExtractor(
        X, myM, myV):  # X has to be a matrix where each row is a channel
    N = len(X)  # number of channels
    L = len(X[0])
    maxtLyap = min(500, L // 2 + L // 4)
    lyapLags = np.arange(maxtLyap) / Fs

    # get number of features
    nFeatures = nMono * N + N * (N - 1) / 2
    # here we initialize the list of features // We will transform it to an array later
    featList = np.zeros((int(nFeatures)))
    # deal with monovariate features first
    for kChan in range(N):
        kFeat = 0
        mySig = X[kChan, :]
        #========== Stats ========================
        myMean = myM[kChan]
        featList[nMono * kChan + kFeat] = myMean
        kFeat += 1
        myMax = max(mySig)
        featList[nMono * kChan + kFeat] = myMax
        kFeat += 1
        myMin = min(mySig)
        featList[nMono * kChan + kFeat] = myMin
        kFeat += 1
        peak = max(abs(np.array([myMin, myMax])))
        featList[nMono * kChan + kFeat] = peak
        kFeat += 1
        myVar = myV[kChan]
        featList[nMono * kChan + kFeat] = myVar
        kFeat += 1
        featList[nMono * kChan + kFeat] = sp.skew(mySig)
        kFeat += 1
        featList[nMono * kChan + kFeat] = sp.kurtosis(mySig)
        kFeat += 1
        myRMS = rms(mySig)
        featList[nMono * kChan + kFeat] = myRMS
        kFeat += 1
        featList[nMono * kChan + kFeat] = peak / myRMS
        kFeat += 1

        featList[nMono * kChan + kFeat] = totVar(mySig)
        kFeat += 1
        featList[nMono * kChan + kFeat] = pyeeg.dfa(mySig)
        kFeat += 1
        featList[nMono * kChan + kFeat] = pyeeg.hurst(mySig)
        kFeat += 1
        hMob, hComp = pyeeg.hjorth(mySig)
        featList[nMono * kChan + kFeat] = hMob
        kFeat += 1
        featList[nMono * kChan + kFeat] = hComp
        kFeat += 1
        ## ======== fractal ========================
        # Now we need to get the embeding time lag Tau and embeding dmension
        ac = delay.acorr(mySig, maxtau=maxTauLag, norm=True, detrend=True)
        Tau = firstTrue(ac < corrThresh)  # embeding delay

        f1 , f2 , f3 = dimension.fnn(mySig, dim=dim, tau=Tau, R=10.0, A=2.0, metric='euclidean',\
                                     window=10,maxnum=None, parallel=True)
        myEmDim = firstTrue(f3 < fracThresh)
        # Here we construct the Embeding Matrix Em
        Em = pyeeg.embed_seq(mySig, Tau, myEmDim)
        U, s, Vh = linalg.svd(Em)
        W = s / np.sum(s)  # list of singular values in decreasing order
        FInfo = pyeeg.fisher_info(X, Tau, myEmDim, W=W)
        featList[nMono * kChan + kFeat] = FInfo
        kFeat += 1
        featList[nMono * kChan + kFeat] = Tau
        kFeat += 1
        featList[nMono * kChan + kFeat] = myEmDim
        kFeat += 1
        #========================================
        PFD = pyeeg.pfd(mySig, D=None)
        hfd6 = pyeeg.hfd(mySig, 6)
        hfd10 = pyeeg.hfd(mySig, 10)
        # Now we fit aline and get its slope to have Lyapunov exponent
        divAvg = lyapunov.mle(Em,
                              maxt=maxtLyap,
                              window=3 * Tau,
                              metric='euclidean',
                              maxnum=None)
        poly = np.polyfit(lyapLags,
                          divAvg,
                          1,
                          rcond=None,
                          full=False,
                          w=None,
                          cov=False)
        LyapExp = poly[0]

        featList[nMono * kChan + kFeat] = PFD
        kFeat += 1
        featList[nMono * kChan + kFeat] = hfd6
        kFeat += 1
        featList[nMono * kChan + kFeat] = hfd10
        kFeat += 1
        featList[nMono * kChan + kFeat] = LyapExp
        kFeat += 1

        ## ======== Entropy ========================
        tolerance = 1 / 4
        entropyDim = max([myEmDim, PFD])

        featList[nMono * kChan + kFeat] = pyeeg.samp_entropy(
            mySig, entropyDim, tolerance)
        kFeat += 1
        featList[nMono * kChan + kFeat] = pyeeg.svd_entropy(mySig,
                                                            Tau,
                                                            myEmDim,
                                                            W=W)
        kFeat += 1

        # here we compute bin power
        power, power_Ratio = pyeeg.bin_power(mySig, freqBins, Fs)
        featList[nMono * kChan + kFeat] = pyeeg.spectral_entropy(
            mySig, freqBins, Fs, Power_Ratio=power_Ratio)
        kFeat += 1
        ## ======== Spectral ========================
        for kBin in range(len(freqBins) - 1):
            featList[nMono * kChan + kFeat] = power[kBin]
            kFeat += 1
            featList[nMono * kChan + kFeat] = power_Ratio[kBin]
            kFeat += 1

    # deal with multivariate features first
    #============ connectivity ==================
    corrList = connectome(X)
    nConnect = len(corrList)
    if N * (N - 1) / 2 != nConnect:
        raise ValueError('incorrect number of correlation coeffs')

    for kC in range(nConnect):
        featList[-nConnect + kC] = corrList[kC]

    return featList